我已经看到了很多有关如何为TextInput组件的溢出文本添加椭圆的问题,但是无论我对TextInput文本的样式添加什么,似乎总是在溢出文本中添加椭圆。已要求隐藏溢出的文本:
<TextInput
placeholder='0%'
value={this.state.cbc}
onChangeText={(text) => this.setState({ cbc: text })}
style={styles.compoundInput}
>
.
.
.
compoundInput: {
borderWidth: 1,
borderRadius: 10,
height: 40,
padding: 5,
minWidth: 55,
maxWidth: 85,
marginLeft: 10,
fontFamily: 'OpenSans',
fontSize: 14,
justifyContent: 'center',
alignItems: 'center',
}
.
.
.
有什么方法可以确保隐藏溢出的文本?
答案 0 :(得分:0)
const styles = StyleSheet.create({
gridItem:{
flex:1, //it can get as much space as it can get
margin:15,
height:150,
borderRadius:10,
elevation: 5,
overflow:Platform.OS === 'android' && Platform.Version >=21 ? 'hidden'
: 'visible'
}
我认为您可以使用
溢出:“隐藏”
样式组件中的。或者我想您也可以使用Platform API在特定平台上查看更多内容。
https://facebook.github.io/react-native/docs/platform-specific-code