Page MenuHomePhorge

D14231.1768842631.diff
No OneTemporary

Size
4 KB
Referenced Files
None
Subscribers
None

D14231.1768842631.diff

diff --git a/native/flow-typed/npm/react-native-gesture-handler_v2.x.x.js b/native/flow-typed/npm/react-native-gesture-handler_v2.x.x.js
--- a/native/flow-typed/npm/react-native-gesture-handler_v2.x.x.js
+++ b/native/flow-typed/npm/react-native-gesture-handler_v2.x.x.js
@@ -673,6 +673,9 @@
success: boolean,
) => void,
): this;
+ initialize(): void;
+ toGestureArray(): Array<GestureType>;
+ prepare(): void;
}
declare type TapGestureHandlerEventPayload = {
@@ -801,6 +804,10 @@
toGestureArray(): Array<GestureType>;
}
+declare class ExclusiveGesture extends ComposedGesture {
+ prepare(): void;
+}
+
declare type UserSelect = 'none' | 'auto' | 'text';
interface GestureDetectorProps {
@@ -813,6 +820,7 @@
Tap: () => TapGesture,
Pan: () => PanGesture,
Pinch: () => PinchGesture,
+ Exclusive: (...gestures: Array<Gesture>) => ExclusiveGesture,
};
declare module 'react-native-gesture-handler' {
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
@@ -21,6 +21,8 @@
State as GestureState,
type PinchGestureEvent,
type TapGestureEvent,
+ Gesture,
+ GestureDetector,
} from 'react-native-gesture-handler';
import Orientation from 'react-native-orientation-locker';
import type { Orientations } from 'react-native-orientation-locker';
@@ -285,6 +287,7 @@
+close: () => void,
+sendPhoto: () => Promise<void>,
+clearPendingImage: () => void,
+ +gesture: ExclusiveGesture,
};
class CameraModal extends React.PureComponent<Props> {
@@ -694,44 +697,30 @@
}
return (
- <PinchGestureHandler
- onGestureEvent={this.pinchEvent}
- onHandlerStateChange={this.pinchEvent}
- simultaneousHandlers={this.tapHandler}
- ref={this.pinchHandler}
- >
+ <GestureDetector gesture={this.props.gesture}>
<Reanimated.View style={styles.fill}>
- <TapGestureHandler
- onHandlerStateChange={this.tapEvent}
- simultaneousHandlers={this.pinchHandler}
- waitFor={this.pinchHandler}
- ref={this.tapHandler}
+ <Reanimated.View style={this.focusIndicatorStyle} />
+ <TouchableOpacity
+ onPress={this.props.changeFlashMode}
+ onLayout={this.onFlashButtonLayout}
+ style={styles.flashButton}
+ ref={this.flashButtonRef}
>
- <Reanimated.View style={styles.fill}>
- <Reanimated.View style={this.focusIndicatorStyle} />
- <TouchableOpacity
- onPress={this.props.changeFlashMode}
- onLayout={this.onFlashButtonLayout}
- style={styles.flashButton}
- ref={this.flashButtonRef}
- >
- {flashIcon}
- </TouchableOpacity>
- <View style={styles.bottomButtonsContainer}>
- <TouchableOpacity
- onPress={this.props.takePhoto}
- onLayout={this.onPhotoButtonLayout}
- style={styles.saveButton}
- ref={this.photoButtonRef}
- >
- <View style={styles.saveButtonInner} />
- </TouchableOpacity>
- {switchCameraButton}
- </View>
- </Reanimated.View>
- </TapGestureHandler>
+ {flashIcon}
+ </TouchableOpacity>
+ <View style={styles.bottomButtonsContainer}>
+ <TouchableOpacity
+ onPress={this.props.takePhoto}
+ onLayout={this.onPhotoButtonLayout}
+ style={styles.saveButton}
+ ref={this.photoButtonRef}
+ >
+ <View style={styles.saveButtonInner} />
+ </TouchableOpacity>
+ {switchCameraButton}
+ </View>
</Reanimated.View>
- </PinchGestureHandler>
+ </GestureDetector>
);
}
@@ -1220,6 +1209,13 @@
setPendingPhotoCapture();
}, []);
+ const gesture = React.useMemo(() => {
+ // TODO: we'll use this in the next diffs
+ const pinchGesture = Gesture.Pinch().onUpdate((/* { scale } */) => {});
+ const tapGesture = Gesture.Tap().onStart((/* { x, y } */) => {});
+ return Gesture.Exclusive(pinchGesture, tapGesture);
+ }, []);
+
return (
<CameraModal
{...props}
@@ -1251,6 +1247,7 @@
close={close}
sendPhoto={sendPhoto}
clearPendingImage={clearPendingImage}
+ gesture={gesture}
/>
);
});

File Metadata

Mime Type
text/plain
Expires
Mon, Jan 19, 5:10 PM (7 h, 56 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5957414
Default Alt Text
D14231.1768842631.diff (4 KB)

Event Timeline