使用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>
)
}
还有我的风格:
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",
}
})
我面临的问题是
- 边框右宽度和左宽度似乎没有任何效果,占位符文本仅从左边缘开始.
- TextInput的背景为"灰色",与视图的背景相同.我本以为它默认为白色(感觉透明).
- 有了iOS模拟器如何打开键盘,我想设置
returnKeyType
,看看键盘是什么样子(还有onSubmitEditing
和test上的一些代码).
截图如下: