react-native-keyboard-aware-scroll-view icon indicating copy to clipboard operation
react-native-keyboard-aware-scroll-view copied to clipboard

Tap to dismiss keyboard

Open KrisLau opened this issue 3 years ago • 2 comments

I have a KeyboardAwareScrollView surrounding some text inputs. When I click away from a text input, I'm hoping to dismiss the keyboard so I set keyboardShouldPersistTaps={'handled'} but it doesn't seem to dismiss the keyboard

KrisLau avatar Oct 05 '21 14:10 KrisLau

Use TouchableWithoutFeedback to wrap around your KeyboardAwareScrollView and onPress of TouchableWithoutFeedback add onPress={Keyboard.dismiss} and accessbile={false}

Note: Keyboard, TouchableWithoutFeedback needs to be imported from react-native.

Example:

<TouchableWithoutFeedback onPress={Keyboard.dismiss} accessible={false}>
    <KeyboardAwareScrollView>
        {your code}
    </KeyboardAwareScrollView>
</TouchableWithoutFeedback>

sikandarchishty avatar May 08 '22 23:05 sikandarchishty

@sikandarchishty That works but I feel like that dismissing the keyboard when tapping away should be the default behaviour

KrisLau avatar Jun 21 '22 21:06 KrisLau