React-native: Center align Multiline Text Component

Created on 17 Nov 2017  路  1Comment  路  Source: facebook/react-native

Is this a bug report?

Yes

Have you read the Contributing Guidelines?

Yes

Environment

OS: macOS Sierra 10.12.6
Node: 8.7.0
Yarn: Not Found
npm: 5.5.1
Watchman: 4.9.0
Xcode: Xcode 9.1 Build version 9B55
Android Studio: 2.3 AI-162.4069837

react-native: 0.49.5
react: 16.0.0-beta.5

Steps to Reproduce

1.Tried aligning through View Component
2.Tried aligning through Text Component

Expected Behavior

Text should be center aligned

Actual Behavior


Text not aligning to center

Reproducible Demo


If the <Text> is multilined than it is not center aligned

<View style = {{
    justifyContent: 'center',
    alignItems: 'center'}}>
          <Text style={{alignSelf:'center',fontSize:20,justifyContent:'center',alignItems:'center'}}>
             A very big multiline text that can not be accumulated in a single line is shown here with all the attributes trying to center it</Text>
        </View>

Locked

Most helpful comment

textAlign: 'center'

Will do the trick

>All comments

textAlign: 'center'

Will do the trick

Was this page helpful?
0 / 5 - 0 ratings

Related issues

josev55 picture josev55  路  3Comments

DreySkee picture DreySkee  路  3Comments

grabbou picture grabbou  路  3Comments

anchetaWern picture anchetaWern  路  3Comments

aniss picture aniss  路  3Comments