a-ghorbani--pocketpal-ai
80 行
3.0 KiB
Diff
80 行
3.0 KiB
Diff
diff --git a/node_modules/react-native-paper/src/components/Menu/Menu.tsx b/node_modules/react-native-paper/src/components/Menu/Menu.tsx
|
|
index 55922c1..fbd3834 100644
|
|
--- a/node_modules/react-native-paper/src/components/Menu/Menu.tsx
|
|
+++ b/node_modules/react-native-paper/src/components/Menu/Menu.tsx
|
|
@@ -303,6 +303,12 @@ const Menu = ({
|
|
);
|
|
|
|
const show = React.useCallback(async () => {
|
|
+ // Reset animation values to ensure clean state (fixes menu not reopening after item selection)
|
|
+ scaleAnimationRef.current.stopAnimation();
|
|
+ opacityAnimationRef.current.stopAnimation();
|
|
+ scaleAnimationRef.current.setValue({ x: 0, y: 0 });
|
|
+ opacityAnimationRef.current.setValue(0);
|
|
+
|
|
const windowLayoutResult = Dimensions.get('window');
|
|
const [menuLayoutResult, anchorLayoutResult] = await Promise.all([
|
|
measureMenuLayout(),
|
|
@@ -340,12 +346,13 @@ const Menu = ({
|
|
});
|
|
|
|
setWindowLayout({
|
|
- height: windowLayoutResult.height - keyboardHeightRef.current,
|
|
+ height: windowLayoutResult.height - keyboardHeightRef.current - insets.bottom,
|
|
width: windowLayoutResult.width,
|
|
});
|
|
|
|
attachListeners();
|
|
const { animation } = theme;
|
|
+ await new Promise(resolve => setTimeout(resolve, 1));
|
|
Animated.parallel([
|
|
Animated.timing(scaleAnimationRef.current, {
|
|
toValue: { x: menuLayoutResult.width, y: menuLayoutResult.height },
|
|
@@ -365,13 +372,17 @@ const Menu = ({
|
|
prevRendered.current = true;
|
|
}
|
|
});
|
|
- }, [anchor, attachListeners, measureAnchorLayout, theme]);
|
|
+ }, [anchor, attachListeners, insets.bottom, measureAnchorLayout, theme]);
|
|
|
|
- const hide = React.useCallback(() => {
|
|
+ const hide = React.useCallback((callback?: () => unknown) => {
|
|
removeListeners();
|
|
+ // Stop any running animations and reset state immediately
|
|
+ scaleAnimationRef.current.stopAnimation();
|
|
+ opacityAnimationRef.current.stopAnimation();
|
|
+ scaleAnimationRef.current.setValue({ x: 0, y: 0 });
|
|
+ prevRendered.current = false;
|
|
|
|
const { animation } = theme;
|
|
-
|
|
Animated.timing(opacityAnimationRef.current, {
|
|
toValue: 0,
|
|
duration: ANIMATION_DURATION * animation.scale,
|
|
@@ -383,6 +394,7 @@ const Menu = ({
|
|
setRendered(false);
|
|
prevRendered.current = false;
|
|
focusFirstDOMNode(anchorRef.current);
|
|
+ callback?.();
|
|
}
|
|
});
|
|
}, [removeListeners, theme]);
|
|
@@ -640,7 +652,7 @@ const Menu = ({
|
|
<Pressable
|
|
accessibilityLabel={overlayAccessibilityLabel}
|
|
accessibilityRole="button"
|
|
- onPress={onDismiss}
|
|
+ onPress={() => hide(onDismiss)}
|
|
style={styles.pressableOverlay}
|
|
/>
|
|
<View
|
|
@@ -651,7 +663,7 @@ const Menu = ({
|
|
accessibilityViewIsModal={visible}
|
|
style={[styles.wrapper, positionStyle, style]}
|
|
pointerEvents={pointerEvents}
|
|
- onAccessibilityEscape={onDismiss}
|
|
+ onAccessibilityEscape={() => hide(onDismiss)}
|
|
testID={`${testID}-view`}
|
|
>
|
|
<Animated.View
|