Here, I have a View
component inside of which there is a TextInput
and IconButton
adjacent to each other. Where the TextInput
takes the max width available because of flex-grow: 1
.
The problem is when the text inside of TextInput
has more increases to 100% width or more than that the TextInput
gets bigger and shifts the IconButton
outside of screen.
I'm using react-native-paper.
I'm providing two images for reference
<View style={{ width: '100%', flexDirection: 'row', alignItems: 'center', marginVertical: 2 }}>
<TextInput
value={msg.text}
onChangeText={(value) => setMsg({ ...msg, text: value })}
mode='outlined'
placeholder='Message'
outlineStyle={{ borderRadius: 30, borderWidth: 0 }}
style={{ flexGrow: 1, marginBottom: 8 }}
right={<TextInput.Icon icon="camera" />}
/>
<IconButton
icon="send"
mode='contained'
iconColor='white'
containerColor='#167BD1'
size={24}
onPress={() => console.log('Pressed')}
/>
</View>