react-native-drawer-layout 4.0.0 → 4.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/lib/commonjs/utils/useFakeSharedValue.js +10 -0
- package/lib/commonjs/utils/useFakeSharedValue.js.map +1 -1
- package/lib/commonjs/views/Drawer.native.js +10 -2
- package/lib/commonjs/views/Drawer.native.js.map +1 -1
- package/lib/commonjs/views/Overlay.native.js +2 -2
- package/lib/commonjs/views/Overlay.native.js.map +1 -1
- package/lib/module/utils/useFakeSharedValue.js +10 -0
- package/lib/module/utils/useFakeSharedValue.js.map +1 -1
- package/lib/module/views/Drawer.native.js +10 -2
- package/lib/module/views/Drawer.native.js.map +1 -1
- package/lib/module/views/Overlay.native.js +2 -2
- package/lib/module/views/Overlay.native.js.map +1 -1
- package/lib/typescript/commonjs/src/utils/useFakeSharedValue.d.ts +2 -0
- package/lib/typescript/commonjs/src/utils/useFakeSharedValue.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/views/Drawer.native.d.ts.map +1 -1
- package/lib/typescript/commonjs/tsconfig.build.tsbuildinfo +1 -1
- package/lib/typescript/module/src/utils/useFakeSharedValue.d.ts +2 -0
- package/lib/typescript/module/src/utils/useFakeSharedValue.d.ts.map +1 -1
- package/lib/typescript/module/src/views/Drawer.native.d.ts.map +1 -1
- package/lib/typescript/module/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +4 -4
- package/src/utils/useFakeSharedValue.tsx +8 -0
- package/src/views/Drawer.native.tsx +13 -2
- package/src/views/Overlay.native.tsx +2 -2
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-drawer-layout",
|
|
3
3
|
"description": "Drawer component for React Native",
|
|
4
|
-
"version": "4.0.
|
|
4
|
+
"version": "4.0.2",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react-native-component",
|
|
7
7
|
"react-component",
|
|
@@ -52,8 +52,8 @@
|
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
54
54
|
"del-cli": "^5.1.0",
|
|
55
|
-
"react": "18.
|
|
56
|
-
"react-native": "0.
|
|
55
|
+
"react": "18.3.1",
|
|
56
|
+
"react-native": "0.76.2",
|
|
57
57
|
"react-native-builder-bob": "^0.29.0",
|
|
58
58
|
"typescript": "^5.5.2"
|
|
59
59
|
},
|
|
@@ -88,5 +88,5 @@
|
|
|
88
88
|
]
|
|
89
89
|
]
|
|
90
90
|
},
|
|
91
|
-
"gitHead": "
|
|
91
|
+
"gitHead": "9ed7f88db02bf6b2565d575f79bd2feb0ceae1fa"
|
|
92
92
|
}
|
|
@@ -20,6 +20,14 @@ class FakeSharedValue {
|
|
|
20
20
|
this.value = modifier !== undefined ? modifier(this.value) : this.value;
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
+
get() {
|
|
24
|
+
return this.value;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
set(value: number) {
|
|
28
|
+
this.value = value;
|
|
29
|
+
}
|
|
30
|
+
|
|
23
31
|
set value(value: number) {
|
|
24
32
|
this._value = value;
|
|
25
33
|
|
|
@@ -219,19 +219,23 @@ export function Drawer({
|
|
|
219
219
|
|
|
220
220
|
let pan = Gesture?.Pan()
|
|
221
221
|
.onBegin((event) => {
|
|
222
|
+
'worklet';
|
|
222
223
|
startX.value = translationX.value;
|
|
223
224
|
gestureState.value = event.state;
|
|
224
225
|
touchStartX.value = event.x;
|
|
225
226
|
})
|
|
226
227
|
.onStart(() => {
|
|
228
|
+
'worklet';
|
|
227
229
|
runOnJS(onGestureBegin)();
|
|
228
230
|
})
|
|
229
231
|
.onChange((event) => {
|
|
232
|
+
'worklet';
|
|
230
233
|
touchX.value = event.x;
|
|
231
234
|
translationX.value = startX.value + event.translationX;
|
|
232
235
|
gestureState.value = event.state;
|
|
233
236
|
})
|
|
234
237
|
.onEnd((event, success) => {
|
|
238
|
+
'worklet';
|
|
235
239
|
gestureState.value = event.state;
|
|
236
240
|
|
|
237
241
|
if (!success) {
|
|
@@ -330,7 +334,14 @@ export function Drawer({
|
|
|
330
334
|
},
|
|
331
335
|
],
|
|
332
336
|
};
|
|
333
|
-
}
|
|
337
|
+
}, [
|
|
338
|
+
direction,
|
|
339
|
+
drawerPosition,
|
|
340
|
+
drawerType,
|
|
341
|
+
drawerWidth,
|
|
342
|
+
layout.width,
|
|
343
|
+
translateX,
|
|
344
|
+
]);
|
|
334
345
|
|
|
335
346
|
const contentAnimatedStyle = useAnimatedStyle(() => {
|
|
336
347
|
return {
|
|
@@ -350,7 +361,7 @@ export function Drawer({
|
|
|
350
361
|
},
|
|
351
362
|
],
|
|
352
363
|
};
|
|
353
|
-
});
|
|
364
|
+
}, [drawerPosition, drawerType, drawerWidth, translateX]);
|
|
354
365
|
|
|
355
366
|
const progress = useDerivedValue(() => {
|
|
356
367
|
return drawerType === 'permanent'
|
|
@@ -22,7 +22,7 @@ export function Overlay({
|
|
|
22
22
|
// We can send the overlay behind the screen to avoid it
|
|
23
23
|
zIndex: progress.value > PROGRESS_EPSILON ? 0 : -1,
|
|
24
24
|
};
|
|
25
|
-
});
|
|
25
|
+
}, [progress]);
|
|
26
26
|
|
|
27
27
|
const animatedProps = useAnimatedProps(() => {
|
|
28
28
|
const active = progress.value > PROGRESS_EPSILON;
|
|
@@ -32,7 +32,7 @@ export function Overlay({
|
|
|
32
32
|
accessibilityElementsHidden: !active,
|
|
33
33
|
importantForAccessibility: active ? 'auto' : 'no-hide-descendants',
|
|
34
34
|
} as const;
|
|
35
|
-
});
|
|
35
|
+
}, [progress]);
|
|
36
36
|
|
|
37
37
|
return (
|
|
38
38
|
<Animated.View
|