Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

justify text not works as expected! #47

Open
hristowwe opened this issue Feb 11, 2022 · 1 comment
Open

justify text not works as expected! #47

hristowwe opened this issue Feb 11, 2022 · 1 comment

Comments

@hristowwe
Copy link

hristowwe commented Feb 11, 2022

Hello, first I want to thank you for the wonderful library! However, after trying it, I found that there was an bug in the styling property! I will post my code below but let me explain first! So when i set textAlign: "justify", It puts extra white space even though it does not exist in the original text. See this photo !
Screenshot_1644616278

In the original text it looks like this typesetting, remaining essentially - there aren't that many spaces! But in styled text there is more than one! So my code so far -

import { StyleSheet, View } from "react-native";
import StyledText from "react-native-styled-text";

export default function App() {
  const text =
    "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.";

  return (
    <View style={styles.container}>
      <StyledText style={styles.header}>{text}</StyledText>
    </View>
  );
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    backgroundColor: "#fff",
  },
  header: {
    fontSize: 24,
    color: "orange",
    textAlign: "justify",
    padding: 30,
  },
});

@bjornegil
Copy link
Contributor

Thanks for your feedback @hristowwe! I think you will get the same result if you just use the react-native Text component directly (which should also be returned by StyledText since no nested styling is applied in this case). Also I think this is the desired formatting "justify": all wrapped lines are get spacing between words to fill the given width.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants