APSL / react-native-keyboard-aware-scroll-view

A ScrollView component that handles keyboard appearance and automatically scrolls to focused TextInput.
MIT License
5.24k stars 643 forks source link

scoll not working when textInput is multiline #547

Open pranav-flyfin opened 2 years ago

pranav-flyfin commented 2 years ago

The scroll is not enabling when input is multiline. when I am making my inputText field false it is working fine. does anyone have a solution?

dutchkillscreative commented 1 year ago

Not sure if we have the same problem but I'm able to get the <KeyboardAwareFlatList>to scroll the textInput into view when it is in focus however if the text input field grows because it's set to multiline the bottom of my text disappears below the keyboard.

prerakd commented 1 year ago

Setting scrollEnabled={false} for TextInput works for me. Refer this issue for more help.

pranav-flyfin commented 1 year ago

But it will restrict the input to get scroll. So the lines won't be visible to users if he is writting multilines.

prerakd commented 1 year ago

For that you can write your custom AutogrowTextInput which will increase height of textinput on change of textinput layout

pranav-flyfin commented 1 year ago

But still it's not a proper solution.

josaric commented 1 year ago

Try this:


constructor(props) {
    super(props);
    this.state = {
        scrollEnabled: true
    }
}

onFocus() {
    let self = this;
    // disable scroll until the library does its own magic
    this.setState({
        scrollEnabled: false
    });
    // enable scroll again after 1 sec
    setTimeout(function() {
        self.setState({
            scrollEnabled: true
        })
    }, 1000)
}

onBlur() {
        // enable scroll on blur
        this.setState({
            scrollEnabled: true
        })
    }

<TextInput 
scrollEnabled={this.state.scrollEnabled}
onFocus={()=> this.onFocus()}
onBlur={()=> this.onBlur()}
multiline=true
 />
Ziamuhyuddin commented 1 year ago

Setting scrollEnabled={false} for TextInput works for me. Refer this issue for more help.

this work for me :)

TingC92233 commented 7 months ago

scrollEnabled={false

It doesn't work for me😭 ,Do the other heroes have any other solutions?help!!!