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

fix: don't use AnimatedNativeScreen when stackPresentation prop is not set #2107

Merged
merged 1 commit into from Apr 23, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions src/components/Screen.tsx
Expand Up @@ -17,7 +17,7 @@
import ModalScreenNativeComponent from '../fabric/ModalScreenNativeComponent';

export const NativeScreen: React.ComponentType<ScreenProps> =
ScreenNativeComponent as any;

Check warning on line 20 in src/components/Screen.tsx

View workflow job for this annotation

GitHub Actions / install-and-lint

Unexpected any. Specify a different type
const AnimatedNativeScreen = Animated.createAnimatedComponent(NativeScreen);
const AnimatedNativeModalScreen = Animated.createAnimatedComponent(
ModalScreenNativeComponent as React.ComponentType<ScreenProps>
Expand Down Expand Up @@ -79,6 +79,7 @@
// Due to how Yoga resolves layout, we need to have different components for modal nad non-modal screens
const AnimatedScreen =
Platform.OS === 'android' ||
stackPresentation === undefined ||
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't it be better to do something like stackPresentation === 'modal' ? AnimatedNativeModalScreen : AnimatedNativeScreen - use modal when necessary and regular screen for rest, instead of specifying all the cases where it won't be a modal?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This check will probably be updated when modals on Android and other types of modals on iOS by @kkafar will be merged. I'd leave it like that for now and come back to it when it's done but if you feel like it should be done here, then we can do it 🤷‍♂️

stackPresentation === 'push' ||
stackPresentation === 'containedModal' ||
stackPresentation === 'containedTransparentModal'
Expand Down