【问题标题】:React native text not wrapping on Native Base Title反应原生文本不包裹在原生基础标题上
【发布时间】:2017-05-13 20:57:56
【问题描述】:

我似乎无法让我的标题文本换行:

I'm using native-base

let SearchPage = (props) => {
  const menu = (
    <Container>
      <Header style={styles.header}>
        <Left>
          <Button transparent onPress={props.togglePageMenu}>
            <Icon name='menu' />
          </Button>
        </Left>
        <Body>
          <Title style={styles.title} numberOfLines={2}>Search Products</Title>
        </Body>
        <Right>
        </Right>
      </Header>...

样式...:

      title: {
        flexWrap:'wrap',
        flex: 1,
        color: '#9E9E9E',
        fontWeight: '200',
        fontSize: 19
      },
  header: {
    backgroundColor: '#F7F7F7'
  },

我做错了什么?

【问题讨论】:

  • 使用 alignItems: 'flex-start' 而不是 flexWrap:'wrap'

标签: javascript css reactjs react-native


【解决方案1】:

我不得不停止使用 Native Base 中的 &lt;Title&gt;,而是使用 Native Base 中的 &lt;Text&gt;。我猜Title 有一些幕后样式可以防止它换行。

【讨论】:

  • 你试过用 alignitems 换行吗?
猜你喜欢
  • 2020-12-19
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2017-03-31
  • 2018-02-18
相关资源
最近更新 更多