Sat*_*lam 11 react-native react-native-text
使用React native 0.26,
我的组件是这样的
const Search = () => {
return (
<View style={styles.backgroundImage}>
<TextInput style={styles.textInput} onChangeText={(text) => console.log(text)} placeholder={"Enter Search Term"}/>
</View>
)
}
Run Code Online (Sandbox Code Playgroud)
我的风格:
const styles = StyleSheet.create({
backgroundImage: {
flex : 1,
flexDirection: "column",
justifyContent: 'center',
alignItems: 'center'
},
textInput: {
justifyContent: "center",
alignItems: "stretch",
borderRightWidth: 30,
borderLeftWidth: 30,
height: 50,
borderColor: "#FFFFFF",
}
})
Run Code Online (Sandbox Code Playgroud)
我面临的问题是
returnKeyType并查看键盘的外观(并且有一些代码onSubmitEditing和测试).Nad*_*bit 25
1除非启用多行,否则无法直接在TextInput上声明特定边框(例如,borderLeftWidth除非multiline={true}已启用但不起作用,否则将无法borderWidth工作),但您可以将TextInput包装在视图中并为其指定边框.
inputContainer: {
borderLeftWidth: 4,
borderRightWidth: 4,
height: 70
},
input: {
height: 70,
backgroundColor: '#ffffff',
paddingLeft: 15,
paddingRight: 15
}
Run Code Online (Sandbox Code Playgroud)
2您需要backgroundColor为TextInput 声明一个.
3要显示本机键盘,您需要转到模拟器菜单并断开硬件连接.转到硬件 - >键盘 - >连接硬件键盘,将其关闭.
至于react-native: 0.61.5你可以直接设置borderBottomWidthon TextInput。像下面的内联样式,或者如果你想要单独的样式对象。
Run Code Online (Sandbox Code Playgroud)style = {{borderBottomWidth : 1.0}}
| 归档时间: |
|
| 查看次数: |
34006 次 |
| 最近记录: |