@react-navigation/drawer 8.0.0-alpha.21 → 8.0.0-alpha.23

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.
@@ -2,46 +2,54 @@
2
2
 
3
3
  import { UNSTABLE_CornerInset, useLocale } from '@react-navigation/native';
4
4
  import * as React from 'react';
5
- import { ScrollView, StyleSheet } from 'react-native';
5
+ import { Platform, ScrollView, StyleSheet } from 'react-native';
6
6
  import { useSafeAreaInsets } from 'react-native-safe-area-context';
7
7
  import { DrawerPositionContext } from "../utils/DrawerPositionContext.js";
8
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
8
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
9
9
  const SPACING = 12;
10
- function DrawerContentScrollViewInner({
10
+ export function DrawerContentScrollView({
11
+ contentInsetAdjustmentBehavior = 'automatic',
11
12
  contentContainerStyle,
12
13
  style,
13
14
  children,
15
+ ref,
14
16
  ...rest
15
- }, ref) {
17
+ }) {
16
18
  const drawerPosition = React.use(DrawerPositionContext);
17
19
  const insets = useSafeAreaInsets();
18
20
  const {
19
21
  direction
20
22
  } = useLocale();
21
23
  const isRight = direction === 'rtl' ? drawerPosition === 'left' : drawerPosition === 'right';
22
- return /*#__PURE__*/_jsx(_Fragment, {
23
- children: /*#__PURE__*/_jsxs(ScrollView, {
24
- ...rest,
25
- ref: ref,
26
- contentContainerStyle: [{
27
- paddingBottom: SPACING + insets.bottom,
28
- paddingStart: SPACING + (!isRight ? insets.left : 0),
29
- paddingEnd: SPACING + (isRight ? insets.right : 0)
30
- }, contentContainerStyle],
31
- style: [styles.container, style],
32
- children: [/*#__PURE__*/_jsx(UNSTABLE_CornerInset, {
33
- direction: "vertical",
34
- edge: "top",
35
- style: {
36
- // We don't want to apply both safe area and corner insets
37
- minHeight: insets.top,
38
- marginBottom: SPACING
39
- }
40
- }), children]
41
- })
24
+ return /*#__PURE__*/_jsxs(ScrollView, {
25
+ ...rest,
26
+ ref: ref,
27
+ contentInsetAdjustmentBehavior: contentInsetAdjustmentBehavior,
28
+ contentContainerStyle: [{
29
+ paddingTop: SPACING + Platform.select({
30
+ ios: 0,
31
+ default: insets.top
32
+ }),
33
+ paddingBottom: SPACING + Platform.select({
34
+ ios: 0,
35
+ default: insets.bottom
36
+ }),
37
+ paddingStart: SPACING + (!isRight ? Platform.select({
38
+ ios: 0,
39
+ default: insets.left
40
+ }) : 0),
41
+ paddingEnd: SPACING + (isRight ? Platform.select({
42
+ ios: 0,
43
+ default: insets.right
44
+ }) : 0)
45
+ }, contentContainerStyle],
46
+ style: [styles.container, style],
47
+ children: [Platform.OS === 'ios' && contentInsetAdjustmentBehavior !== 'never' && /*#__PURE__*/_jsx(UNSTABLE_CornerInset, {
48
+ direction: "vertical",
49
+ edge: "top"
50
+ }), children]
42
51
  });
43
52
  }
44
- export const DrawerContentScrollView = /*#__PURE__*/React.forwardRef(DrawerContentScrollViewInner);
45
53
  const styles = StyleSheet.create({
46
54
  container: {
47
55
  flex: 1
@@ -1 +1 @@
1
- {"version":3,"names":["UNSTABLE_CornerInset","useLocale","React","ScrollView","StyleSheet","useSafeAreaInsets","DrawerPositionContext","jsx","_jsx","jsxs","_jsxs","Fragment","_Fragment","SPACING","DrawerContentScrollViewInner","contentContainerStyle","style","children","rest","ref","drawerPosition","use","insets","direction","isRight","paddingBottom","bottom","paddingStart","left","paddingEnd","right","styles","container","edge","minHeight","top","marginBottom","DrawerContentScrollView","forwardRef","create","flex"],"sourceRoot":"../../../src","sources":["views/DrawerContentScrollView.tsx"],"mappings":";;AAAA,SAASA,oBAAoB,EAAEC,SAAS,QAAQ,0BAA0B;AAC1E,OAAO,KAAKC,KAAK,MAAM,OAAO;AAC9B,SAASC,UAAU,EAAwBC,UAAU,QAAQ,cAAc;AAC3E,SAASC,iBAAiB,QAAQ,gCAAgC;AAElE,SAASC,qBAAqB,QAAQ,mCAAgC;AAAC,SAAAC,GAAA,IAAAC,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CAACoC,UAAU,CACrDxB,4BACF,CAAC;AAED,MAAMiB,MAAM,GAAG3B,UAAU,CAACmC,MAAM,CAAC;EAC/BP,SAAS,EAAE;IACTQ,IAAI,EAAE;EACR;AACF,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["UNSTABLE_CornerInset","useLocale","React","Platform","ScrollView","StyleSheet","useSafeAreaInsets","DrawerPositionContext","jsx","_jsx","jsxs","_jsxs","SPACING","DrawerContentScrollView","contentInsetAdjustmentBehavior","contentContainerStyle","style","children","ref","rest","drawerPosition","use","insets","direction","isRight","paddingTop","select","ios","default","top","paddingBottom","bottom","paddingStart","left","paddingEnd","right","styles","container","OS","edge","create","flex"],"sourceRoot":"../../../src","sources":["views/DrawerContentScrollView.tsx"],"mappings":";;AAAA,SAASA,oBAAoB,EAAEC,SAAS,QAAQ,0BAA0B;AAC1E,OAAO,KAAKC,KAAK,MAAM,OAAO;AAC9B,SACEC,QAAQ,EACRC,UAAU,EAEVC,UAAU,QACL,cAAc;AACrB,SAASC,iBAAiB,QAAQ,gCAAgC;AAElE,SAASC,qBAAqB,QAAQ,mCAAgC;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAOvE,MAAMC,OAAO,GAAG,EAAE;AAElB,OAAO,SAASC,uBAAuBA,CAAC;EACtCC,8BAA8B,GAAG,WAAW;EAC5CC,qBAAqB;EACrBC,KAAK;EACLC,QAAQ;EACRC,GAAG;EACH,GAAGC;AACE,CAAC,EAAE;EACR,MAAMC,cAAc,GAAGlB,KAAK,CAACmB,GAAG,CAACd,qBAAqB,CAAC;EACvD,MAAMe,MAAM,GAAGhB,iBAAiB,CAAC,CAAC;EAClC,MAAM;IAAEiB;EAAU,CAAC,GAAGtB,SAAS,CAAC,CAAC;EAEjC,MAAMuB,OAAO,GACXD,SAAS,KAAK,KAAK,GACfH,cAAc,KAAK,MAAM,GACzBA,cAAc,KAAK,OAAO;EAEhC,oBACET,KAAA,CAACP,UAAU;IAAA,GACLe,IAAI;IACRD,GAAG,EAAEA,GAAI;IACTJ,8BAA8B,EAAEA,8BAA+B;IAC/DC,qBAAqB,EAAE,CACrB;MACEU,UAAU,EACRb,OAAO,GAAGT,QAAQ,CAACuB,MAAM,CAAC;QAAEC,GAAG,EAAE,CAAC;QAAEC,OAAO,EAAEN,MAAM,CAACO;MAAI,CAAC,CAAC;MAC5DC,aAAa,EACXlB,OAAO,GAAGT,QAAQ,CAACuB,MAAM,CAAC;QAAEC,GAAG,EAAE,CAAC;QAAEC,OAAO,EAAEN,MAAM,CAACS;MAAO,CAAC,CAAC;MAC/DC,YAAY,EACVpB,OAAO,IACN,CAACY,OAAO,GAAGrB,QAAQ,CAACuB,MAAM,CAAC;QAAEC,GAAG,EAAE,CAAC;QAAEC,OAAO,EAAEN,MAAM,CAACW;MAAK,CAAC,CAAC,GAAG,CAAC,CAAC;MACpEC,UAAU,EACRtB,OAAO,IACNY,OAAO,GAAGrB,QAAQ,CAACuB,MAAM,CAAC;QAAEC,GAAG,EAAE,CAAC;QAAEC,OAAO,EAAEN,MAAM,CAACa;MAAM,CAAC,CAAC,GAAG,CAAC;IACrE,CAAC,EACDpB,qBAAqB,CACrB;IACFC,KAAK,EAAE,CAACoB,MAAM,CAACC,SAAS,EAAErB,KAAK,CAAE;IAAAC,QAAA,GAEhCd,QAAQ,CAACmC,EAAE,KAAK,KAAK,IAAIxB,8BAA8B,KAAK,OAAO,iBAClEL,IAAA,CAACT,oBAAoB;MAACuB,SAAS,EAAC,UAAU;MAACgB,IAAI,EAAC;IAAK,CAAE,CACxD,EACAtB,QAAQ;EAAA,CACC,CAAC;AAEjB;AAEA,MAAMmB,MAAM,GAAG/B,UAAU,CAACmC,MAAM,CAAC;EAC/BH,SAAS,EAAE;IACTI,IAAI,EAAE;EACR;AACF,CAAC,CAAC","ignoreList":[]}
@@ -1,6 +1,9 @@
1
1
  import * as React from 'react';
2
2
  import { ScrollView, type ScrollViewProps } from 'react-native';
3
- export declare const DrawerContentScrollView: React.ForwardRefExoticComponent<ScrollViewProps & {
3
+ type Props = ScrollViewProps & {
4
4
  children: React.ReactNode;
5
- } & React.RefAttributes<ScrollView>>;
5
+ ref?: React.Ref<ScrollView>;
6
+ };
7
+ export declare function DrawerContentScrollView({ contentInsetAdjustmentBehavior, contentContainerStyle, style, children, ref, ...rest }: Props): import("react/jsx-runtime").JSX.Element;
8
+ export {};
6
9
  //# sourceMappingURL=DrawerContentScrollView.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"DrawerContentScrollView.d.ts","sourceRoot":"","sources":["../../../../src/views/DrawerContentScrollView.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,UAAU,EAAE,KAAK,eAAe,EAAc,MAAM,cAAc,CAAC;AAsD5E,eAAO,MAAM,uBAAuB;cAhDxB,KAAK,CAAC,SAAS;oCAkD1B,CAAC"}
1
+ {"version":3,"file":"DrawerContentScrollView.d.ts","sourceRoot":"","sources":["../../../../src/views/DrawerContentScrollView.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAEL,UAAU,EACV,KAAK,eAAe,EAErB,MAAM,cAAc,CAAC;AAKtB,KAAK,KAAK,GAAG,eAAe,GAAG;IAC7B,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;CAC7B,CAAC;AAIF,wBAAgB,uBAAuB,CAAC,EACtC,8BAA4C,EAC5C,qBAAqB,EACrB,KAAK,EACL,QAAQ,EACR,GAAG,EACH,GAAG,IAAI,EACR,EAAE,KAAK,2CAsCP"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@react-navigation/drawer",
3
3
  "description": "Integration for the drawer component from react-native-drawer-layout",
4
- "version": "8.0.0-alpha.21",
4
+ "version": "8.0.0-alpha.23",
5
5
  "keywords": [
6
6
  "react-native-component",
7
7
  "react-component",
@@ -46,20 +46,20 @@
46
46
  "clean": "del lib"
47
47
  },
48
48
  "dependencies": {
49
- "@react-navigation/elements": "^3.0.0-alpha.19",
50
- "color": "^4.2.3",
51
- "react-native-drawer-layout": "^5.0.0-alpha.5",
52
- "use-latest-callback": "^0.3.2"
49
+ "@react-navigation/elements": "^3.0.0-alpha.21",
50
+ "color": "^5.0.3",
51
+ "react-native-drawer-layout": "^5.0.0-alpha.6",
52
+ "use-latest-callback": "^0.3.3"
53
53
  },
54
54
  "devDependencies": {
55
- "@jest/globals": "^30.0.0",
56
- "@react-navigation/native": "^8.0.0-alpha.17",
55
+ "@jest/globals": "^30.3.0",
56
+ "@react-navigation/native": "^8.0.0-alpha.18",
57
57
  "@testing-library/react-native": "^13.3.3",
58
58
  "@types/react": "~19.2.2",
59
- "del-cli": "^6.0.0",
59
+ "del-cli": "^7.0.0",
60
60
  "react": "19.2.0",
61
- "react-native": "0.83.2",
62
- "react-native-builder-bob": "^0.40.12",
61
+ "react-native": "0.83.4",
62
+ "react-native-builder-bob": "^0.41.0",
63
63
  "react-native-gesture-handler": "~2.30.0",
64
64
  "react-native-reanimated": "~4.2.1",
65
65
  "react-native-safe-area-context": "~5.6.2",
@@ -69,7 +69,7 @@
69
69
  "typescript": "^6.0.2"
70
70
  },
71
71
  "peerDependencies": {
72
- "@react-navigation/native": "^8.0.0-alpha.17",
72
+ "@react-navigation/native": "^8.0.0-alpha.18",
73
73
  "react": ">= 19.2.0",
74
74
  "react-native": "*",
75
75
  "react-native-gesture-handler": ">= 2.0.0",
@@ -96,5 +96,5 @@
96
96
  ]
97
97
  ]
98
98
  },
99
- "gitHead": "71f3b00d579a18e8a67d96722862deddc876a3f7"
99
+ "gitHead": "18da535b07fc86a30700efc4d824ef58271d2b8f"
100
100
  }
@@ -1,20 +1,30 @@
1
1
  import { UNSTABLE_CornerInset, useLocale } from '@react-navigation/native';
2
2
  import * as React from 'react';
3
- import { ScrollView, type ScrollViewProps, StyleSheet } from 'react-native';
3
+ import {
4
+ Platform,
5
+ ScrollView,
6
+ type ScrollViewProps,
7
+ StyleSheet,
8
+ } from 'react-native';
4
9
  import { useSafeAreaInsets } from 'react-native-safe-area-context';
5
10
 
6
11
  import { DrawerPositionContext } from '../utils/DrawerPositionContext';
7
12
 
8
13
  type Props = ScrollViewProps & {
9
14
  children: React.ReactNode;
15
+ ref?: React.Ref<ScrollView>;
10
16
  };
11
17
 
12
18
  const SPACING = 12;
13
19
 
14
- function DrawerContentScrollViewInner(
15
- { contentContainerStyle, style, children, ...rest }: Props,
16
- ref?: React.Ref<ScrollView>
17
- ) {
20
+ export function DrawerContentScrollView({
21
+ contentInsetAdjustmentBehavior = 'automatic',
22
+ contentContainerStyle,
23
+ style,
24
+ children,
25
+ ref,
26
+ ...rest
27
+ }: Props) {
18
28
  const drawerPosition = React.use(DrawerPositionContext);
19
29
  const insets = useSafeAreaInsets();
20
30
  const { direction } = useLocale();
@@ -25,39 +35,35 @@ function DrawerContentScrollViewInner(
25
35
  : drawerPosition === 'right';
26
36
 
27
37
  return (
28
- <>
29
- <ScrollView
30
- {...rest}
31
- ref={ref}
32
- contentContainerStyle={[
33
- {
34
- paddingBottom: SPACING + insets.bottom,
35
- paddingStart: SPACING + (!isRight ? insets.left : 0),
36
- paddingEnd: SPACING + (isRight ? insets.right : 0),
37
- },
38
- contentContainerStyle,
39
- ]}
40
- style={[styles.container, style]}
41
- >
42
- <UNSTABLE_CornerInset
43
- direction="vertical"
44
- edge="top"
45
- style={{
46
- // We don't want to apply both safe area and corner insets
47
- minHeight: insets.top,
48
- marginBottom: SPACING,
49
- }}
50
- />
51
- {children}
52
- </ScrollView>
53
- </>
38
+ <ScrollView
39
+ {...rest}
40
+ ref={ref}
41
+ contentInsetAdjustmentBehavior={contentInsetAdjustmentBehavior}
42
+ contentContainerStyle={[
43
+ {
44
+ paddingTop:
45
+ SPACING + Platform.select({ ios: 0, default: insets.top }),
46
+ paddingBottom:
47
+ SPACING + Platform.select({ ios: 0, default: insets.bottom }),
48
+ paddingStart:
49
+ SPACING +
50
+ (!isRight ? Platform.select({ ios: 0, default: insets.left }) : 0),
51
+ paddingEnd:
52
+ SPACING +
53
+ (isRight ? Platform.select({ ios: 0, default: insets.right }) : 0),
54
+ },
55
+ contentContainerStyle,
56
+ ]}
57
+ style={[styles.container, style]}
58
+ >
59
+ {Platform.OS === 'ios' && contentInsetAdjustmentBehavior !== 'never' && (
60
+ <UNSTABLE_CornerInset direction="vertical" edge="top" />
61
+ )}
62
+ {children}
63
+ </ScrollView>
54
64
  );
55
65
  }
56
66
 
57
- export const DrawerContentScrollView = React.forwardRef(
58
- DrawerContentScrollViewInner
59
- );
60
-
61
67
  const styles = StyleSheet.create({
62
68
  container: {
63
69
  flex: 1,