score:1
You can just add
onTransitionStart: () => Keyboard.dismiss(),
at your stacknavigator definition and don't need to modify each backbutton.
For example:
const mainScreen = createStackNavigator(
{
MainScreen: {
screen: MainScreen,
}
},
{
onTransitionStart: () => Keyboard.dismiss(),
initialRouteName: 'MainScreen'
}
);
score:2
While defining the StackNavigator try to pass in this option:
const StackNavigatorConfig = {
navigationOptions: {
header: ({ goBack }) => {
const goBackAndDismissKeyboard = (ev) => {
Keyboard.dismiss()
return goBack(ev)
}
return { left: <Left onPress={goBackAndDismissKeyboard} />}
},
}
}
StackNavigator(RouteConfigs, StackNavigatorConfig)
Source: stackoverflow.com
Related Query
- How do I listen to keyboard input in React Native
- React Native - Disable Password AutoFill Option on iOS Keyboard
- Keyboard dismisses while typing TextInput in nested functional component React Native
- i need to give two clicks when the keyboard is open -- React native
- Update scrollview when keyboard is open with React Native
- Delay in keyboard dismiss react-native
- Keyboard changes all components placement in react native
- Input in react native gifted chat is covered by keyboard
- React Native - make image size not change when keyboard is open?
- React <input>: Dismiss soft keyboard on enter
- React Native Gifted Chat on Expo on Android input is covered by keyboard
- What is the difference between React Native and React?
- Error Running React Native App From Terminal (iOS)
- React native text going off my screen, refusing to wrap. What to do?
- Get current scroll position of ScrollView in React Native
- React Native Responsive Font Size
- Make view 80% width of parent in React Native
- Image resizing in React Native
- React Native on Android failed to find Build Tools
- Simulate display: inline in React Native
- React Native Error - yarn' is not recognized as an internal or external command
- Can React Native apps be tested in a browser?
- Hiding the status bar with React Native
- How to detect when a React Native app is closed (not suspended)?
- What folders should be git ignored in React Native project?
- How do I exit/shut down a React Native app?
- New React Native project with old version of react native
- How do you make the ListHeaderComponent of a React Native FlatList sticky?
- Transparent overlay in React Native
- Why does React Native not offer a justify-self
More Query from same tag
- How to handle invalid ID in react-router route in a redux app?
- How to check canvas has loaded?
- Blank page on login/logout with history.push in React Router Dom
- react-slick without sliding effect
- `getByRole` can't find the name of the appropriate textbox
- The 'this.props.history.push()' is working for normal page but not working for nested components?
- How to export state in useState hook and use it in other components
- how to pass parameter value in useEffect by function
- React API Fetch resolve promise
- Calling one action from another action creator
- Adding React-Window to Material-UI Enhanced Table: type is invalid -- expected a string or a class/function but got: array
- How to increase the vertical spacing between a Material UI FormLabel and Slider?
- Set Hook in React Native
- Redux saga event channel is terminated after another saga is executed
- Animation is not applied when hovering sidebar
- How do access Redux state in react-router ProtectedRoute?
- React: setInterval Not working after one interval
- How do i divide code into separate files?
- Trying to populate BootstrapTable with the data from the API
- How to enable https for webpack-dev-server with own certificate?
- How to design Redux stores and actions?
- CSS transitions in React not working when state becomes true
- Facing some issue when trying to delete object from array - mongodb
- Reactjs: How to put HTML into primaryText of a list item?
- Javascrip default parameter ReferenceError: param is not defined
- Can we put an edit text in react-moveable? (Drag and edit both)
- Is there a way I can pass a property between components, without using the props object?
- React, setstate does not activate inside useEffect function for one variable, works for another
- How to fire a click event in a ul, li or div in reactjs
- Put the `response.data` value into the `setState[]` array