Skip to content

Commit

Permalink
Fix backdrop flashes on Android
Browse files Browse the repository at this point in the history
  • Loading branch information
j-piasecki committed Jan 24, 2024
1 parent c33a4ee commit 27846dd
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
2 changes: 2 additions & 0 deletions src/components/Modal/BaseModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ function BaseModal(
animationIn,
animationOut,
useNativeDriver: useNativeDriverProp,
useNativeDriverForBackdrop,
hideModalContentWhileAnimating = false,
animationInTiming,
animationOutTiming,
Expand Down Expand Up @@ -200,6 +201,7 @@ function BaseModal(
animationIn={animationIn ?? modalStyleAnimationIn}
animationOut={animationOut ?? modalStyleAnimationOut}
useNativeDriver={useNativeDriverProp && useNativeDriver}
useNativeDriverForBackdrop={useNativeDriverForBackdrop && useNativeDriver}
hideModalContentWhileAnimating={hideModalContentWhileAnimating}
animationInTiming={animationInTiming}
animationOutTiming={animationOutTiming}
Expand Down
3 changes: 2 additions & 1 deletion src/components/Modal/index.android.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,13 @@ AppState.addEventListener('blur', () => {
ComposerFocusManager.resetReadyToFocus();
});

// Only want to use useNativeDriver on Android. It has strange flashes issue on IOS
// Only want to use useNativeDriver for backdrop on iOS. It has strange flashes issue on IOS
// https://github.com/react-native-modal/react-native-modal#the-modal-flashes-in-a-weird-way-when-animating
function Modal({useNativeDriver = true, ...rest}: BaseModalProps) {
return (
<BaseModal
useNativeDriver={useNativeDriver}
useNativeDriverForBackdrop={false}
// eslint-disable-next-line react/jsx-props-no-spreading
{...rest}
>
Expand Down
1 change: 0 additions & 1 deletion src/components/Modal/index.ios.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ function Modal({children, ...rest}: BaseModalProps) {
return (
<BaseModal
useNativeDriver
useNativeDriverForBackdrop={false}
// eslint-disable-next-line react/jsx-props-no-spreading
{...rest}
>
Expand Down

0 comments on commit 27846dd

Please sign in to comment.