Skip to content

Commit

Permalink
fix(app): 修复移动版部分位置中文会出现被截掉顶部一部分像素的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
moonrailgun committed Apr 21, 2020
1 parent 070f85d commit 1c6773e
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
15 changes: 10 additions & 5 deletions src/app/src/components/messageTypes/Base.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,14 @@ const MsgBubble = styled.View<{
align-self: ${(props) => (props.me ? 'flex-end' : 'flex-start')};
`;

const MsgSenderNameText = styled.Text<{
me: boolean;
}>`
margin: 4px 0;
font-size: 12px;
text-align: ${(props) => (props.me ? 'right' : 'left')};
`;

const MsgTypeIcon = styled(TIcon)`
margin: 0 4px;
align-self: center;
Expand Down Expand Up @@ -208,11 +216,9 @@ class Base<P extends MessageProps = MessageProps> extends React.PureComponent<
)}

<View style={styles.itemBody}>
<Text
style={[...styles.itemName, me ? { textAlign: 'right' } : null]}
>
<MsgSenderNameText me={me}>
{this.getSenderName()}
</Text>
</MsgSenderNameText>
<MsgContainer me={me}>
{/* 不同消息类型的显示 */}
{_has(this.msgBubbleType, type)
Expand All @@ -237,7 +243,6 @@ const styles = {
],
itemView: [sb.direction(), sb.padding(10, 10)],
itemBody: [sb.padding(0, 4), sb.margin(0, 6), sb.flex()],
itemName: [{ marginBottom: 4, marginTop: 4 }, sb.font(12)],
};

export default Base;
7 changes: 5 additions & 2 deletions src/app/src/screens/AccountScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ import { showToast } from '@src/shared/redux/actions/ui';
import { TRPGState } from '@redux/types/__all__';
const Item = List.Item;

const AccountUserNameText = styled.Text`
font-size: 18px;
`;

const AccountList = styled(List)`
margin-top: 10px;
`;
Expand Down Expand Up @@ -73,7 +77,7 @@ class AccountScreen extends React.Component<Props> {
width={60}
/>
<View style={{ flex: 1 }}>
<Text style={styles.username}>{name}</Text>
<AccountUserNameText>{name}</AccountUserNameText>
<Text style={styles.userdesc} numberOfLines={1}>
{userInfo.sign}
</Text>
Expand Down Expand Up @@ -172,7 +176,6 @@ const styles = {
sb.alignCenter(),
{ height: 80 },
],
username: [sb.font(18)],
userdesc: [sb.color('#999')],
arrow: [
{ fontFamily: 'iconfont', marginRight: 6 },
Expand Down

0 comments on commit 1c6773e

Please sign in to comment.