Home > Blockchain >  I want that my keyboard don't or i want to dismiss it in react-native?
I want that my keyboard don't or i want to dismiss it in react-native?

Time:04-18

Actually , i am using too many Views , Text TextInput of width 100% due to this even i scroll it automatically touch to the TextInput and due to this i am not able to scroll to the screen . Is there any solution for this?

CodePudding user response:

Okay , so try to give margin to left and right so that you can scroll . Also you can apply below solution as well :

<ScrollView contentContainerStyle={{flexGrow: 1}}
keyboardShouldPersistTaps='handled' //<-
   >
<TextInput keyboardType='numeric'/>
</ScrollView>

OR

import {Keyboard} from 'react-native'

<TouchableWithoutFeedback onPress={Keyboard.dismiss} accessible={false}>
<View style={{flex: 1}}>
    <TextInput keyboardType='numeric'/>
</View>
</TouchableWithoutFeedback>

OR

  render() {
<DismissKeyboardView>
    <TextInput keyboardType='numeric'/>
</DismissKeyboardView>
 }

OR

In most of my cases, this solution surely works :

import { Keyboard } from 'react-native'

// Hide that keyboard!
Keyboard.dismiss()

enter code here

  • Related