instea / react-native-popup-menu

Popup menu component for React Native
ISC License
1.48k stars 250 forks source link

popup menu in conjunction with react-native-navigation produces warnings #272

Closed sparlampe closed 1 year ago

sparlampe commented 1 year ago

Our application uses both react-native-navigation and react-native-popup-menu. React native navigation documentation describes the following integration with context providers. In our setup we have several bottom tabs, each bottom tab screen is wrapped in a MenuProvider.

This configuration produces the warning below.

In most cases you should not have more MenuProviders in your app (see API documentation). In other cases use skipInstanceCheck prop.

Neither examples nor the documentation shed light on this use case. I am not sure if this is bug or incorrect integration on our part.

sodik82 commented 1 year ago

hi there...

not 100% sure but from the linked documentation it looks to me that each screen has to have its own context providers as RNN seems to manage screens from native code and I don't see a way for to wrap "whole RNN" with our context (only once)

So I think you are "the other case" when you want/need to have multiple MenuProviders - thus simply use skipInstanceCheck to suppress the warning as you probably know what are you doing.... (so probably this is the second know exception to the rule as described here https://github.com/instea/react-native-popup-menu/blob/master/doc/api.md#menuprovider )

This warning is there to prevent pretty common error from inexperience persons as the incorrect placement of MenuProvider can lead to malformed functionality (mostly wrong positioning).

sparlampe commented 1 year ago

Thank you very much. We have configured to skip checking the instance. If there is an incorrect placement, we will know where to look first.