I create Header and Gifted Chat in React Native.
return (
<View style={{ flex: 1, backgroundColor: '#fff' }}>
<StatusBar
backgroundColor="#4A43EC"
barStyle="light-content"
/>
{/* Header */}
<KeyboardAvoidingView >
<View style={{ flexDirection: 'row', justifyContent: 'space-between', alignItems: 'center', width: '100%', paddingVertical: 16, backgroundColor: '#4A43EC',}}>
<View style={{ flexDirection: 'row', alignItems: 'center', marginLeft: 24, }}>
<TouchableOpacity
onPress={() => navigation.goBack()}>
<Image
style={{ height: 22, width: 22, marginRight: 13 }}
source={require("../Assets/Icons/EventDetailsLeftArrow.png")}
/>
</TouchableOpacity>
<Text style={{ color: '#fff', fontSize: 24, fontWeight: '400', }}>{item.name} Id: {item.id}</Text>
</View>
</View>
</KeyboardAvoidingView>
{/* Body */}
<View style={{ flex: 1 }}>
<GiftedChat
messages={messages}
onSend={messages => onSend(messages)}
user={{
_id: rid,
}}
alwaysShowSend
renderBubble={renderBubble}
// renderSend={renderSend}
/>
</View>
</View>
)
When I open Keyboard for typing, the Header hide.
I don't want this, I want that header to be always show while typing.
It behaves in this manner because your header is wrapped in KeyboardAvoidingView remove it and it will work normally.
Your chat component should be wrapped in KeyboardAvoidingView.