Skip to content

Commit 9831b5d

Browse files
author
Andrzej Antoni Kwaśniewski
committed
simplify lock
1 parent 2083fab commit 9831b5d

1 file changed

Lines changed: 4 additions & 11 deletions

File tree

  • apps/common-app/src/new_api/complicated/lock

apps/common-app/src/new_api/complicated/lock/index.tsx

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,10 @@ import Animated, {
88
} from 'react-native-reanimated';
99
import {
1010
GestureDetector,
11-
useCompetingGestures,
1211
useLongPressGesture,
1312
usePinchGesture,
1413
useRotationGesture,
1514
useSimultaneousGestures,
16-
useTapGesture,
1715
} from 'react-native-gesture-handler';
1816
import { COLORS } from '../../../common';
1917

@@ -31,20 +29,15 @@ export default function Lock() {
3129
const maxScale = 1;
3230
const TWO_PI = 2 * Math.PI;
3331

34-
// Tap to lock
35-
const tap = useTapGesture({
36-
onDeactivate: () => {
32+
// longPress to unlock
33+
const confirm = useLongPressGesture({
34+
onActivate: () => {
3735
if (savedRotation.value === 0 && scale.value === maxScale) {
3836
runOnJS(setLocked)(false);
3937
}
4038
},
4139
});
4240

43-
// Long press to cancel tap
44-
const longPress = useLongPressGesture({});
45-
46-
const confirm = useCompetingGestures(longPress, tap);
47-
4841
const rotationGesture = useRotationGesture({
4942
onUpdate: (e) => {
5043
rotation.value = savedRotation.value + e.rotation;
@@ -116,7 +109,7 @@ export default function Lock() {
116109
<Text>{locked ? 'Locked' : 'Unlocked!'}</Text>
117110
<Text style={styles.instructions}>
118111
Tou unlock rotate 90 degrees clockwise, and scale to fill the square.
119-
Then tap to confirm, longpress to cancel the tap
112+
Then longPress to confirm unlocking.
120113
</Text>
121114
</View>
122115
);

0 commit comments

Comments
 (0)