react-native-ui-kitten
react-native-ui-kitten copied to clipboard
Modal issue. UseContext inside modal not working.
Hi all. Thanks for the library.
🐛 Bug Report
For example
<Modal>
<TestComponent />
</Modal>
If we inside TestComponent will use useContext then we have issue.
I think it is general problem implementation modal.
Could you help me. How can i use context inside moda?
UI Kitten and Eva version
Package | Version |
---|---|
@eva-design/eva | 2.1.1 |
@ui-kitten/components | 5.1.1 |
Hey @sergeu90
What kind of Modal
are you trying to use?
Because there are plenty of libraries for that 😄
Modal from react ui kitten
Can confirm this is an issue.
Had a logout component that consumed a useContext within a standard react native modal. This was working fine. Replaced the modal with a UI kitten modal during a cleanup, and the logout component lost access to the useContext. It defaults to an empty context. The component that contains the modal itself can still access the useContext data.
Also the case with a Popover component. The content of a context is not accessible in a child component, the result is similar to if a context provider hadn't been initialised.
I have the same issue, i cant use components with useSelector inside the UI Kitten modal.
I get the error: 'could not find react-redux context value; please ensure the component is wrapped in a <Provider>
Any progress in this ? Are there any workarounds ?
@junaedsiam Does not seem like there are any workarounds. I ended up making my own modal with react native modal and expo blur.
We've updated modals implementation recently with React Native modals, the issue should be fixed in the next release. Still checking, but after a quick look it seems the issue won't appear after #1615. Sorry for waiting. We will try to deliver this as soon as we're ready with new release.
closing issue for now. feel free to reopen if issue appears in next release
Continuing to see this exact issue on @ui-kitten/[email protected]
We're also seeing this issue with Redux as well on @ui-kitten/[email protected]
:
Error: could not find react-redux context value; please ensure the component is wrapped in a <Provider>
Any ideas?
Was presumably fixed in 5.3.0 https://github.com/akveo/react-native-ui-kitten/commit/c19ae7b