Quantcast
Channel: Active questions tagged react-native+ios - Stack Overflow
Viewing all articles
Browse latest Browse all 16552

React Native multi-line vertically centered text on IOS trouble

$
0
0

I'm using a multi line TextInput in my react-native application and been stuck on this for a while. I can not get the text to be vertically aligned on IOS devices.

using textAlign='center' puts the text on IOS vertically centered... but it becomes an unwrapped never ending line.

adding multiline={true} negates the vertically aligned text in IOS and puts it at the top of the input.

<TextInput    style={{         width: wp('80%'),         height: hp('25%'),         borderWidth: 1,         borderRadius: 10,           fontSize: RF(3),     }}    textAlign={'center'}    multiline={true}    onChangeText={entry => this.setState({entry})}    value={this.state.entry}/>

I would like the behavior to be like android in that it shows the placeholder text vertically and horizontally centered and when user inputs more text it starts creating multi lines if needed but always vertically and horizontally centered.

Please see image with android version on left and IOS on right.

Android on left, IOS on right


Viewing all articles
Browse latest Browse all 16552

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>