-
-
Notifications
You must be signed in to change notification settings - Fork 5k
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
presentation: 'modal' interpolates bottom radius causing visual bug when used with tab navigator #9933
Comments
The versions mentioned in the issue for the following packages differ from the latest versions on npm:
Can you verify that the issue still exists after upgrading to the latest versions of these packages? |
Yes this is still an issue. |
Couldn't find version numbers for the following packages in the issue:
Can you update the issue to include version numbers for those packages? The version numbers must match the format 1.2.3. |
Modals are intended to be used at root. It's not proper UX to have them nested inside tab navigator. While it's not needed visually, the If you really want modals inside tab navigator for some reason, you can provide a custom |
Hey! This issue is closed and isn't watched by the core team. You are welcome to discuss the issue with others in this thread, but if you think this issue is still valid and needs to be tracked, please open a new issue with a repro. |
Did anybody find a solution here using a custom cardStyleInterpolator? |
Notes
import { Platform } from "react-native";
import { TransitionPresets, StackCardInterpolationProps, StackCardInterpolatedStyle } from '@react-navigation/stack';
// Note: if not using the name `forModalPresentationIOS`, need to rename the function using something like `Object.defineProperty(Test, "name", {value: "forModalPresentationIOS"});`, as `react-navigation` has specific checks for the interpolator name.
const forModalPresentationIOS = (props: StackCardInterpolationProps): StackCardInterpolatedStyle => {
const config = TransitionPresets.ModalPresentationIOS.cardStyleInterpolator(props);
config.cardStyle.borderBottomLeftRadius = undefined;
config.cardStyle.borderBottomRightRadius = undefined;
return config
};
const fixTabNestedStackCardStyleInterpolator = Platform.select({
ios: forModalPresentationIOS,
default: TransitionPresets.BottomSheetAndroid.cardStyleInterpolator,
});
...
<Stack.Screen
name="Test screen"
component={TestCompoment}
options={{ cardStyleInterpolator: fixTabNestedStackCardStyleInterpolator }}
/> |
Good day, the solution for iOS works perfectly. How can I achieve the same for Android? |
Current behavior
Since
6.0
was introduced the transition specification forpresentation: 'modal'
seems to have been updated to follow the newModalPresentationIOS
-preset. Unfortunately this update causes some issues when used within aTab.Navigator
-context.The border-radius-interpolation is applied to all four edges causing a visual bug.
Expected behavior
The border-radius-interpolation should only be applied to
borderTopLeftRadius
andborderTopRightRadius
.Reproduction
https://snack.expo.dev/@albinmartinsson/presentation-modal---glitch
Platform
Packages
Environment
The text was updated successfully, but these errors were encountered: