CharlesMangwa / react-native-simple-markdown

📜 React Native Markdown component (iOS & Android).
https://www.npmjs.com/package/react-native-simple-markdown
MIT License
415 stars 133 forks source link

Can't seem to center align text #121

Open angarc opened 4 years ago

angarc commented 4 years ago

I've tried:

text: {
  textAlign: 'center'
}

but that doesn't work.

I've also tried adding the same styling to the View that surrounds the Markdown, but that doesn't work either.

When I try

paragraph: {
  textAlign: 'center'
}

that messes up everything! in fact, even if i just add

paragraph: {}

then all the text gets ruined and displays only one word per line for some reason.

How can I center align text?? Here are all the relevant bits:

renderDescription(description) {
  if (description === '' || description === null) return 

  return (<Markdown styles={styles.resource.description}>{description}</Markdown>)
}

<View key={resource.id} style={styles.resource.container}>
  { this.renderDescription(resource.description) }
</View>

const styles = {
  resource: {
    container: {
      marginTop: 20,
      marginBottom: 20,
    },
    description: {
      view: {
        marginTop: 10
      },
      text: {
        fontFamily: 'Gotham-Book',
        textAlign: 'center', // Doesn't work
      },
    },
  }
}
raphael-ms commented 3 years ago

Any updates?