TextInput Alignment does not work on iOS 11
See original GitHub issueIs this a bug report?
Yes
Have you read the Contributing Guidelines?
Yes
Environment
Environment: OS: macOS Sierra 10.12.6 Node: 7.7.2 Yarn: Not Found npm: 5.4.2 Watchman: 4.7.0 Xcode: Xcode 9.0 Build version 9A235 Android Studio: Not Found
Packages: (wanted => installed) react-native: 0.49.3 => 0.49.3 react: 16.0.0-alpha.12 => 16.0.0-alpha.12
Steps to Reproduce
- Create a
TextInput
and few buttons. Set the alignment dynamically as you press buttons usingtextAlign
.
<View style ={{marginTop: 42}}>
<Button
onPress={ this.setStateLeft }
title="Left"
color="#841584"
/>
<Button
onPress={ this.setStateCenter }
title="Center"
color="#841584"
/>
<Button
onPress={ this.setStateRight }
title="Right"
color="#841584"
/>
<TextInput
style={{height: 40, borderColor: 'gray', borderWidth: 1, marginTop: 112, textAlign: this.state.alignText}}
onChangeText={(text) => this.setState({text})}
value={this.state.text}
/>
</View>
- Press the buttons
Expected Behavior
The alignment should work on iOS devices, irrespective of versions.
Actual Behavior
The alignment works as expected on iOS 10, but not on iOS 11 as seen below. The simulator on the left is iOS 11 and on right is iOS 10.
Reproducible Demo
Issue Analytics
- State:
- Created 6 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
text input alignment wrong on mobile devices (possibly only ...
I got 2 forms at my webpage and they are wrongly aligned on iOS devices (iPhone, iPad Safari).
Read more >text alignment in SwiftUI | Apple Developer Forums
I would like to center align the text inside a TextField. I just couldn't find a way to do it. I know in...
Read more >align-content - CSS: Cascading Style Sheets - MDN Web Docs
The CSS align-content property sets the distribution of space between and around content items along a flexbox's cross-axis or a grid's ...
Read more >Input - Lightning Design System
You can style the HTML <input> element to align with the Salesforce brand by using the ... not an anchor <a> , in...
Read more >TextInput - React Native
This may cause issues with components that have position: 'absolute' while the keyboard is active. To avoid this behavior either specify ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
This appears to be an IOS 11 bug. I was able to reproduce it in a simple standalone app.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Maybe the issue has been fixed in a recent release, or perhaps it is not affecting a lot of people. If you think this issue should definitely remain open, please let us know why. Thank you for your contributions.