diff --git a/native/chat/multimedia-message-multimedia.react.js b/native/chat/multimedia-message-multimedia.react.js --- a/native/chat/multimedia-message-multimedia.react.js +++ b/native/chat/multimedia-message-multimedia.react.js @@ -111,7 +111,7 @@ overlay.presentedFrom === route.key && overlay.routeKey === getMediaKey(props.item, props.mediaInfo) ) { - return overlay.positionV2; + return overlay.position; } } return undefined; diff --git a/native/chat/reaction-selection-popover.react.js b/native/chat/reaction-selection-popover.react.js --- a/native/chat/reaction-selection-popover.react.js +++ b/native/chat/reaction-selection-popover.react.js @@ -53,11 +53,8 @@ overlayContext, 'ReactionSelectionPopover should have OverlayContext', ); - const { positionV2 } = overlayContext; - invariant( - positionV2, - 'position should be defined in ReactionSelectionPopover', - ); + const { position } = overlayContext; + invariant(position, 'position should be defined in ReactionSelectionPopover'); const dimensions = useSelector(state => state.dimensions); @@ -81,7 +78,7 @@ const animationStyle = useAnimatedStyle(() => { const style: WritableAnimatedStyleObj = {}; style.opacity = interpolate( - positionV2.value, + position.value, [0, 0.1], [0, 1], Extrapolate.CLAMP, @@ -89,20 +86,20 @@ const transform: Array<ReanimatedTransform> = [ { scale: interpolate( - positionV2.value, + position.value, [0.2, 0.8], [0, 1], Extrapolate.CLAMP, ), }, { - translateX: (1 - positionV2.value) * popoverHorizontalOffset, + translateX: (1 - position.value) * popoverHorizontalOffset, }, ]; if (popoverLocation === 'above') { transform.push({ translateY: interpolate( - positionV2.value, + position.value, [0, 1], [calculatedMargin + reactionSelectionPopoverDimensions.height / 2, 0], Extrapolate.CLAMP, @@ -111,7 +108,7 @@ } else { transform.push({ translateY: interpolate( - positionV2.value, + position.value, [0, 1], [ -calculatedMargin - reactionSelectionPopoverDimensions.height / 2, diff --git a/native/chat/utils.js b/native/chat/utils.js --- a/native/chat/utils.js +++ b/native/chat/utils.js @@ -318,7 +318,7 @@ overlay.routeName === RobotextMessageTooltipModalRouteName) && overlay.routeKey === getMessageTooltipKey(item) ) { - return overlay.positionV2; + return overlay.position; } } return undefined; diff --git a/native/components/full-screen-view-modal.react.js b/native/components/full-screen-view-modal.react.js --- a/native/components/full-screen-view-modal.react.js +++ b/native/components/full-screen-view-modal.react.js @@ -612,7 +612,7 @@ singleTapUpdate, ]); - const navigationProgress = overlayContext.positionV2; + const navigationProgress = overlayContext.position; invariant( navigationProgress, 'position should be defined in FullScreenViewModal', diff --git a/native/media/camera-modal.react.js b/native/media/camera-modal.react.js --- a/native/media/camera-modal.react.js +++ b/native/media/camera-modal.react.js @@ -832,7 +832,7 @@ const containerAnimatedStyle = useAnimatedStyle( () => ({ - opacity: overlayContext?.positionV2?.value, + opacity: overlayContext?.position?.value, }), [overlayContext], ); diff --git a/native/media/video-playback-modal.react.js b/native/media/video-playback-modal.react.js --- a/native/media/video-playback-modal.react.js +++ b/native/media/video-playback-modal.react.js @@ -350,7 +350,7 @@ const overlayContext = React.useContext(OverlayContext); invariant(overlayContext, 'VideoPlaybackModal should have OverlayContext'); - const navigationProgress = overlayContext.positionV2; + const navigationProgress = overlayContext.position; invariant( navigationProgress, 'position should be defined in VideoPlaybackModal', diff --git a/native/navigation/action-result-modal.react.js b/native/navigation/action-result-modal.react.js --- a/native/navigation/action-result-modal.react.js +++ b/native/navigation/action-result-modal.react.js @@ -23,7 +23,7 @@ function ActionResultModal(props: Props): React.Node { const overlayContext = React.useContext(OverlayContext); invariant(overlayContext, 'ActionResultModal should have OverlayContext'); - const { positionV2 } = overlayContext; + const { position } = overlayContext; // Timer resets whenever message updates const { goBackOnce } = props.navigation; @@ -37,7 +37,7 @@ const bottomInset = useSelector(state => state.dimensions.bottomInset); const animatedContainerStyle = useAnimatedStyle( () => ({ - opacity: positionV2?.value, + opacity: position?.value, paddingBottom: bottomInset + 100, }), [bottomInset], diff --git a/native/navigation/overlay-context.js b/native/navigation/overlay-context.js --- a/native/navigation/overlay-context.js +++ b/native/navigation/overlay-context.js @@ -6,7 +6,7 @@ export type VisibleOverlay = { +routeKey: string, +routeName: string, - +positionV2: ?SharedValue<number>, + +position: ?SharedValue<number>, +shouldRenderScreenContent: boolean, +onExitFinish?: () => void, +presentedFrom: ?string, @@ -16,7 +16,7 @@ export type OverlayContextType = { // position and isDismissing are local to the current route - +positionV2: ?SharedValue<number>, + +position: ?SharedValue<number>, +shouldRenderScreenContent: boolean, +onExitFinish?: () => void, +isDismissing: boolean, diff --git a/native/navigation/overlay-navigator.react.js b/native/navigation/overlay-navigator.react.js --- a/native/navigation/overlay-navigator.react.js +++ b/native/navigation/overlay-navigator.react.js @@ -81,7 +81,7 @@ +route: Route<>, +descriptor: Descriptor<OverlayNavigationHelpers<>, {}>, +context: { - +positionV2: ?SharedValue<number>, + +position: ?SharedValue<number>, +shouldRenderScreenContent: boolean, +onExitFinish?: () => void, +isDismissing: boolean, @@ -131,17 +131,17 @@ }); const curIndex = state.index; - const positionRefsV2 = React.useRef<{ [string]: SharedValue<number> }>({}); - const positionsV2 = positionRefsV2.current; + const positionRefs = React.useRef<{ [string]: SharedValue<number> }>({}); + const positions = positionRefs.current; // cleanup shared values not created with useSharedValue just in case // like described in the reanimated docs: // https://docs.swmansion.com/react-native-reanimated/docs/advanced/makeMutable#remarks React.useEffect(() => { return () => { - // we don't want to capture positionV2Refs.current + // we don't want to capture positionRefs.current // eslint-disable-next-line react-hooks/exhaustive-deps - Object.values(positionRefsV2.current).forEach(position => + Object.values(positionRefs.current).forEach(position => cancelAnimation(position), ); }; @@ -164,14 +164,14 @@ ); const shouldUseLegacyAnimation = !newReanimatedRoutes.has(route.name); - if (!positionsV2[route.key] && shouldUseLegacyAnimation) { - positionsV2[route.key] = makeMutable(firstRender ? 1 : 0); + if (!positions[route.key] && shouldUseLegacyAnimation) { + positions[route.key] = makeMutable(firstRender ? 1 : 0); } return { route, descriptor, context: { - positionV2: positionsV2[route.key], + position: positions[route.key], isDismissing: curIndex < routeIndex, shouldRenderScreenContent: true, }, @@ -184,7 +184,7 @@ // render. We know that they should only substantially change if something // about the underlying route has changed // eslint-disable-next-line react-hooks/exhaustive-deps - [positionsV2, routes, curIndex], + [positions, routes, curIndex], ); const prevScenesRef = React.useRef<?$ReadOnlyArray<Scene>>(); @@ -203,7 +203,7 @@ return { routeKey: route.key, routeName: route.name, - positionV2: positionsV2[route.key], + position: positions[route.key], shouldRenderScreenContent: true, presentedFrom, }; @@ -442,8 +442,8 @@ return; } for (const key in pendingAnimations) { - const positionV2 = positionsV2[key]; - if (!positionV2) { + const position = positions[key]; + if (!position) { continue; } const toValue = pendingAnimations[key]; @@ -460,14 +460,14 @@ 400; } requestAnimationFrame(() => { - positionV2.value = withTiming( + position.value = withTiming( toValue, { duration, easing: Easing.inOut(Easing.ease), }, () => { - if (positionV2.value <= 0) { + if (position.value <= 0) { runOnJS(removeScreen)(key); } }, @@ -475,7 +475,7 @@ }); } pendingAnimationsRef.current = {}; - }, [positionsV2, pendingAnimations]); + }, [positions, pendingAnimations]); // If sceneData changes, we update scrollBlockingModalStatus based on it, // both in state and within the individual sceneData contexts. diff --git a/native/tooltip/tooltip.react.js b/native/tooltip/tooltip.react.js --- a/native/tooltip/tooltip.react.js +++ b/native/tooltip/tooltip.react.js @@ -238,14 +238,14 @@ }, [margin, tooltipHeight, params, tooltipLocation]); invariant(overlayContext, 'Tooltip should have OverlayContext'); - const { positionV2 } = overlayContext; - invariant(positionV2, 'position should be defined in tooltip'); + const { position } = overlayContext; + invariant(position, 'position should be defined in tooltip'); const tooltipHorizontalOffset = useSharedValue(0); const opacityStyle: AnimatedStyleObj = useAnimatedStyle(() => { const backdropOpacity = interpolate( - positionV2.value, + position.value, [0, 1], [0, 0.7], Extrapolate.CLAMP, @@ -287,14 +287,14 @@ style.position = 'absolute'; style.alignItems = 'center'; const tooltipContainerOpacity = interpolate( - positionV2.value, + position.value, [0, 0.1], [0, 1], Extrapolate.CLAMP, ); style.opacity = tooltipContainerOpacity; - const invertedPosition = 1 - positionV2.value; + const invertedPosition = 1 - position.value; const transform: Array<ReanimatedTransform> = []; @@ -334,7 +334,7 @@ style.bottom = dimensions.height - Math.max(y, verticalBounds.y) + margin; const tooltipVerticalAbove = interpolate( - positionV2.value, + position.value, [0, 1], [margin + tooltipHeight / 2, 0], Extrapolate.CLAMP, @@ -345,7 +345,7 @@ Math.min(y + height, verticalBounds.y + verticalBounds.height) + margin; const tooltipVerticalBelow = interpolate( - positionV2.value, + position.value, [0, 1], [-margin - tooltipHeight / 2, 0], Extrapolate.CLAMP, @@ -355,7 +355,7 @@ if (computedTooltipLocation !== 'fixed') { const tooltipScale = interpolate( - positionV2.value, + position.value, [0, 0.2, 0.8, 1], [0, 0, 1, 1], Extrapolate.CLAMP, @@ -466,7 +466,7 @@ const buttonProps: ButtonProps<TooltipPropsType> = { ...navAndRouteForFlow, - progressV2: positionV2, + progressV2: position, isOpeningSidebar, };