magicismight / react-native-root-siblings

A sibling elements manager.
MIT License
706 stars 134 forks source link

AppRegistry.setWrapperComponentProvider gets overridden #43

Closed Bartozzz closed 5 years ago

Bartozzz commented 5 years ago

Problem

If react-native-root-siblings gets loaded multiple times (i.e. is required by multiple libraries), each instance will override previous AppRegistry.setWrapperComponentProvider calls.

Because of that, only one <RootSiblings /> element will be rendered in the application. It prevents the render of <RootSiblings /> required by other libraries.

I believe this can actually happen in other basic scenarios, for example when an application simply needs to provide its own AppRegistry.setWrapperComponentProvider. It will prevent all the siblings from displaying at all.

Potential solution

A potential solution would be to store the siblings in some sort of global storage across React-Native and ensuring the <RootSiblings /> gets rendered forcing the developers to manually rendering it in the entrypoint (for example App.js).

Related issues

Related issues found so far (besides the one we are experiencing at our company):

sunnylqm commented 5 years ago

Thanks for reminding. Should be fixed in https://github.com/magicismight/react-native-root-siblings/commit/3aff9e68740f8359057297b103fbd48556b1addb . Please reinstall to see if it works.

Bartozzz commented 5 years ago

Updated packages and it everything works correctly so far.