How to close UI Kitten modal on back button press in android? - react-native

I am using modal for React Native UI kitten.
But the problem is I did't find anything like onRequestClose prop like the React Native provides for the modal. Nothing mentioned on their API also.
So is there anything like I can close the modal on back button press?

I suggest react-native-modal which is easy to use and customize https://github.com/react-native-modal/react-native-modal

Related

React navigation modals on react native web - Prevent url path update

I have a react native app that we are implementing the react native web version using: React native web, the app uses the latests react native navigation library.
So far, mostly everything is working except for modals, the problem that i have is that when i open a modal, the URL path on web updates (I.E: from /signup if i open a modal it switch to /legalAgreementModal?QUERY_PARAMS....), so if i refresh the page the modal works but i can't close the modal anymore. I thought about adding a conditional on the modal to goBack if there is anything to go back to, but the problem is that i have too many modals that can go back to different screens so it will be a huge change if i have to add that logic to every modal.
My question is, is there a way to avoid modals to update my path? So if user refresh they lost the modal but they are on the original screen? Perhaps another workaround that you guys may know could help also!.
Thanks!
I tried adding a conditional on modal close action, adding empty string as the modal path.

Is there a way to grab the keyboard search/return input in react-native-paper SearchBar?

I am working on a react native android app that needs a search bar. I am using the SearchBar from react-native-paper, and I checked their documentation and couldn't find any sort of way to find if the user pressed the little search button on their keyboard.
Not sure if there is an official name for this input or the button itself as I am unfamiliar with mobile app development, but here is an screenshot from the app in case it is unclear. I am referring to the search button on the keyboard itself, which is in this case blue.
From some digging I found out that TextInputs in react native have an onSubmitEditing={} that triggers whatever return key action you want.
Essentially I was wondering if there was an equivalent prop for the SearchBar in react-native-paper.
If you take a look at the implementation of react-native-paper SearchBar https://github.com/callstack/react-native-paper/blob/master/src/components/Searchbar.tsx it looks like you can pass a onSubmitEditing prop to it and, as react-native-paper uses a TextInput, that input will receive that prop
Ok so it seems that as tintef pointed out, you can just pass onSubmitEditing to the SearchBar since it uses a TextInput. I just tested this and it works perfectly!

How to open a view top of a another view on the button click in react native?

How to open a view top of a another view on the button click in react native? I tried use redux but i didn't find the right way to do it.
You mean "How to open a popup type screen on a button click"?
If so, then you need to use Modal component.
Here's the link to the docs of modal component -
https://facebook.github.io/react-native/docs/modal

React Native- Persist keyboard when dialog show

My react native version is 0.55.4 , when modal showing keyboard dismiss , how can show modal without dismissing keyboard.
You need a little hack!
For example you can auto focus on a input in your modal (More info)
Or use a custom modal that not related with native keyboard (You can write this yourself or use some package like this)

Picker dialog without Picker Component in React Native

Can I use only dialog from Picker without rendering Picker itself in React Native 0.48? I want to open Picker's list on button click. There's an obvious way creating a hidden Picker and rerouting clicks to it, but is it the only solution?
You can use this: https://docs.nativebase.io/Components.html#actionsheet-def-headref
native base provide ui kit for react native. You look actionSheet section.