I'm trying to basically create a search input field with a cancel button next to it but the TextInput doesn't show and the formatting is broken.
I'm using the shoutem ui toolkit https://shoutem.github.io/docs/ui-toolkit/components/text-input
How do I set the styles so that the input box to shows up correctly? I can't see the input box and the button margins seem off.
Should I use a Row instead of a View? However using a row doesn't seem to work well either.
Does anyone have an example of a form with buttons next to inputs using 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>
I tried switching to a plain TextInput rather than a shoutemUI text input and I added this style, but how do I get the width to automatically stretch? How do I fix the padding on the button?
The code
<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>
And The Style
searchBox: {
borderWidth: 0.5,
padding: 5,
margin: 5,
paddingLeft:10,
width: 200,
alignSelf: 'stretch',
height:40,
backgroundColor: 'white',
borderColor: '#d3d3d3',
},