【问题标题】:If there are spaces in the string, it will be Line change in react-native如果字符串中有空格,会在 react-native 中换行
【发布时间】:2021-09-11 15:43:28
【问题描述】:

我正在使用带有样式组件的 react-native

如果你在文本中键入一个字符串并按空格键,它将换行或创建一个两个多的空格。

喜欢这张图片

我只在图片中使用过一两次空格。但是换行是这样的:

这是我的代码

    const Container = styled.View`
      flex-direction: column;
      margin: 1% 2% 0 2.5%;
      border-bottom-width: 0.8px;
      border-color: #c6cfc7;
    `;

    const CommentContainer = styled.View`
      padding: 4.5% 2% 3.5% 5%;
      margin-top: 0.5%;
    `;

    const SecondCommentCon = styled.View`
    `;


    const LabelContainer = styled.View`
      background: lightblue;
      width: 100%;
    `;

    const Label = styled.Text`
      background: lightcoral;
      padding-top: 3.5%;
      line-height: 18px;
      top: 0.5%;
      font-size: 13px;
    
    `;

      return (
        <>
          <Container>
          <CommentContainer>
              <SecondCommentCon>
                <LabelContainer>
                  <Label>{item.content}</Label>
                </LabelContainer>
              </SecondCommentCon>
              </CommentContainer>
          </Container>
        </>
      );
    };
    export default TodoItem;

如何修改我的代码来解决这个问题?

【问题讨论】:

    标签: javascript css node.js reactjs react-native


    【解决方案1】:

    【讨论】:

      猜你喜欢
      • 2021-09-11
      • 1970-01-01
      • 2019-11-01
      • 1970-01-01
      • 2018-03-17
      • 2015-08-03
      • 2020-10-08
      • 2022-11-02
      • 2019-12-09
      相关资源
      最近更新 更多