Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Maximum call stack exceeded when closing drawer #2542

Closed
bsiddiqui opened this issue Oct 24, 2017 · 11 comments
Closed

Maximum call stack exceeded when closing drawer #2542

bsiddiqui opened this issue Oct 24, 2017 · 11 comments

Comments

@bsiddiqui
Copy link

Version

Tell us which versions you are using:

  • react-native-router-flux v4.0.0-beta.22
  • react-native v0.49.3

Issue

Whenever I close an open drawer I get this error

Possible Unhandled Promise Rejection (id: 2):
RangeError: Maximum call stack size exceeded
RangeError: Maximum call stack size exceeded
    at extendObservableHelper (http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false:66411:32)
    at extendObservable (http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false:66402:12)
    at Function.IObservableFactories.object (http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false:66491:9)
    at deepEnhancer (http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false:66567:45)
    at new ObservableValue (http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false:65571:23)
    at defineObservableProperty (http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false:66269:45)
    at defineObservablePropertyFromDescriptor (http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false:66251:13)
    at extendObservableHelper (http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false:66429:17)
    at extendObservable (http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false:66402:12)
    at Function.IObservableFactories.object (http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false:66491:9)
    at deepEnhancer (http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false:66567:45)
    at new ObservableValue (http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false:65571:23)
    at defineObservableProperty (http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false:66269:45)
    at defineObservablePropertyFromDescriptor (http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false:66251:13)
    at extendObservableHelper (http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false:66429:17)
    at extendObservable (http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false:66402:12)
    at Function.IObservableFactories.object (http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false:66491:9)
    at deepEnhancer (http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false:66567:45)
    at new ObservableValue (http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false:65571:23)
    at defineObservableProperty (http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false:66269:45)
    at defineObservablePropertyFromDescriptor (http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false:66251:13)
    at extendObservableHelper (http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false:66429:17)
    at extendObservable (http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false:66402:12)
    at Function.IObservableFactories.object (http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false:66491:9)
    at deepEnhancer (http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false:66567:45)
    at new ObservableValue (http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false:65571:23)
    at defineObservableProperty (http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false:66269:45)
    at defineObservablePropertyFromDescriptor (http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false:66251:13)
    at extendObservableHelper (http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false:66429:17)
    at extendObservable (http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false:66402:12)
    at Function.IObservableFactories.object (http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false:66491:9)
    at deepEnhancer (http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false:66567:45)
    at new ObservableValue (http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false:65571:23)
    at defineObservableProperty (http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false:66269:45)
    at defineObservablePropertyFromDescriptor (http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false:66251:13)
    at extendObservableHelper (http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false:66429:17)
    at extendObservable (http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false:66402:12)
    at Function.IObservableFactories.object (http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false:66491:9)
    at deepEnhancer (http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false:66567:45)
    at new ObservableValue (http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false:65571:23)
    at defineObservableProperty (http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false:66269:45)
    at defineObservablePropertyFromDescriptor (http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false:66251:13)
    at extendObservableHelper (http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false:66429:17)
    at extendObservable (http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false:66402:12)
    at Function.IObservableFactories.object (http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false:66491:9)
    at deepEnhancer (http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false:66567:45)
    at new ObservableValue (http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false:65571:23)
    at defineObservableProperty (http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false:66269:45)
    at defineObservablePropertyFromDescriptor (http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false:66251:13)
    at extendObservableHelper (http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false:66429:17)
@daviscabral
Copy link
Collaborator

Could you show some code from your router? Or put it in the Example folder to reproduce it?

@bsiddiqui
Copy link
Author

bsiddiqui commented Oct 26, 2017

@daviscabral here's some sample code from my router. Everything seems to function correctly but I see the warning whenever the drawer is closed and I return to the view that opened the drawer.

  <Router>
    <Stack key="root">
      <Scene initial key='launch' type='reset' component={LaunchImageContainer} />
      <Drawer hideNavBar
              key='drawer'
              drawerIcon={<MenuButton />}
              contentComponent={DrawerContainer} >
            <Scene
                title='Settings'
                key='usersSettings'
                component={UsersSettingsContainer} />

            <Scene
                title='Promotions'
                key='promotions'
                component={PromotionsContainer} />
      </Drawer>
    </Stack>
  </Router>

@daviscabral
Copy link
Collaborator

@bsiddiqui why the drawer parent is a Scene and not a Stack? Do you have more than one drawer?

@bsiddiqui
Copy link
Author

@daviscabral the Drawer parent is a Stack - I just had the indentation wrong

@daviscabral
Copy link
Collaborator

Sorry - my bad.

@daviscabral
Copy link
Collaborator

Could you check if inside the DrawerContainer is there any reference to the Drawer component?

@bsiddiqui
Copy link
Author

@daviscabral there's a reference to Actions but not Drawer

@daviscabral
Copy link
Collaborator

Which actions do you trigger over there? Do you have any calls in the willMount/unMount lifecycle methods?

@wluxion
Copy link

wluxion commented Oct 30, 2017

Running into this as well -- started happening when I added a renderLeftButton to a nested Stack (even if I only do this: <Stack key="abc" renderLeftButton={<View />} ...>).

UPDATE: Changing to <Stack key="abc" renderLeftButton={() => <View />} ...> fixed this -- perhaps the same for drawerIcon above?

@daviscabral
Copy link
Collaborator

Thanks for the update @wluxion.

@bsiddiqui can you confirm that this fixes your issue?

      <Drawer hideNavBar
              key='drawer'
              drawerIcon={() => <MenuButton />}
              contentComponent={DrawerContainer} >
      </Drawer>

@bsiddiqui
Copy link
Author

bsiddiqui commented Oct 31, 2017

@wluxion thanks yeah passing all components (contentComponent, renderLeftButton, renderTitle, etc) as fat arrow functions fixed the issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants