@react-navigation/drawer 6.1.8 → 6.2.0

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.
Files changed (71) hide show
  1. package/lib/commonjs/index.js +14 -14
  2. package/lib/commonjs/index.js.map +1 -1
  3. package/lib/commonjs/navigators/createDrawerNavigator.js +10 -9
  4. package/lib/commonjs/navigators/createDrawerNavigator.js.map +1 -1
  5. package/lib/commonjs/utils/DrawerStatusContext.js.map +1 -1
  6. package/lib/commonjs/utils/useDrawerStatus.js.map +1 -1
  7. package/lib/commonjs/views/DrawerContent.js +6 -5
  8. package/lib/commonjs/views/DrawerContent.js.map +1 -1
  9. package/lib/commonjs/views/DrawerContentScrollView.js +7 -6
  10. package/lib/commonjs/views/DrawerContentScrollView.js.map +1 -1
  11. package/lib/commonjs/views/DrawerItem.js +13 -10
  12. package/lib/commonjs/views/DrawerItem.js.map +1 -1
  13. package/lib/commonjs/views/DrawerItemList.js +6 -5
  14. package/lib/commonjs/views/DrawerItemList.js.map +1 -1
  15. package/lib/commonjs/views/DrawerToggleButton.js +5 -4
  16. package/lib/commonjs/views/DrawerToggleButton.js.map +1 -1
  17. package/lib/commonjs/views/DrawerView.js +32 -29
  18. package/lib/commonjs/views/DrawerView.js.map +1 -1
  19. package/lib/commonjs/views/GestureHandler.js +7 -4
  20. package/lib/commonjs/views/GestureHandler.js.map +1 -1
  21. package/lib/commonjs/views/GestureHandlerNative.js +1 -1
  22. package/lib/commonjs/views/ScreenFallback.js +13 -9
  23. package/lib/commonjs/views/ScreenFallback.js.map +1 -1
  24. package/lib/commonjs/views/legacy/Drawer.js +17 -12
  25. package/lib/commonjs/views/legacy/Drawer.js.map +1 -1
  26. package/lib/commonjs/views/legacy/Overlay.js +8 -6
  27. package/lib/commonjs/views/legacy/Overlay.js.map +1 -1
  28. package/lib/commonjs/views/modern/Drawer.js +28 -30
  29. package/lib/commonjs/views/modern/Drawer.js.map +1 -1
  30. package/lib/commonjs/views/modern/Overlay.js +7 -6
  31. package/lib/commonjs/views/modern/Overlay.js.map +1 -1
  32. package/lib/module/index.js.map +1 -1
  33. package/lib/module/navigators/createDrawerNavigator.js +10 -9
  34. package/lib/module/navigators/createDrawerNavigator.js.map +1 -1
  35. package/lib/module/utils/DrawerStatusContext.js.map +1 -1
  36. package/lib/module/utils/useDrawerStatus.js.map +1 -1
  37. package/lib/module/views/DrawerContent.js +6 -5
  38. package/lib/module/views/DrawerContent.js.map +1 -1
  39. package/lib/module/views/DrawerContentScrollView.js +7 -6
  40. package/lib/module/views/DrawerContentScrollView.js.map +1 -1
  41. package/lib/module/views/DrawerItem.js +13 -10
  42. package/lib/module/views/DrawerItem.js.map +1 -1
  43. package/lib/module/views/DrawerItemList.js +6 -5
  44. package/lib/module/views/DrawerItemList.js.map +1 -1
  45. package/lib/module/views/DrawerToggleButton.js +5 -4
  46. package/lib/module/views/DrawerToggleButton.js.map +1 -1
  47. package/lib/module/views/DrawerView.js +31 -28
  48. package/lib/module/views/DrawerView.js.map +1 -1
  49. package/lib/module/views/GestureHandler.js +6 -3
  50. package/lib/module/views/GestureHandler.js.map +1 -1
  51. package/lib/module/views/ScreenFallback.js +13 -9
  52. package/lib/module/views/ScreenFallback.js.map +1 -1
  53. package/lib/module/views/legacy/Drawer.js +17 -12
  54. package/lib/module/views/legacy/Drawer.js.map +1 -1
  55. package/lib/module/views/legacy/Overlay.js +8 -6
  56. package/lib/module/views/legacy/Overlay.js.map +1 -1
  57. package/lib/module/views/modern/Drawer.js +28 -30
  58. package/lib/module/views/modern/Drawer.js.map +1 -1
  59. package/lib/module/views/modern/Overlay.js +7 -6
  60. package/lib/module/views/modern/Overlay.js.map +1 -1
  61. package/lib/typescript/src/index.d.ts +1 -1
  62. package/lib/typescript/src/utils/useDrawerStatus.d.ts +2 -1
  63. package/lib/typescript/src/views/legacy/Overlay.d.ts +4 -0
  64. package/lib/typescript/src/views/modern/Overlay.d.ts +4 -0
  65. package/package.json +10 -10
  66. package/src/index.tsx +1 -0
  67. package/src/utils/DrawerStatusContext.tsx +3 -2
  68. package/src/utils/useDrawerStatus.tsx +2 -1
  69. package/src/views/legacy/Drawer.tsx +17 -9
  70. package/src/views/legacy/Overlay.tsx +1 -0
  71. package/src/views/modern/Drawer.tsx +25 -23
