benevbright/react-navigation-collapsible

Getting "Warning: Cannot update a component from inside the function body of a different component." after upgrading to react v.16.13.1

Closed this issue ยท 5 comments

Information

  • react-native version: 0.63.2
  • react-navigation version: 5.4.2
  • react-navigation-collapsible version: 5.6.1
  • Platform (iOS/Android): iOS
  • react-native init or Expo: react-native init

Detail

I get error "Warning: Cannot update a component from inside the function body of a different component." when calling createCollapsibleStackSub() inside <FEStack.Navigator />

Screenshot 2020-07-29 at 17 07 08

my code:
function TabsScreen({ navigation }) { return ( <FEStack.Navigator> { createCollapsibleStackSub( <FEStack.Screen name={sceneKeys.myScreen} component={MyScreen} />) } </FEStack.Navigator> ); }

Notice, that error disappear when I remov createCollapsibleStackSub()

Might be related to facebook/react#18178 and

@Aquile Hi, thanks for your issue.
My first assumption after looking at the error message and the linked issue in react is that this library could have been built in the wrong way and it may not be very easy to resolve.
I'll take a look when I get a chance.

Hi,
Same for me using createCollapsibleStack(...).
When I remove it, the warning desappears.
Any chance to get a look on it ?

Thanks

I'm moving the core logic to hooks to resolve it. It may take time.

Your reviews would be appreciated. Thanks!
#155 (WIP)

Great idea !
I will review you PR and share feedback.