question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Adjust modal size and native-stack onDismissed

See original GitHub issue

I use this package with react-navigation V5.

I suggest to add an option to customize the height of the modal screen.

Besides, I currently use this code to popToTop:

    const unsubscribe = navigation.addListener('dismiss', () => {
      navigation.popToTop();
    });

    return unsubscribe;
  }, [navigation]);

When I swipe down to dismiss the modal, it won’t directly popToTop.

I know that this package has a onDismissed prop and I want it to execute navigation.popToTop();.

However, I can’t find a way to implement this with createNativeStackNavigator() and errors occur.

Screenshot 2020-08-01 at 1 18 49 AM

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:9 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
WoLewickicommented, Aug 7, 2020

Because the native-stack does not have such prop. It is a property of a Screen component and is used by native-stack to trigger navigation actions of dismissing a screen and emitting navigation event ‘dismiss’. https://github.com/software-mansion/react-native-screens/blob/master/src/native-stack/views/NativeStackView.tsx#L96 you can see that it calls ‘pop’ action. If you want your own action there, you could overwrite this behavior for e.g. stackPresentation: 'modal'.

0reactions
WoLewickicommented, Aug 7, 2020

This behavior won’t be changed to what you would want because it would result in every dismiss to pop the whole stack, which does not make sense in most cases.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Set width and height to React-native modal
According to the Modal documentation, there is no style prop to be set. You can try setting the <View> dimensions inside the <Modal>...
Read more >
Opening a modal
To change the type of transition on a stack navigator you can use the presentation option. When set to modal , all modal...
Read more >
Modal
The onDismiss prop allows passing a function that will be called once the modal has been dismissed. Type. function. onOrientationChange. iOS. ​.
Read more >
Modal
Modal | NativeBase | Universal Components for React and React Native ; isOpen. If true, the modal will open. Useful for controllable state...
Read more >
Modal · Bootstrap
Modals are built with HTML, CSS, and JavaScript. They're positioned over everything else in the document and remove scroll from the <body> so...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found