Skip to content

Commit 55eeee6

Browse files
authored
Merge pull request Expensify#68337 from software-mansion-labs/feat/migrate-value-selector-modal-to-reaminated-again
Migrate ValueSelectorModal to use the Reanimated modal
2 parents 62fa3b5 + fb2651a commit 55eeee6

2 files changed

Lines changed: 11 additions & 9 deletions

File tree

src/components/Modal/ReanimatedModal/Container/index.web.tsx

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React, {useEffect, useMemo, useRef} from 'react';
2-
import Animated, {Keyframe, useAnimatedStyle, useSharedValue, withTiming} from 'react-native-reanimated';
2+
import Animated, {Keyframe, ReduceMotion, useAnimatedStyle, useSharedValue, withTiming} from 'react-native-reanimated';
33
import type ReanimatedModalProps from '@components/Modal/ReanimatedModal/types';
44
import type {ContainerProps} from '@components/Modal/ReanimatedModal/types';
55
import {easing, getModalInAnimationStyle, getModalOutAnimation} from '@components/Modal/ReanimatedModal/utils';
@@ -37,12 +37,15 @@ function Container({
3737
// instead of an entering transition since keyframe animations break keyboard on mWeb Chrome (#62799)
3838
const animatedStyles = useAnimatedStyle(() => getModalInAnimationStyle(animationIn)(initProgress.get()), [initProgress]);
3939

40-
const Exiting = useMemo(() => {
41-
const AnimationOut = new Keyframe(getModalOutAnimation(animationOut));
42-
43-
// eslint-disable-next-line react-compiler/react-compiler
44-
return AnimationOut.duration(animationOutTiming).withCallback(() => onCloseCallbackRef.current());
45-
}, [animationOutTiming, animationOut]);
40+
const Exiting = useMemo(
41+
() =>
42+
new Keyframe(getModalOutAnimation(animationOut))
43+
.duration(animationOutTiming)
44+
// eslint-disable-next-line react-compiler/react-compiler
45+
.withCallback(() => onCloseCallbackRef.current())
46+
.reduceMotion(ReduceMotion.Never),
47+
[animationOutTiming, animationOut],
48+
);
4649

4750
return (
4851
<Animated.View

src/components/ValuePicker/ValueSelectorModal.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,10 @@ function ValueSelectorModal({
2323
isVisible={isVisible}
2424
onClose={() => onClose?.()}
2525
onModalHide={onClose}
26-
hideModalContentWhileAnimating
27-
useNativeDriver
2826
onBackdropPress={onBackdropPress}
2927
shouldHandleNavigationBack
3028
enableEdgeToEdgeBottomSafeAreaPadding
29+
shouldUseReanimatedModal
3130
>
3231
<ScreenWrapper
3332
includePaddingTop={false}

0 commit comments

Comments
 (0)