I would like to know if there is a way to show keyboard always if it focuses out from the TextInput in react native.
You can wrap your TextInput by a ScrollView and then use the keyboardShouldPersistTaps='handled' prop in ScrollView to avoid dismissing the keyboard and handle the keyboard dismiss by using Keyboard.dismiss() function in somewhere else.
Read this for more documentation.
Related
I have built a FormInput component in react native by extending the textInput component. In the input container I have put a pressable x icon, so the user can clear the input. The problem is that when I put my form inside a scrollView, the pressable icon does not function. The same behavior takes place when I use a pressable icon to hide/view the password in the password input field. What is happening and what can I do to fix this?
I am working on React Native in which I want to stop multiline textinput component's scroll inside ScrollView. How we can achieve it? Android Specially!
you can use textinput option scrollEnabled
but this option only use ios, not work android
scrollEnabled={false}
So I recommend that you set the height and specify the maxLength of letters to prevent scrolling from being seen.
example
style={{height : 0000}}
maxLength={0000}
I'm using rmc-tabs for tab component in React Native.
I'm using video component and want to pause the video when I move to other tab, but I don't know how to do this.
How can I get the blur event in rmc-tabs or are there any other ways to handle blur event in React Native video or view?
if you are using createTabNavigator or createBottomTabNavigator you can use NavigationEvents within the screens inside TabNavigator which allow you to listen to
onWillFocus : before focusing a tab;
onDidFocus : after focusing a tab;
onWillBlur : before losing focus on a tab;
onDidBlur : after losing focus on a tab;
If I have data in a ScrollView, FlatList, or SectionList, and that data includes a button that the user can press on, tapping on the button once hides the Keyboard as expected:
onScroll={() => Keyboard.dismiss()}
but it does not trigger the button callback. It only works if you tap the same button a second time after the keyboard is hidden. Is there any way to fix this?
I figured out the answer from the docs, setting keyboardShouldPersistTaps="always"
So i am adding the final touches to my application, and one bug that has been present for a while is when they keyboard is active, i am able to use the navigation on the upper half of the screen with the keyboard still showing
Is there a simple way to dismiss all other touches on the upper half of the screen when the keyboard is active? If you could point me in the right direction that would be great.
Looking for something similar to this: When keyboard active then touch screen anywhere, close keyboard
EDIT: would be nice if the textInput that the keyboard is outputting to was still touchable
If the parent view of the TextInput is a ScrollView, then u can use the prop 'keyboardShouldPersistTaps',
<ScrollView keyboardShouldPersistTaps='handled' />
If you're using a View and dont want scrolling, then probably u can wrap it inside a
//This should disable scroll
<ScrollView scrollEnabled={false} >
Documentation for keyboardShouldPersistTaps (React Native website)
keyboardShouldPersistTaps?: enum('always', 'never', 'handled', false,
true) #
Determines when the keyboard should stay visible after a tap.
'never' (the default), tapping outside of the focused text input when
the keyboard is up dismisses the keyboard. When this happens, children
won't receive the tap. 'always', the keyboard will not dismiss
automatically, and the scroll view will not catch taps, but children
of the scroll view can catch taps. 'handled', the keyboard will not
dismiss automatically when the tap was handled by a children, (or
captured by an ancestor). false, deprecated, use 'never' instead true,
deprecated, use 'always' instead