react-native-ui-kitten icon indicating copy to clipboard operation
react-native-ui-kitten copied to clipboard

Modal issue. UseContext inside modal not working.

Open sergeushenecz opened this issue 3 years ago • 4 comments

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

sergeushenecz avatar Feb 08 '22 17:02 sergeushenecz

Hey @sergeu90

What kind of Modal are you trying to use? Because there are plenty of libraries for that 😄

flexbox avatar May 12 '22 15:05 flexbox

Modal from react ui kitten

sergeushenecz avatar May 12 '22 15:05 sergeushenecz

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.

Nixxen avatar May 18 '22 16:05 Nixxen

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.

Joeao avatar Sep 16 '22 18:09 Joeao

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>

adrihegg avatar Sep 30 '22 12:09 adrihegg

Any progress in this ? Are there any workarounds ?

junaedsiam avatar Oct 30 '22 08:10 junaedsiam

@junaedsiam Does not seem like there are any workarounds. I ended up making my own modal with react native modal and expo blur.

adrihegg avatar Oct 31 '22 11:10 adrihegg

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.

greenfrvr avatar Dec 06 '22 15:12 greenfrvr

closing issue for now. feel free to reopen if issue appears in next release

greenfrvr avatar Dec 08 '22 12:12 greenfrvr

Continuing to see this exact issue on @ui-kitten/[email protected]

jarredkenny avatar Apr 12 '23 11:04 jarredkenny

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?

saadnvd1 avatar Sep 28 '23 14:09 saadnvd1

Was presumably fixed in 5.3.0 https://github.com/akveo/react-native-ui-kitten/commit/c19ae7b

Joeao avatar Sep 29 '23 07:09 Joeao

Was presumably fixed in 5.3.0 c19ae7b

looks like updating did fix it, thank you!

saadnvd1 avatar Sep 30 '23 14:09 saadnvd1