-
Notifications
You must be signed in to change notification settings - Fork 24.3k
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
Placeholder's TextInput breaking lines after change on Android #30666
Comments
I justed tested this exact code in the RNTester example and I could not reproduce on Android API 30. Please include details of the Android API on which you experience this issue and the rn version. I have been testing on the latest react-native master. Thanks CLICK TO OPEN TESTS RESULTS
class RewriteExample extends React.Component<$FlowFixMeProps, any> {
constructor(props) {
super(props);
this.state = {text: '', value: ''};
}
render() {
const limit = 20;
const remainder = limit - this.state.text.length;
const remainderColor = remainder > 5 ? 'blue' : 'red';
return (
<View style={styles.container}>
<TextInput
style={styles.input}
autoCorrect={false}
placeholder="Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has"
returnKeyType='search'
style={styles.input}
value={this.state.value}
numberOfLines={1}
onChangeText={(value) => this.setState({ value })}
/>
</View>
);
}
}
const styles = StyleSheet.create({
container: {
height: 50,
borderWidth: 1,
borderColor: "#222",
borderRadius: 25,
marginTop: 20,
paddingLeft: 20,
},
input: {
flex: 1,
fontSize: 14,
marginHorizontal: 10,
},
default: {
borderWidth: StyleSheet.hairlineWidth,
borderColor: '#0f0f0f',
flex: 1,
fontSize: 13,
padding: 4,
},
multiline: {
borderWidth: StyleSheet.hairlineWidth,
borderColor: '#0f0f0f',
flex: 1,
fontSize: 13,
height: 50,
padding: 4,
marginBottom: 4,
},
singleLine: {
fontSize: 16,
},
labelContainer: {
flexDirection: 'row',
marginVertical: 2,
},
label: {
width: 115,
alignItems: 'flex-end',
marginRight: 10,
paddingTop: 2,
},
inputContainer: {
flex: 1,
},
rewriteContainer: {
flexDirection: 'row',
alignItems: 'center',
},
remainder: {
textAlign: 'right',
width: 24,
},
hashtag: {
color: 'blue',
fontWeight: 'bold',
},
eventLabel: {
margin: 3,
fontSize: 12,
},
}); |
Since this does repro in Expo, is the problem that Expo is lagging behind on Android SDK maybe? |
Any news here? Facing the same error. |
It is also appear on Android version 10 (real device Samsung A7). React native version 0.64.2 Previously, the TextInput shows: "This is a tex...". But now, the placeholder has multiple lines, which break the App's UI |
I am also having this issue. Any updates here? |
anything update? |
Hi, I'm also running into this issue. Any updates on this by chance? I don't know if it helps others in the meantime, but I found by forcing the minWidth of the input to be large than to contentSize of the placeholder. For me, that ended up '95%' of the container width (to account for padding). It was not the most ideal solution, but it was the simplest trying to resolve it until this was actually addressed. |
i'm also running into this issue. did anyone find a good solution? |
Adding a |
anything update? |
? |
same here |
Thanks THIS WORKED FOR ME |
Description
When component start, works fine. After change value from
<TextInput />
and delete it, the placeholder appears, passes 1 second and it break line.React Native version:
Steps To Reproduce
Expected Results
Placeholder not break line after disappear
Snack, code example, screenshot, or link to a repository:
https://snack.expo.io/z7tbAWsYc
The text was updated successfully, but these errors were encountered: