[BUG][PLEASE HELP]Incorrect height of InputToolBar when first rendering messages
See original GitHub issueIssue 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
- React version: “16.3.0-alpha.1”
- React Native version: “https://github.com/expo/react-native/archive/sdk-26.0.0.tar.gz”
- react-native-gifted-chat version: “^0.4.3”
- Platform(s) (iOS, Android, or both?): iOS, haven’t tried on Android
Issue Analytics
- State:
- Created 5 years ago
- Reactions:4
- Comments:9
Top Results From Across the Web
No results found
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 Free
Top 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
Yeah, this bug is annoying, I have a temporary workaround for that. Add this:
So you just disable multiline until component layout loading.
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}