Taehyung
Taehyung

Reputation: 53

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

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?

Upvotes: 0

Views: 1652

Answers (1)

Jagroop
Jagroop

Reputation: 2064

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()

Upvotes: 2

Related Questions