@@ -1 +1 @@
1
- {"version":3,"sources":["Overlay.tsx"],"names":["React","Platform","Pressable","StyleSheet","Animated","useAnimatedProps","useAnimatedStyle","PROGRESS_EPSILON","Overlay","forwardRef","progress","onPress","style","props","ref","animatedStyle","opacity","value","zIndex","animatedProps","active","pointerEvents","accessibilityElementsHidden","importantForAccessibility","styles","overlay","overlayStyle","pressable","select","web","WebkitTapHighlightColor","default","create","absoluteFillObject","backgroundColor","flex"],"mappings":";;AAAA,OAAO,KAAKA,KAAZ,MAAuB,OAAvB;AACA,SAASC,QAAT,EAAmBC,SAAnB,EAA8BC,UAA9B,QAAgD,cAAhD;AACA,OAAOC,QAAP,IACEC,gBADF,EAEEC,gBAFF,QAGO,yBAHP;AAKA,MAAMC,gBAAgB,GAAG,IAAzB;AAOA,MAAMC,OAAO,gBAAGR,KAAK,CAACS,UAAN,CAAiB,SAASD,OAAT,CAC/B;AAAEE,EAAAA,QAAF;AAAYC,EAAAA,OAAZ;AAAqBC,EAAAA,KAArB;AAA4B,KAAGC;AAA/B,CAD+B,EAE/BC,GAF+B,EAG/B;AACA,QAAMC,aAAa,GAAGT,gBAAgB,CAAC,MAAM;AAC3C,WAAO;AACLU,MAAAA,OAAO,EAAEN,QAAQ,CAACO,KADb;AAEL;AACA;AACAC,MAAAA,MAAM,EAAER,QAAQ,CAACO,KAAT,GAAiBV,gBAAjB,GAAoC,CAApC,GAAwC,CAAC;AAJ5C,KAAP;AAMD,GAPqC,CAAtC;AASA,QAAMY,aAAa,GAAGd,gBAAgB,CAAC,MAAM;AAC3C,UAAMe,MAAM,GAAGV,QAAQ,CAACO,KAAT,GAAiBV,gBAAhC;AAEA,WAAO;AACLc,MAAAA,aAAa,EAAED,MAAM,GAAG,MAAH,GAAY,MAD5B;AAELE,MAAAA,2BAA2B,EAAE,CAACF,MAFzB;AAGLG,MAAAA,yBAAyB,EAAEH,MAAM,GAAG,MAAH,GAAY;AAHxC,KAAP;AAKD,GARqC,CAAtC;AAUA,sBACE,oBAAC,QAAD,CAAU,IAAV,eACMP,KADN;AAEE,IAAA,GAAG,EAAEC,GAFP;AAGE,IAAA,KAAK,EAAE,CAACU,MAAM,CAACC,OAAR,EAAiBC,YAAjB,EAA+BX,aAA/B,EAA8CH,KAA9C,CAHT;AAIE,IAAA,aAAa,EAAEO;AAJjB,mBAME,oBAAC,SAAD;AAAW,IAAA,OAAO,EAAER,OAApB;AAA6B,IAAA,KAAK,EAAEa,MAAM,CAACG;AAA3C,IANF,CADF;AAUD,CAjCe,CAAhB;AAmCA,MAAMD,YAAY,GAAGzB,QAAQ,CAAC2B,MAAT,CAAwC;AAC3DC,EAAAA,GAAG,EAAE;AACH;AACA;AACAC,IAAAA,uBAAuB,EAAE;AAHtB,GADsD;AAM3DC,EAAAA,OAAO,EAAE;AANkD,CAAxC,CAArB;AASA,MAAMP,MAAM,GAAGrB,UAAU,CAAC6B,MAAX,CAAkB;AAC/BP,EAAAA,OAAO,EAAE,EACP,GAAGtB,UAAU,CAAC8B,kBADP;AAEPC,IAAAA,eAAe,EAAE;AAFV,GADsB;AAK/BP,EAAAA,SAAS,EAAE;AACTQ,IAAAA,IAAI,EAAE;AADG;AALoB,CAAlB,CAAf;AAUA,eAAe3B,OAAf","sourcesContent":["import * as React from 'react';\nimport { Platform, Pressable, StyleSheet } from 'react-native';\nimport Animated, {\n useAnimatedProps,\n useAnimatedStyle,\n} from 'react-native-reanimated';\n\nconst PROGRESS_EPSILON = 0.05;\n\ntype Props = React.ComponentProps<typeof Animated.View> & {\n progress: Animated.SharedValue<number>;\n onPress: () => void;\n};\n\nconst Overlay = React.forwardRef(function Overlay(\n { progress, onPress, style, ...props }: Props,\n ref: React.Ref<Animated.View>\n) {\n const animatedStyle = useAnimatedStyle(() => {\n return {\n opacity: progress.value,\n // We don't want the user to be able to press through the overlay when drawer is open\n // We can send the overlay behind the screen to avoid it\n zIndex: progress.value > PROGRESS_EPSILON ? 0 : -1,\n };\n });\n\n const animatedProps = useAnimatedProps(() => {\n const active = progress.value > PROGRESS_EPSILON;\n\n return {\n pointerEvents: active ? 'auto' : 'none',\n accessibilityElementsHidden: !active,\n importantForAccessibility: active ? 'auto' : 'no-hide-descendants',\n } as const;\n });\n\n return (\n <Animated.View\n {...props}\n ref={ref}\n style={[styles.overlay, overlayStyle, animatedStyle, style]}\n animatedProps={animatedProps}\n >\n <Pressable onPress={onPress} style={styles.pressable} />\n </Animated.View>\n );\n});\n\nconst overlayStyle = Platform.select<Record<string, string>>({\n web: {\n // Disable touch highlight on mobile Safari.\n // WebkitTapHighlightColor must be used outside of StyleSheet.create because react-native-web will omit the property.\n WebkitTapHighlightColor: 'transparent',\n },\n default: {},\n});\n\nconst styles = StyleSheet.create({\n overlay: {\n ...StyleSheet.absoluteFillObject,\n backgroundColor: 'rgba(0, 0, 0, 0.5)',\n },\n pressable: {\n flex: 1,\n },\n});\n\nexport default Overlay;\n"]}
1
+ {"version":3,"sources":["Overlay.tsx"],"names":["React","Platform","Pressable","StyleSheet","Animated","useAnimatedProps","useAnimatedStyle","PROGRESS_EPSILON","Overlay","forwardRef","ref","progress","onPress","style","props","animatedStyle","opacity","value","zIndex","animatedProps","active","pointerEvents","accessibilityElementsHidden","importantForAccessibility","styles","overlay","overlayStyle","pressable","select","web","WebkitTapHighlightColor","default","create","absoluteFillObject","backgroundColor","flex"],"mappings":";;AAAA,OAAO,KAAKA,KAAZ,MAAuB,OAAvB;AACA,SAASC,QAAT,EAAmBC,SAAnB,EAA8BC,UAA9B,QAAgD,cAAhD;AACA,OAAOC,QAAP,IACEC,gBADF,EAEEC,gBAFF,QAGO,yBAHP;AAKA,MAAMC,gBAAgB,GAAG,IAAzB;AAOA,MAAMC,OAAO,gBAAGR,KAAK,CAACS,UAAN,CAAiB,SAASD,OAAT,OAE/BE,GAF+B,EAG/B;AAAA,MAFA;AAAEC,IAAAA,QAAF;AAAYC,IAAAA,OAAZ;AAAqBC,IAAAA,KAArB;AAA4B,OAAGC;AAA/B,GAEA;AACA,QAAMC,aAAa,GAAGT,gBAAgB,CAAC,MAAM;AAC3C,WAAO;AACLU,MAAAA,OAAO,EAAEL,QAAQ,CAACM,KADb;AAEL;AACA;AACAC,MAAAA,MAAM,EAAEP,QAAQ,CAACM,KAAT,GAAiBV,gBAAjB,GAAoC,CAApC,GAAwC,CAAC;AAJ5C,KAAP;AAMD,GAPqC,CAAtC;AASA,QAAMY,aAAa,GAAGd,gBAAgB,CAAC,MAAM;AAC3C,UAAMe,MAAM,GAAGT,QAAQ,CAACM,KAAT,GAAiBV,gBAAhC;AAEA,WAAO;AACLc,MAAAA,aAAa,EAAED,MAAM,GAAG,MAAH,GAAY,MAD5B;AAELE,MAAAA,2BAA2B,EAAE,CAACF,MAFzB;AAGLG,MAAAA,yBAAyB,EAAEH,MAAM,GAAG,MAAH,GAAY;AAHxC,KAAP;AAKD,GARqC,CAAtC;AAUA,sBACE,oBAAC,QAAD,CAAU,IAAV,eACMN,KADN;AAEE,IAAA,GAAG,EAAEJ,GAFP;AAGE,IAAA,KAAK,EAAE,CAACc,MAAM,CAACC,OAAR,EAAiBC,YAAjB,EAA+BX,aAA/B,EAA8CF,KAA9C,CAHT;AAIE,IAAA,aAAa,EAAEM;AAJjB,mBAME,oBAAC,SAAD;AAAW,IAAA,OAAO,EAAEP,OAApB;AAA6B,IAAA,KAAK,EAAEY,MAAM,CAACG;AAA3C,IANF,CADF;AAUD,CAjCe,CAAhB;AAmCA,MAAMD,YAAY,GAAGzB,QAAQ,CAAC2B,MAAT,CAAwC;AAC3DC,EAAAA,GAAG,EAAE;AACH;AACA;AACAC,IAAAA,uBAAuB,EAAE;AAHtB,GADsD;AAM3DC,EAAAA,OAAO,EAAE;AANkD,CAAxC,CAArB;AASA,MAAMP,MAAM,GAAGrB,UAAU,CAAC6B,MAAX,CAAkB;AAC/BP,EAAAA,OAAO,EAAE,EACP,GAAGtB,UAAU,CAAC8B,kBADP;AAEPC,IAAAA,eAAe,EAAE;AAFV,GADsB;AAK/BP,EAAAA,SAAS,EAAE;AACTQ,IAAAA,IAAI,EAAE;AADG;AALoB,CAAlB,CAAf;AAUA,eAAe3B,OAAf","sourcesContent":["import * as React from 'react';\nimport { Platform, Pressable, StyleSheet } from 'react-native';\nimport Animated, {\n useAnimatedProps,\n useAnimatedStyle,\n} from 'react-native-reanimated';\n\nconst PROGRESS_EPSILON = 0.05;\n\ntype Props = React.ComponentProps<typeof Animated.View> & {\n progress: Animated.SharedValue<number>;\n onPress: () => void;\n};\n\nconst Overlay = React.forwardRef(function Overlay(\n { progress, onPress, style, ...props }: Props,\n ref: React.Ref<Animated.View>\n) {\n const animatedStyle = useAnimatedStyle(() => {\n return {\n opacity: progress.value,\n // We don't want the user to be able to press through the overlay when drawer is open\n // We can send the overlay behind the screen to avoid it\n zIndex: progress.value > PROGRESS_EPSILON ? 0 : -1,\n };\n });\n\n const animatedProps = useAnimatedProps(() => {\n const active = progress.value > PROGRESS_EPSILON;\n\n return {\n pointerEvents: active ? 'auto' : 'none',\n accessibilityElementsHidden: !active,\n importantForAccessibility: active ? 'auto' : 'no-hide-descendants',\n } as const;\n });\n\n return (\n <Animated.View\n {...props}\n ref={ref}\n style={[styles.overlay, overlayStyle, animatedStyle, style]}\n animatedProps={animatedProps}\n >\n <Pressable onPress={onPress} style={styles.pressable} />\n </Animated.View>\n );\n});\n\nconst overlayStyle = Platform.select<Record<string, string>>({\n web: {\n // Disable touch highlight on mobile Safari.\n // WebkitTapHighlightColor must be used outside of StyleSheet.create because react-native-web will omit the property.\n WebkitTapHighlightColor: 'transparent',\n },\n default: {},\n});\n\nconst styles = StyleSheet.create({\n overlay: {\n ...StyleSheet.absoluteFillObject,\n backgroundColor: 'rgba(0, 0, 0, 0.5)',\n },\n pressable: {\n flex: 1,\n },\n});\n\nexport default Overlay;\n"]}
@@ -22,4 +22,4 @@ export { default as useDrawerStatus } from './utils/useDrawerStatus';
22
22
  /**
23
23
  * Types
24
24
  */
