user15322469
user15322469

Reputation: 909

How can I remove whitespace from a string in react-native?

I am using react-native. However, when a long string is input, the line breaks are not consistent in the right screen.

like this

enter image description here

However, I would like the string to wrap consistently as in the image below.

enter image description here

this is my code how can i fix or add code??

    import React from 'react';
    import styled from 'styled-components/native';

    const Container = styled.View`
      background: lightskyblue;
      width: 100%;
      height: 100%;
    `;

    const PolicyContainer = styled.View`
      background: lightyellow;
    `;

    const Label = styled.Text`
      font-size: 13px;
    `;
    const Policy = () => {
      return (
        <Container>
          <PolicyContainer>
            <Label>
              {'<'}example{'>'}('https://example'이하 'example')은(는) 「개인정보
              보호법」 제30조에 따라 정보주체의 개인정보를 보호하고 이와 관련한
              고충을 신속하고 원활하게 처리할 수 있도록 하기 위하여 다음과 같이
              개인정보 처리방침을 수립·공개합니다.
            </Label>
          </PolicyContainer>
        </Container>
      );
    };

    export default Policy;

Upvotes: 0

Views: 604

Answers (1)

jonathanccalixto
jonathanccalixto

Reputation: 3208

Try using text-align: justify; in the style of Label. I believe it will solve your problem.

const Label = styled.Text`
  font-size: 13px;
  text-align: justify;
`;

Upvotes: 1

Related Questions