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.

[BUG][PLEASE HELP]Incorrect height of InputToolBar when first rendering messages

See original GitHub issue

Issue Description

Incorrect height of InputToolBar when first rendering messages. It’s more like screen flickering when open the page. But I found that it is the wrong height of inputTollBar.

if I set:

textInputProps={{
                        onLayout:(event)=>console.log(event.nativeEvent.layout)
                    }}

The output is:

{y: 6, width: 365, x: 10, height: 33}
{y: 6, width: 365, x: 10, height: 200}
{y: 6, width: 365, x: 10, height: 33}

You can tell there is magnificent layout change happened.

Therefore I did more test. I set a textInput multiline=false, and then I set a timer when textInput onLayout got called to set its multiline to be true. No matter how long I set to setTimeout, the textInput will flicker as soon as multiline = true.

multiline: !this.state.viewLoading,
onLayout:(event)=> {
       console.log(event.nativeEvent.layout)
        let timer = setTimeout(()=>this.setState({viewLoading:false},()=>console.log('viewLoading', this.state)),10000);
}

Steps to Reproduce / Code Snippets

 componentWillMount() {
        for(let i=0; i<staticMessages.length ; i++){
            this.setState(previousState => ({
                messages: GiftedChat.append(previousState.messages, staticMessages[i]),
            }))
        }
    }

Expected Results

No Flickering when opening the screen

Additional Information

giftedchat

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:4
  • Comments:9

github_iconTop GitHub Comments

1reaction
uncledentcommented, Apr 22, 2018

Yeah, this bug is annoying, I have a temporary workaround for that. Add this:

<GiftedChat
onLayout={() => {this.setState({ viewLoading: }}
textInputProps={{ multiline: !this.state.viewLoading}}
/>

So you just disable multiline until component layout loading.

0reactions
kevinsciencecommented, Apr 29, 2018

This is really a great repo. It has 5.1K stars. But am I the only one who is experiencing this bug? And no one care about this unbearable issue? At least please tell me how to get around for it. I checked the src code. In Composer.js, onContentSizeChange(e) will be called at the start of rendering with wrong contentSize.height. contentSize {width: 0, height: 240}

Read more comments on GitHub >

github_iconTop Results From Across the Web

No results found

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