question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Update bottomOffset dynamically?

See original GitHub issue

Hi 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:closed
  • Created 7 years ago
  • Comments:11

github_iconTop GitHub Comments

2reactions
jnrepocommented, Jun 15, 2017

Having the same issue here. Methods tried:

  1. Adjust height of 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)
  2. Tried tweaking minInputToolbarHeight and bottomOffset (code gets very verbose for a simple feature)

Is there a simpler way to do this?

1reaction
patrinouacommented, Aug 5, 2020

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

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found