25
- export type { DrawerContentComponentProps, DrawerHeaderProps, DrawerNavigationOptions, DrawerNavigationProp, DrawerScreenProps, } from './types';
25
+ export type { DrawerContentComponentProps, DrawerHeaderProps, DrawerNavigationEventMap, DrawerNavigationOptions, DrawerNavigationProp, DrawerScreenProps, } from './types';
@@ -1,5 +1,6 @@
1
+ import type { DrawerStatus } from '@react-navigation/native';
1
2
  /**
2
3
  * Hook to detect if the drawer's status in a parent navigator.
3
4
  * Returns 'open' if the drawer is open, 'closed' if the drawer is closed.
4
5
  */
5
- export default function useDrawerStatus(): import("packages/routers/lib/typescript/src").DrawerStatus;
6
+ export default function useDrawerStatus(): DrawerStatus;
@@ -1,6 +1,7 @@
1
1
  import * as React from 'react';
2
2
  import Animated from 'react-native-reanimated';
3
3
  declare const Overlay: React.ForwardRefExoticComponent<{
4
+ children?: React.ReactNode | Animated.Node<React.ReactNode>;
4
5
  hitSlop?: import("react-native").Insets | Animated.Node<import("react-native").Insets | undefined> | undefined;
5
6
  onLayout?: ((event: import("react-native").LayoutChangeEvent) => void) | Animated.Node<((event: import("react-native").LayoutChangeEvent) => void) | undefined> | undefined;
6
7
  pointerEvents?: "none" | "auto" | "box-none" | "box-only" | Animated.Node<"none" | "auto" | "box-none" | "box-only" | undefined> | undefined;
@@ -61,6 +62,9 @@ declare const Overlay: React.ForwardRefExoticComponent<{
61
62
  accessibilityIgnoresInvertColors?: boolean | Animated.Node<boolean | undefined> | undefined;
62
63
  } & {
63
64
  animatedProps?: Partial<Animated.AnimateProps<import("react-native").ViewProps>> | undefined;
65
+ layout?: import("react-native-reanimated").BaseAnimationBuilder | import("react-native-reanimated").LayoutAnimationFunction | typeof import("react-native-reanimated").BaseAnimationBuilder | undefined;
66
+ entering?: import("react-native-reanimated").BaseAnimationBuilder | typeof import("react-native-reanimated").BaseAnimationBuilder | import("react-native-reanimated").EntryExitAnimationFunction | import("react-native-reanimated").Keyframe | undefined;
67
+ exiting?: import("react-native-reanimated").BaseAnimationBuilder | typeof import("react-native-reanimated").BaseAnimationBuilder | import("react-native-reanimated").EntryExitAnimationFunction | import("react-native-reanimated").Keyframe | undefined;
64
68
  } & {
65
69
  progress: Animated.Node<number>;
66
70
  onPress: () => void;
@@ -1,6 +1,7 @@
1
1
  import * as React from 'react';
2
2
  import Animated from 'react-native-reanimated';
3
3
  declare const Overlay: React.ForwardRefExoticComponent<{
4
+ children?: React.ReactNode | Animated.Node<React.ReactNode>;
4
5
  hitSlop?: import("react-native").Insets | Animated.Node<import("react-native").Insets | undefined> | undefined;
5
6
  onLayout?: ((event: import("react-native").LayoutChangeEvent) => void) | Animated.Node<((event: import("react-native").LayoutChangeEvent) => void) | undefined> | undefined;
6
7
  pointerEvents?: "none" | "auto" | "box-none" | "box-only" | Animated.Node<"none" | "auto" | "box-none" | "box-only" | undefined> | undefined;
@@ -61,6 +62,9 @@ declare const Overlay: React.ForwardRefExoticComponent<{
61
62
  accessibilityIgnoresInvertColors?: boolean | Animated.Node<boolean | undefined> | undefined;
62
63
  } & {
63
64
  animatedProps?: Partial<Animated.AnimateProps<import("react-native").ViewProps>> | undefined;
65
+ layout?: import("react-native-reanimated").BaseAnimationBuilder | import("react-native-reanimated").LayoutAnimationFunction | typeof import("react-native-reanimated").BaseAnimationBuilder | undefined;
66
+ entering?: import("react-native-reanimated").BaseAnimationBuilder | typeof import("react-native-reanimated").BaseAnimationBuilder | import("react-native-reanimated").EntryExitAnimationFunction | import("react-native-reanimated").Keyframe | undefined;
67
+ exiting?: import("react-native-reanimated").BaseAnimationBuilder | typeof import("react-native-reanimated").BaseAnimationBuilder | import("react-native-reanimated").EntryExitAnimationFunction | import("react-native-reanimated").Keyframe | undefined;
64
68
  } & {
65
69
  progress: Animated.SharedValue<number>;
66
70
  onPress: () => void;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@react-navigation/drawer",
3
3
  "description": "Drawer navigator component with animated transitions and gesturess",
4
- "version": "6.1.8",
4
+ "version": "6.2.0",
5
5
  "keywords": [
6
6
  "react-native-component",
7
7
  "react-component",
@@ -41,23 +41,23 @@
41
41
  "clean": "del lib"
42
42
  },
43
43
  "dependencies": {
44
- "@react-navigation/elements": "^1.2.1",
44
+ "@react-navigation/elements": "^1.3.0",
45
45
  "color": "^3.1.3",
46
46
  "warn-once": "^0.1.0"
47
47
  },
48
48
  "devDependencies": {
49
- "@react-navigation/native": "^6.0.6",
49
+ "@react-navigation/native": "^6.0.7",
50
50
  "@testing-library/react-native": "^7.2.0",
51
51
  "@types/react": "^17.0.9",
52
52
  "@types/react-native": "~0.64.9",
53
53
  "del-cli": "^3.0.1",
54
- "react": "~16.13.1",
55
- "react-native": "~0.63.4",
54
+ "react": "17.0.1",
55
+ "react-native": "~0.64.3",
56
56
  "react-native-builder-bob": "^0.18.1",
57
- "react-native-gesture-handler": "~1.10.2",
58
- "react-native-reanimated": "~2.2.0",
59
- "react-native-safe-area-context": "~3.2.0",
60
- "react-native-screens": "~3.8.0",
57
+ "react-native-gesture-handler": "~2.1.0",
58
+ "react-native-reanimated": "~2.3.1",
59
+ "react-native-safe-area-context": "3.3.2",
60
+ "react-native-screens": "~3.10.1",
61
61
  "typescript": "^4.3.2"
62
62
  },
63
63
  "peerDependencies": {
@@ -83,5 +83,5 @@
83
83
  ]
84
84
  ]
85
85
  },
86
- "gitHead": "e77a5ab9d342a03cd8e20b54938700dfd4e23f42"
86
+ "gitHead": "4c5805867ce946d99ba17f71b4d6086bb8751262"
87
87
  }
package/src/index.tsx CHANGED
@@ -28,6 +28,7 @@ export { default as useDrawerStatus } from './utils/useDrawerStatus';
28
28
  export type {
29
29
  DrawerContentComponentProps,
30
30
  DrawerHeaderProps,
31
+ DrawerNavigationEventMap,
31
32
  DrawerNavigationOptions,
32
33
  DrawerNavigationProp,
33
34
  DrawerScreenProps,
@@ -1,7 +1,8 @@
1
1
  import type { DrawerStatus } from '@react-navigation/native';
2
2
  import * as React from 'react';
3
3
 
4
- const DrawerStatusContext =
5
- React.createContext<DrawerStatus | undefined>(undefined);
4
+ const DrawerStatusContext = React.createContext<DrawerStatus | undefined>(
5
+ undefined
6
+ );
6
7
 
7
8
  export default DrawerStatusContext;
@@ -1,3 +1,4 @@
1
+ import type { DrawerStatus } from '@react-navigation/native';
1
2
  import * as React from 'react';
2
3
 
3
4
  import DrawerStatusContext from './DrawerStatusContext';
@@ -6,7 +7,7 @@ import DrawerStatusContext from './DrawerStatusContext';
6
7
  * Hook to detect if the drawer's status in a parent navigator.
7
8
  * Returns 'open' if the drawer is open, 'closed' if the drawer is closed.
8
9
  */
9
- export default function useDrawerStatus() {
10
+ export default function useDrawerStatus(): DrawerStatus {
10
11
  const drawerStatus = React.useContext(DrawerStatusContext);
11
12
 
12
13
  if (drawerStatus === undefined) {
@@ -553,9 +553,14 @@ export default class DrawerView extends React.Component<DrawerProps> {
553
553
  <Animated.View
554
554
  style={[
555
555
  styles.content,
556
- drawerType !== 'permanent'
557
- ? { transform: [{ translateX: contentTranslateX }] }
558
- : undefined,
556
+ {
557
+ transform:
558
+ drawerType === 'permanent'
559
+ ? // Reanimated needs the property to be present, but it results in Browser bug
560
+ // https://bugs.chromium.org/p/chromium/issues/detail?id=20574
561
+ undefined
562
+ : [{ translateX: contentTranslateX }],
563
+ },
559
564
  ]}
560
565
  >
561
566
  <View
@@ -609,12 +614,15 @@ export default class DrawerView extends React.Component<DrawerProps> {
609
614
  onLayout={this.handleDrawerLayout}
610
615
  style={[
611
616
  styles.container,
612
- drawerType === 'permanent'
613
- ? { opacity: 1 }
614
- : {
615
- transform: [{ translateX: drawerTranslateX }],
616
- opacity: this.drawerOpacity,
617
- },
617
+ {
618
+ transform:
619
+ drawerType === 'permanent'
620
+ ? // Reanimated needs the property to be present, but it results in Browser bug
621
+ // https://bugs.chromium.org/p/chromium/issues/detail?id=20574
622
+ undefined
623
+ : [{ translateX: drawerTranslateX }],
624
+ opacity: this.drawerOpacity,
625
+ },
618
626
  drawerType === 'permanent'
619
627
  ? // Without this, the `left`/`right` values don't get reset
620
628
  isRight
@@ -3,6 +3,7 @@ import { Platform, Pressable, StyleSheet } from 'react-native';
3
3
  import Animated from 'react-native-reanimated';
4
4
 
5
5
  const {
6
+ // @ts-expect-error: this is to support reanimated 1
6
7
  interpolate: interpolateDeprecated,
7
8
  interpolateNode,
8
9
  cond,
@@ -260,35 +260,37 @@ export default function Drawer({
260
260
  });
261
261
 
262
262
  const drawerAnimatedStyle = useAnimatedStyle(() => {
263
- if (drawerType === 'permanent') {
264
- return {};
265
- }
266
-
267
263
  return {
268
- transform: [
269
- {
270
- translateX: drawerType === 'back' ? 0 : translateX.value,
271
- },
272
- ],
264
+ transform:
265
+ drawerType === 'permanent'
266
+ ? // Reanimated needs the property to be present, but it results in Browser bug
267
+ // https://bugs.chromium.org/p/chromium/issues/detail?id=20574
268
+ undefined
269
+ : [
270
+ {
271
+ translateX: drawerType === 'back' ? 0 : translateX.value,
272
+ },
273
+ ],
273
274
  };
274
275
  });
275
276
 
276
277
  const contentAnimatedStyle = useAnimatedStyle(() => {
277
- if (drawerType === 'permanent') {
278
- return {};
279
- }
280
-
281
278
  return {
282
- transform: [
283
- {
284
- translateX:
285
- drawerType === 'front'
286
- ? 0
287
- : drawerPosition === 'left'
288
- ? drawerWidth + translateX.value
289
- : translateX.value - drawerWidth,
290
- },
291
- ],
279
+ transform:
280
+ drawerType === 'permanent'
281
+ ? // Reanimated needs the property to be present, but it results in Browser bug
282
+ // https://bugs.chromium.org/p/chromium/issues/detail?id=20574
283
+ undefined
284
+ : [
285
+ {
286
+ translateX:
287
+ drawerType === 'front'
288
+ ? 0
289
+ : drawerPosition === 'left'
290
+ ? drawerWidth + translateX.value
291
+ : translateX.value - drawerWidth,
292
+ },
293
+ ],
292
294
  };
293
295
  });
294
296