2
我試圖基本上創建一個搜索輸入字段,旁邊有一個取消按鈕,但TextInput不顯示和格式化被打破。我如何使用Shoutem/UI連接一個按鈕來設置TextInput的反應本機
我用們ShoutEm UI工具包https://shoutem.github.io/docs/ui-toolkit/components/text-input
如何設置的樣式,以使輸入框中顯示正確?我看不到輸入框,並且按鈕邊距看起來不對。
我應該使用一排,而不是一個視圖?然而,使用行似乎也不能很好地工作。
有沒有人有一個使用shoutem UI輸入旁邊的按鈕形式的例子?
<View styleName="horizontal space-between wrap">
<TextInput
placeholder="Search"
autoFocus={ true }
returnKeyType="search"
clearButtonMode="while-editing"
/>
<Button styleName="right-icon" onPress={() => {
this.setModalVisible(!this.state.modalVisible)
}}>
<Text>Cancel</Text>
</Button>
</View>
我試圖切換到普通的TextInput而非shoutemUI文字輸入和我說這種風格,但我如何才能寬度自動伸展?如何修復按鈕上的填充?
代碼
<View styleName="horizontal" style={ StyleSheet.flatten(styles.searchRow)}>
<TextInput
placeholder="Search"
autoFocus={ true }
returnKeyType="search"
clearButtonMode="while-editing"
style={ StyleSheet.flatten(styles.searchBox) }
/>
<Button styleName="right-icon" style={{padding: 5, margin:5}} onPress={() => {
this.setModalVisible(!this.state.modalVisible)
}}>
<Text>Cancel</Text>
</Button>
</View>
和風格
searchBox: {
borderWidth: 0.5,
padding: 5,
margin: 5,
paddingLeft:10,
width: 200,
alignSelf: 'stretch',
height:40,
backgroundColor: 'white',
borderColor: '#d3d3d3',
},