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

Horizontal KeyboardAwareFlatList scrolls vertically after keyboard show/dismiss #468

Open bpmct opened 3 years ago

bpmct commented 3 years ago

I have a KeyboardAwareFlatList that would scrolls vertically when dragged between buttons. After adding bounces={false} and directionalLockEnabled={true}, I managed to fix it until the keyboard is opened and closed again. Do I need keyboard event handlers? How can I fix this?

KeyboardAwareFlatList Bug

<KeyboardAwareFlatList
    data={...}
    keyboardShouldPersistTaps="handled"
    renderItem={({ item }) => (
    <SelectButton
        item={item}
        onPress={() => {
        if (this.state.selectionMode == "hashtag")
            this.addInterest(item);
        else if (this.state.selectionMode == "at-mention")
            this.addFriend(item);
        else console.error("invalid selectionMode");
        }}
    />
    )}
    style={{ width: "50%" }}
    keyExtractor={(item) => item.id}
    horizontal={true}
    bounces={false}
    directionalLockEnabled={true}
/>