react-native-screens
react-native-screens copied to clipboard
presentation="modal" not working on android
Description
Having set presentation="modal"
for a screen has no effect on that screen on Android (still opens full screen view)
<Stack.Screen name="ComponentName" component={Component} options={() => ({
presentation: 'modal'
})} />
Works as expected on iOS.
Steps to reproduce
- Add
presentation="modal"
to a screenoptions
- See that it has no effect on android (still opens the full screen view) - see the snack attached
Snack or a link to a repository
https://snack.expo.dev/gg56CATOS
Screens version
6.6.1
React Native version
0.69.0
Platforms
Android
JavaScript runtime
Hermes
Workflow
React Native (without Expo)
Architecture
Paper (Old Architecture)
Build type
No response
Device
No response
Device model
No response
Acknowledgements
Yes
was facing the same issue. seems like native-stack has some issue with "modal" but 'containedTransparentModal' was working. "modal" works fine if we switch to a normal stack navigator
Yeah it looks like it's just not implemented? 🤔 weird that the documentation says
modal
,containedModal
,fullScreenModal
,formSheet
will useScreen.StackPresentation.MODAL
.
when MODAL
is essentially ignored in the android code.
react-native-screens on main ➜ rg MODAL android
android/src/main/java/com/swmansion/rnscreens/Screen.kt
240: PUSH, MODAL, TRANSPARENT_MODAL
android/src/main/java/com/swmansion/rnscreens/ScreenViewManager.kt
58: Screen.StackPresentation.MODAL
60: Screen.StackPresentation.TRANSPARENT_MODAL
android/src/main/java/com/swmansion/rnscreens/ScreenStack.kt
90: var visibleBottom: ScreenStackFragment? = null // this is only set if newTop has TRANSPARENT_MODAL presentation mode
328: fragment.screen.stackPresentation === Screen.StackPresentation.TRANSPARENT_MODAL
Given that Screen
's are backed by androidx Fragment
s, I expect the fix will be to have modal
screens inherit from DialogFragment.
Also facing the same issue. Do we have a work around for this for android?
I'm facing the same issue. It's not working in android 💯
Is there anyone solved this issue ??
Yes it is not working. Can anyone suggest a workaround?
Hi, sorry for late response!
There is likely no workaround, because as @jaredly reported, indeed Android modal view are effectively not implemented. I recently started looking into it while attempting to implement bottom-sheets for Android -- and unfortunately there are some technical reasons why it is the case and Android modals were left behind. It looks that documentation is indeed misleading, sorry! Once I'll open PR with support for modals & I'll try to remember to link it here so you can track progress.
hey, @kkafar did you find the solution 😛 ?
6 months and the docs still say this presentation works on android and ios. Would appreciate any update :)
Any solution yet?
anything on this?
let's change to use flutter.
I think we should try to use animation API provided by Stack as an alternative to it
use import {createStackNavigator} from "@react-navigation/stack"; instead of import {createNativeStackNavigator} from "@react-navigation/native-stack"; working for both Android and IOS
after upgrading to react navigation V6 this code worked for me:
<Stack.Group screenOptions={{ presentation: 'modal' }}>
<Stack.Screen name="ComponentName" component={Component} options={() => ({
presentation: 'modal'
})} />
</Stack.Group>
Any update on this?
working perfectly
Still not working
Still not working
day 28 of september, Expo Router V2 and SDK 49, and still not working on android
It's been a so long, Tag "Zuck" now. 😬
still not working
add the below in screenOptions : animation:"slide_from_bottom"
I want to make the previous screen appear a little bit in the current screen
I want to make the previous screen appear a little bit in the current screen
I want the same but i dont think is intended to work that way on android from what ive seen.
I'm using "expo": "~49.0.13"
, and I'm facing the same issue on Android. The Expo documentation has examples saying it should work, but I can't get it to work."
I have tried tons of things and still its not working on android
Let's be honest I've been receiving emails through it everytime. This will not gonna fix the issue. Please close it!
Let's be honest I've been receiving emails through it everytime. This will not gonna fix the issue. Please close it!
<Stack.Group screenOptions={{ presentation: 'modal',animation:"slide_from_bottom" }}> <Stack.Screen name="Shopp" component={Panier} options={{ title: ' Shopp', presentation: 'modal', }} /> </Stack.Group>
finally this is worked
`import { TransitionPresets } from '@react-navigation/stack';
<Stack.Screen name="Profile" component={Profile} options={{ title: 'Profile', ...TransitionPresets.ModalSlideFromBottomIOS, }} />;`
The currently available transitions are:
- SlideFromRightIOS
- ModalSlideFromBottomIOS
- ModalPresentationIOS
- FadeFromBottomAndroid
- RevealFromBottomAndroid
- ScaleFromCenterAndroid
- DefaultTransition
- ModalTransition
All of these are the standard transitions provided by iOS and Android