Update bottomOffset dynamically?
See original GitHub issueHi there!
I was trying to change the bottomOffset
dynamically but I notice that while the value for this.state.bottomOffset
changes, GiftedChat
's container’s bottomOffset
doesn’t change.
Here’s a snippet of my code:
renderAccessory() {
return (
<View style={{backgroundColor:"#000000", height: this.state.bufferHeight, width: width}}>
<TouchableOpacity
onPress={() => {
this.setState({showExtra:!this.state.showExtra})
if (this.state.showExtra) {
this.setState({bufferHeight:44})
}
else {
this.setState({bufferHeight:88})
}
}}
>
<Text style={{color:"#ffffff"}}>FUNNY</Text>
</TouchableOpacity>
</View>
)
}
render () {
<GiftedChat
isAnimated={true}
messages={this.state.messages}
onSend={this.onSend}
loadEarlier={true}
isLoadingEarlier={true}
onLoadEarlier={this.onLoadEarlierMessages}
user={{_id: 1, name:'Thor'}}
onChangeText={() => this.state.channel ? this.state.channel.typing() : false}
isLoadingEarlier={this.state.isLoadingEarlierMessages}
renderBubble={this.renderBubble}
renderFooter={this.renderFooter}
bottomOffset={this.state.bufferHeight} // set initially at 44
renderAccessory={this.renderAccessory}
/>
}
What I am trying to do is to increase the height of the view
component generated by renderAccessory()
, and as this happen, i need to shift the GiftedChat
component upwards and hence increasing the bottomOffset
to 88.
While console.log
are printing the values correctly, the borromOffset
does not result in a dynamic change in the height of GiftedChat
Am I missing anything?
Thanks!
Issue Analytics
- State:
- Created 7 years ago
- Comments:11
Top Results From Across the Web
Top and bottom offset in image button not getting updated
I am creating a dynamic image button control. Below is my code. var deleteButton = new ImageButton(context); deleteButton.SetImageResource(Resource.
Read more >Dynamically Update a Drop Down Menu/List - Data Validation ...
Premium Course: https://www.teachexcel.com/premium-courses/68/idiot-proof-forms-in-excel?src=youtubeMore tutorials: https://www.teachexcel.
Read more >offset option • Waypoints - I Make Web Things
This offset function will now stay up to date with the element's height as the browser resizes. This is because resizing the browser...
Read more >Problem with ShiftRelativeTo if create DBMemo dynamically
Hi, I create two DBMemo-Fields dynamically. The first DBMemo looks like ... Problem with ShiftRelativeTo if create DBMemo dynamically ... BottomOffset := 2;...
Read more >BottomOffset Property | Spread Windows Forms 13.0 Product ...
'Declaration Public Property BottomOffset As Double. 'Usage Dim instance As ImageBrush Dim value As Double instance.BottomOffset = value value = instance.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Having the same issue here. Methods tried:
View
that wraps gifted container on when the keyboard is shown (doesn’t work: gifted container will keep the original height; although in the logs its changing)minInputToolbarHeight
andbottomOffset
(code gets very verbose for a simple feature)Is there a simpler way to do this?
This solved it for me <GiftedChat messages={messages} user={{ _id: 1 }} onSend={this.onSend} bottomOffset={Platform.OS === “ios” && 48.5} /> https://github.com/FaridSafi/react-native-gifted-chat/issues/278