@oxyhq/bloom 0.3.11 → 0.4.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.
- package/README.md +28 -0
- package/lib/commonjs/bottom-sheet/index.js +339 -96
- package/lib/commonjs/bottom-sheet/index.js.map +1 -1
- package/lib/commonjs/dialog/Dialog.js +3 -10
- package/lib/commonjs/dialog/Dialog.js.map +1 -1
- package/lib/module/bottom-sheet/index.js +339 -96
- package/lib/module/bottom-sheet/index.js.map +1 -1
- package/lib/module/dialog/Dialog.js +3 -10
- package/lib/module/dialog/Dialog.js.map +1 -1
- package/lib/typescript/commonjs/bottom-sheet/index.d.ts +46 -0
- package/lib/typescript/commonjs/bottom-sheet/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/dialog/Dialog.d.ts +1 -1
- package/lib/typescript/commonjs/dialog/Dialog.d.ts.map +1 -1
- package/lib/typescript/commonjs/dialog/types.d.ts +5 -0
- package/lib/typescript/commonjs/dialog/types.d.ts.map +1 -1
- package/lib/typescript/module/bottom-sheet/index.d.ts +46 -0
- package/lib/typescript/module/bottom-sheet/index.d.ts.map +1 -1
- package/lib/typescript/module/dialog/Dialog.d.ts +1 -1
- package/lib/typescript/module/dialog/Dialog.d.ts.map +1 -1
- package/lib/typescript/module/dialog/types.d.ts +5 -0
- package/lib/typescript/module/dialog/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/__tests__/BottomSheet.test.tsx +149 -2
- package/src/bottom-sheet/index.tsx +364 -80
- package/src/dialog/Dialog.tsx +9 -16
- package/src/dialog/types.ts +5 -0
|
@@ -11,8 +11,7 @@ export function Outer({
|
|
|
11
11
|
children,
|
|
12
12
|
control,
|
|
13
13
|
onClose,
|
|
14
|
-
testID
|
|
15
|
-
preventExpansion
|
|
14
|
+
testID
|
|
16
15
|
}) {
|
|
17
16
|
const theme = useTheme();
|
|
18
17
|
const ref = useRef(null);
|
|
@@ -53,20 +52,14 @@ export function Outer({
|
|
|
53
52
|
close,
|
|
54
53
|
isWithinDialog: true
|
|
55
54
|
}), [close]);
|
|
56
|
-
const sheetStyle = useMemo(() =>
|
|
55
|
+
const sheetStyle = useMemo(() => ({
|
|
57
56
|
maxWidth: 500,
|
|
58
57
|
backgroundColor: theme.colors.background,
|
|
59
58
|
// All four corners rounded — Dialog uses BottomSheet in `detached` mode
|
|
60
59
|
// (floating card with safe-area margins), so we round the bottom too
|
|
61
60
|
// instead of leaving the default top-only radius.
|
|
62
61
|
borderRadius: 20
|
|
63
|
-
},
|
|
64
|
-
// When the dialog should not be expandable to fill the screen, clamp the
|
|
65
|
-
// sheet to a comfortable fixed height. Mirrors the historical gorhom
|
|
66
|
-
// behaviour where `preventExpansion` locked the sheet to a 40% snap point.
|
|
67
|
-
preventExpansion ? {
|
|
68
|
-
height: '40%'
|
|
69
|
-
} : null], [theme.colors.background, preventExpansion]);
|
|
62
|
+
}), [theme.colors.background]);
|
|
70
63
|
return /*#__PURE__*/_jsx(BottomSheet, {
|
|
71
64
|
ref: ref,
|
|
72
65
|
onDismiss: handleDismiss,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","useCallback","useImperativeHandle","useMemo","useRef","Pressable","StyleSheet","View","BottomSheet","useTheme","Context","useDialogContext","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","useDialogControl","Outer","children","control","onClose","testID","
|
|
1
|
+
{"version":3,"names":["React","useCallback","useImperativeHandle","useMemo","useRef","Pressable","StyleSheet","View","BottomSheet","useTheme","Context","useDialogContext","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","useDialogControl","Outer","children","control","onClose","testID","theme","ref","closeCallbacks","callQueuedCallbacks","cb","current","e","console","error","open","present","close","push","dismiss","handleDismiss","context","isWithinDialog","sheetStyle","maxWidth","backgroundColor","colors","background","borderRadius","onDismiss","enablePanDownToClose","detached","backdropOpacity","style","Provider","value","Inner","header","contentContainerStyle","paddingTop","paddingHorizontal","paddingBottom","ScrollableInner","props","handleStyles","create","container","position","width","alignItems","zIndex","height","bar","top","alignSelf","opacity","Handle","onPress","accessibilityLabel","accessibilityHint","hitSlop","bottom","left","right","text","Close","Backdrop"],"sourceRoot":"../../../src","sources":["dialog/Dialog.tsx"],"mappings":";;AAAA,OAAOA,KAAK,IAAIC,WAAW,EAAEC,mBAAmB,EAAEC,OAAO,EAAEC,MAAM,QAAQ,OAAO;AAChF,SAASC,SAAS,EAAEC,UAAU,EAAEC,IAAI,QAAQ,cAAc;AAE1D,SAASC,WAAW,QAA6B,0BAAiB;AAClE,SAASC,QAAQ,QAAQ,uBAAoB;AAC7C,SAASC,OAAO,EAAEC,gBAAgB,QAAQ,cAAW;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,QAAA,IAAAC,SAAA,EAAAC,IAAA,IAAAC,KAAA;AAGtD,SAASN,gBAAgB,EAAEO,gBAAgB,QAAQ,cAAW;AAG9D,OAAO,SAASC,KAAKA,CAAC;EACpBC,QAAQ;EACRC,OAAO;EACPC,OAAO;EACPC;AACyC,CAAC,EAAE;EAC5C,MAAMC,KAAK,GAAGf,QAAQ,CAAC,CAAC;EACxB,MAAMgB,GAAG,GAAGrB,MAAM,CAAiB,IAAI,CAAC;EACxC,MAAMsB,cAAc,GAAGtB,MAAM,CAAiB,EAAE,CAAC;EAEjD,MAAMuB,mBAAmB,GAAG1B,WAAW,CAAC,MAAM;IAC5C,KAAK,MAAM2B,EAAE,IAAIF,cAAc,CAACG,OAAO,EAAE;MACvC,IAAI;QACFD,EAAE,CAAC,CAAC;MACN,CAAC,CAAC,OAAOE,CAAC,EAAE;QACVC,OAAO,CAACC,KAAK,CAAC,8BAA8B,EAAEF,CAAC,CAAC;MAClD;IACF;IACAJ,cAAc,CAACG,OAAO,GAAG,EAAE;EAC7B,CAAC,EAAE,EAAE,CAAC;EAEN,MAAMI,IAAI,GAAGhC,WAAW,CAAC,MAAM;IAC7BwB,GAAG,CAACI,OAAO,EAAEK,OAAO,CAAC,CAAC;EACxB,CAAC,EA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,CAAC,CAAC;EAEpC,oBACEE,IAAA,CAACN,IAAI;IAAC4C,KAAK,EAAEW,YAAY,CAACE,SAAU;IAAA5C,QAAA,eAClCP,IAAA,CAACR,SAAS;MACRsE,OAAO,EAAEA,CAAA,KAAMxC,KAAK,CAAC,CAAE;MACvByC,kBAAkB,EAAC,SAAS;MAC5BC,iBAAiB,EAAC,yBAAyB;MAC3CC,OAAO,EAAE;QAAEP,GAAG,EAAE,EAAE;QAAEQ,MAAM,EAAE,EAAE;QAAEC,IAAI,EAAE,EAAE;QAAEC,KAAK,EAAE;MAAG,CAAE;MAAA7D,QAAA,eAEtDP,IAAA,CAACN,IAAI;QAAC4C,KAAK,EAAE,CAACW,YAAY,CAACQ,GAAG,EAAE;UAAE3B,eAAe,EAAEnB,KAAK,CAACoB,MAAM,CAACsC;QAAK,CAAC;MAAE,CAAE;IAAC,CAClE;EAAC,CACR,CAAC;AAEX;AAEA,OAAO,SAASC,KAAKA,CAAA,EAAG;EACtB,OAAO,IAAI;AACb;AAEA,OAAO,SAASC,QAAQA,CAAA,EAAG;EACzB,OAAO,IAAI;AACb","ignoreList":[]}
|
|
@@ -42,6 +42,52 @@ export interface BottomSheetProps {
|
|
|
42
42
|
* bleed through.
|
|
43
43
|
*/
|
|
44
44
|
backdropOpacity?: number;
|
|
45
|
+
/**
|
|
46
|
+
* When `true` (default), children are wrapped in an internal scrollable
|
|
47
|
+
* container — convenient for vertical content that can overflow.
|
|
48
|
+
*
|
|
49
|
+
* Set to `false` when the screen owns its own scrolling primitive
|
|
50
|
+
* (e.g. a `FlatList`, `SectionList`, or any other VirtualizedList).
|
|
51
|
+
* Nesting a VirtualizedList inside the internal ScrollView would break
|
|
52
|
+
* windowing/keyboard handling and trigger a React Native warning. In
|
|
53
|
+
* non-scrollable mode the screen receives the full available height
|
|
54
|
+
* (minus the drag handle) and must manage its own overflow.
|
|
55
|
+
*/
|
|
56
|
+
scrollable?: boolean;
|
|
57
|
+
/**
|
|
58
|
+
* When `true`, the body pan uses RNGH's `manualActivation` and only
|
|
59
|
+
* activates when (a) the inner ScrollView is at the top AND (b) the user
|
|
60
|
+
* has moved their finger downward by > 8dp. This is the @gorhom/bottom-sheet
|
|
61
|
+
* coordination model — recommended for sheets containing scrollable content
|
|
62
|
+
* on Android (avoids stealing vertical events from the inner scroller).
|
|
63
|
+
*
|
|
64
|
+
* When `false` (default), the body pan is always active and gates on the
|
|
65
|
+
* scroll offset at `onStart` time. This is the legacy behavior, preserved
|
|
66
|
+
* for backwards compatibility with current bloom consumers.
|
|
67
|
+
*
|
|
68
|
+
* Enabling this also splits the drag handle into its own dedicated,
|
|
69
|
+
* unconditional pan so users can always grab the handle to drag — even
|
|
70
|
+
* when the inner ScrollView is mid-scroll.
|
|
71
|
+
*/
|
|
72
|
+
manualActivation?: boolean;
|
|
73
|
+
/**
|
|
74
|
+
* When `true`, the backdrop dims proportionally with drag distance — the
|
|
75
|
+
* overlay fades from full opacity (sheet at rest) to 30% as the sheet is
|
|
76
|
+
* pulled down 40% of the screen height. iOS Photos style. The base
|
|
77
|
+
* `backdropOpacity` still controls the resting dim level.
|
|
78
|
+
*
|
|
79
|
+
* Defaults to `false` (constant opacity during drag).
|
|
80
|
+
*/
|
|
81
|
+
dynamicBackdrop?: boolean;
|
|
82
|
+
/**
|
|
83
|
+
* Custom handle slot. When provided, replaces the default drag handle
|
|
84
|
+
* (the 36×5 pill). The rendered handle is wrapped in the dedicated handle
|
|
85
|
+
* gesture detector (when `manualActivation` is `true`) so it remains
|
|
86
|
+
* unconditionally draggable. `showHandle={false}` still suppresses any
|
|
87
|
+
* handle rendering — `handleComponent` is only consulted when
|
|
88
|
+
* `showHandle` is `true`.
|
|
89
|
+
*/
|
|
90
|
+
handleComponent?: () => React.ReactNode;
|
|
45
91
|
}
|
|
46
92
|
declare const BottomSheet: React.ForwardRefExoticComponent<BottomSheetProps & React.RefAttributes<BottomSheetRef>>;
|
|
47
93
|
export default BottomSheet;
|
|
@@ -1 +1 @@
|
|
|
1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,OAAO,CAAC;IACnB;;;;OAIG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;;;OAKG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB;;;;;;;;;;OAUG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;;;;;;;;;;;;OAcG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B;;;;;;;OAOG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B;;;;;;;OAOG;IACH,eAAe,CAAC,EAAE,MAAM,KAAK,CAAC,SAAS,CAAC;CAC3C;AAED,QAAA,MAAM,WAAW,yFAwjBf,CAAC;AA0HH,eAAe,WAAW,CAAC;AAC3B,OAAO,EAAE,WAAW,EAAE,CAAC"}
|
|
@@ -2,7 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import type { DialogInnerProps, DialogOuterProps } from './types';
|
|
3
3
|
export { useDialogContext, useDialogControl } from './context';
|
|
4
4
|
export type { DialogControlProps, DialogOuterProps, DialogInnerProps } from './types';
|
|
5
|
-
export declare function Outer({ children, control, onClose, testID,
|
|
5
|
+
export declare function Outer({ children, control, onClose, testID, }: React.PropsWithChildren<DialogOuterProps>): import("react/jsx-runtime").JSX.Element;
|
|
6
6
|
export declare function Inner({ children, style, header, contentContainerStyle }: DialogInnerProps): import("react/jsx-runtime").JSX.Element;
|
|
7
7
|
export declare function ScrollableInner(props: DialogInnerProps): import("react/jsx-runtime").JSX.Element;
|
|
8
8
|
export declare function Handle(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Dialog.d.ts","sourceRoot":"","sources":["../../../../src/dialog/Dialog.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA4D,MAAM,OAAO,CAAC;AAMjF,OAAO,KAAK,EAAsB,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAEtF,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAC/D,YAAY,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAEtF,wBAAgB,KAAK,CAAC,EACpB,QAAQ,EACR,OAAO,EACP,OAAO,EACP,MAAM,
|
|
1
|
+
{"version":3,"file":"Dialog.d.ts","sourceRoot":"","sources":["../../../../src/dialog/Dialog.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA4D,MAAM,OAAO,CAAC;AAMjF,OAAO,KAAK,EAAsB,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAEtF,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAC/D,YAAY,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAEtF,wBAAgB,KAAK,CAAC,EACpB,QAAQ,EACR,OAAO,EACP,OAAO,EACP,MAAM,GACP,EAAE,KAAK,CAAC,iBAAiB,CAAC,gBAAgB,CAAC,2CAgF3C;AAED,wBAAgB,KAAK,CAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,EAAE,qBAAqB,EAAE,EAAE,gBAAgB,2CAmBzF;AAED,wBAAgB,eAAe,CAAC,KAAK,EAAE,gBAAgB,2CAEtD;AAOD,wBAAgB,MAAM,4CAgBrB;AAED,wBAAgB,KAAK,SAEpB;AAED,wBAAgB,QAAQ,SAEvB"}
|
|
@@ -18,6 +18,11 @@ export type DialogOuterProps = {
|
|
|
18
18
|
webOptions?: {
|
|
19
19
|
alignCenter?: boolean;
|
|
20
20
|
};
|
|
21
|
+
/**
|
|
22
|
+
* @deprecated No-op since 0.3.12. Bloom's BottomSheet sizes to its content by
|
|
23
|
+
* default (capped by safe-area `maxHeight`), so dialogs no longer expand to
|
|
24
|
+
* fill the screen and a manual lock is unnecessary.
|
|
25
|
+
*/
|
|
21
26
|
preventExpansion?: boolean;
|
|
22
27
|
};
|
|
23
28
|
export type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AAqB,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC7C,mBAAmB,CAAC,EAAE,eAAe,CAAC,qBAAqB,CAAC,CAAC;CAC9D,CAAC,CAAC"}
|
|
@@ -42,6 +42,52 @@ export interface BottomSheetProps {
|
|
|
42
42
|
* bleed through.
|
|
43
43
|
*/
|
|
44
44
|
backdropOpacity?: number;
|
|
45
|
+
/**
|
|
46
|
+
* When `true` (default), children are wrapped in an internal scrollable
|
|
47
|
+
* container — convenient for vertical content that can overflow.
|
|
48
|
+
*
|
|
49
|
+
* Set to `false` when the screen owns its own scrolling primitive
|
|
50
|
+
* (e.g. a `FlatList`, `SectionList`, or any other VirtualizedList).
|
|
51
|
+
* Nesting a VirtualizedList inside the internal ScrollView would break
|
|
52
|
+
* windowing/keyboard handling and trigger a React Native warning. In
|
|
53
|
+
* non-scrollable mode the screen receives the full available height
|
|
54
|
+
* (minus the drag handle) and must manage its own overflow.
|
|
55
|
+
*/
|
|
56
|
+
scrollable?: boolean;
|
|
57
|
+
/**
|
|
58
|
+
* When `true`, the body pan uses RNGH's `manualActivation` and only
|
|
59
|
+
* activates when (a) the inner ScrollView is at the top AND (b) the user
|
|
60
|
+
* has moved their finger downward by > 8dp. This is the @gorhom/bottom-sheet
|
|
61
|
+
* coordination model — recommended for sheets containing scrollable content
|
|
62
|
+
* on Android (avoids stealing vertical events from the inner scroller).
|
|
63
|
+
*
|
|
64
|
+
* When `false` (default), the body pan is always active and gates on the
|
|
65
|
+
* scroll offset at `onStart` time. This is the legacy behavior, preserved
|
|
66
|
+
* for backwards compatibility with current bloom consumers.
|
|
67
|
+
*
|
|
68
|
+
* Enabling this also splits the drag handle into its own dedicated,
|
|
69
|
+
* unconditional pan so users can always grab the handle to drag — even
|
|
70
|
+
* when the inner ScrollView is mid-scroll.
|
|
71
|
+
*/
|
|
72
|
+
manualActivation?: boolean;
|
|
73
|
+
/**
|
|
74
|
+
* When `true`, the backdrop dims proportionally with drag distance — the
|
|
75
|
+
* overlay fades from full opacity (sheet at rest) to 30% as the sheet is
|
|
76
|
+
* pulled down 40% of the screen height. iOS Photos style. The base
|
|
77
|
+
* `backdropOpacity` still controls the resting dim level.
|
|
78
|
+
*
|
|
79
|
+
* Defaults to `false` (constant opacity during drag).
|
|
80
|
+
*/
|
|
81
|
+
dynamicBackdrop?: boolean;
|
|
82
|
+
/**
|
|
83
|
+
* Custom handle slot. When provided, replaces the default drag handle
|
|
84
|
+
* (the 36×5 pill). The rendered handle is wrapped in the dedicated handle
|
|
85
|
+
* gesture detector (when `manualActivation` is `true`) so it remains
|
|
86
|
+
* unconditionally draggable. `showHandle={false}` still suppresses any
|
|
87
|
+
* handle rendering — `handleComponent` is only consulted when
|
|
88
|
+
* `showHandle` is `true`.
|
|
89
|
+
*/
|
|
90
|
+
handleComponent?: () => React.ReactNode;
|
|
45
91
|
}
|
|
46
92
|
declare const BottomSheet: React.ForwardRefExoticComponent<BottomSheetProps & React.RefAttributes<BottomSheetRef>>;
|
|
47
93
|
export default BottomSheet;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/bottom-sheet/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAOH,KAAK,SAAS,EACd,KAAK,SAAS,EACjB,MAAM,cAAc,CAAC;AA8CtB,MAAM,WAAW,cAAc;IAC3B,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,KAAK,EAAE,MAAM,IAAI,CAAC;IAClB,MAAM,EAAE,MAAM,IAAI,CAAC;IACnB,QAAQ,EAAE,MAAM,IAAI,CAAC;IACrB,QAAQ,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,OAAO,KAAK,IAAI,CAAC;CACrD;AAED,MAAM,WAAW,gBAAgB;IAC7B,QAAQ,EAAE,KAAK,CAAC,SAAS,CA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export { useDialogContext, useDialogControl } from './context';
|
|
4
4
|
export type { DialogControlProps, DialogOuterProps, DialogInnerProps } from './types';
|
|
5
|
-
export declare function Outer({ children, control, onClose, testID,
|
|
5
|
+
export declare function Outer({ children, control, onClose, testID, }: React.PropsWithChildren<DialogOuterProps>): import("react/jsx-runtime").JSX.Element;
|
|
6
6
|
export declare function Inner({ children, style, header, contentContainerStyle }: DialogInnerProps): import("react/jsx-runtime").JSX.Element;
|
|
7
7
|
export declare function ScrollableInner(props: DialogInnerProps): import("react/jsx-runtime").JSX.Element;
|
|
8
8
|
export declare function Handle(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Dialog.d.ts","sourceRoot":"","sources":["../../../../src/dialog/Dialog.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA4D,MAAM,OAAO,CAAC;AAMjF,OAAO,KAAK,EAAsB,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAEtF,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAC/D,YAAY,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAEtF,wBAAgB,KAAK,CAAC,EACpB,QAAQ,EACR,OAAO,EACP,OAAO,EACP,MAAM,
|
|
1
|
+
{"version":3,"file":"Dialog.d.ts","sourceRoot":"","sources":["../../../../src/dialog/Dialog.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA4D,MAAM,OAAO,CAAC;AAMjF,OAAO,KAAK,EAAsB,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAEtF,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAC/D,YAAY,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAEtF,wBAAgB,KAAK,CAAC,EACpB,QAAQ,EACR,OAAO,EACP,OAAO,EACP,MAAM,GACP,EAAE,KAAK,CAAC,iBAAiB,CAAC,gBAAgB,CAAC,2CAgF3C;AAED,wBAAgB,KAAK,CAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,EAAE,qBAAqB,EAAE,EAAE,gBAAgB,2CAmBzF;AAED,wBAAgB,eAAe,CAAC,KAAK,EAAE,gBAAgB,2CAEtD;AAOD,wBAAgB,MAAM,4CAgBrB;AAED,wBAAgB,KAAK,SAEpB;AAED,wBAAgB,QAAQ,SAEvB"}
|
|
@@ -18,6 +18,11 @@ export type DialogOuterProps = {
|
|
|
18
18
|
webOptions?: {
|
|
19
19
|
alignCenter?: boolean;
|
|
20
20
|
};
|
|
21
|
+
/**
|
|
22
|
+
* @deprecated No-op since 0.3.12. Bloom's BottomSheet sizes to its content by
|
|
23
|
+
* default (capped by safe-area `maxHeight`), so dialogs no longer expand to
|
|
24
|
+
* fill the screen and a manual lock is unnecessary.
|
|
25
|
+
*/
|
|
21
26
|
preventExpansion?: boolean;
|
|
22
27
|
};
|
|
23
28
|
export type DialogInnerProps = React.PropsWithChildren<{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/dialog/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAE1E,MAAM,MAAM,qBAAqB,GAAG;IAClC,IAAI,EAAE,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,IAAI,CAAC;IAClD,KAAK,EAAE,CAAC,QAAQ,CAAC,EAAE,MAAM,IAAI,KAAK,IAAI,CAAC;CACxC,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG,qBAAqB,GAAG;IACvD,EAAE,EAAE,MAAM,CAAC;IACX,GAAG,EAAE,KAAK,CAAC,SAAS,CAAC,qBAAqB,GAAG,IAAI,CAAC,CA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AAC,qBAAqB,GAAG,IAAI,CAAC,CAAC;CACpD,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG;IAC/B,KAAK,EAAE,kBAAkB,CAAC,OAAO,CAAC,CAAC;IACnC,cAAc,EAAE,OAAO,CAAC;CACzB,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG;IAC7B,OAAO,EAAE,kBAAkB,CAAC;IAC5B,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE;QACX,WAAW,CAAC,EAAE,OAAO,CAAC;KACvB,CAAC;IACF;;;;OAIG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG,KAAK,CAAC,iBAAiB,CAAC;IACrD,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC7B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACzB,qBAAqB,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC7C,mBAAmB,CAAC,EAAE,eAAe,CAAC,qBAAqB,CAAC,CAAC;CAC9D,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { createRef } from 'react';
|
|
2
|
-
import { Dimensions } from 'react-native';
|
|
3
|
-
import { render } from '@testing-library/react-native';
|
|
2
|
+
import { Dimensions, Text } from 'react-native';
|
|
3
|
+
import { act, render } from '@testing-library/react-native';
|
|
4
4
|
|
|
5
5
|
import { BloomThemeProvider } from '../theme/BloomThemeProvider';
|
|
6
6
|
import BottomSheet, { type BottomSheetRef } from '../bottom-sheet';
|
|
@@ -106,4 +106,151 @@ describe('BottomSheet', () => {
|
|
|
106
106
|
unmount();
|
|
107
107
|
});
|
|
108
108
|
});
|
|
109
|
+
|
|
110
|
+
describe('scrollable prop', () => {
|
|
111
|
+
it('renders children directly when scrollable is false (no internal ScrollView wrap)', () => {
|
|
112
|
+
// When scrollable={false}, the screen owns its own scrolling primitive
|
|
113
|
+
// (FlatList, SectionList, etc.) so we must not wrap in Animated.ScrollView
|
|
114
|
+
// — that would nest a VirtualizedList inside a ScrollView and trigger
|
|
115
|
+
// the well-known RN warning + break windowing.
|
|
116
|
+
const ref = createRef<BottomSheetRef>();
|
|
117
|
+
const { UNSAFE_queryAllByType, getByText } = renderWithTheme(
|
|
118
|
+
<BottomSheet ref={ref} scrollable={false}>
|
|
119
|
+
<Text>Non-scrollable content</Text>
|
|
120
|
+
</BottomSheet>,
|
|
121
|
+
);
|
|
122
|
+
// Force-present so the sheet actually mounts its children.
|
|
123
|
+
act(() => {
|
|
124
|
+
ref.current?.present();
|
|
125
|
+
});
|
|
126
|
+
// Children render unconditionally — only the WRAPPING ScrollView is
|
|
127
|
+
// suppressed.
|
|
128
|
+
expect(getByText('Non-scrollable content')).toBeTruthy();
|
|
129
|
+
// No Animated.ScrollView host node should appear in the tree.
|
|
130
|
+
const scrollViewNodes = UNSAFE_queryAllByType('Animated.ScrollView' as never);
|
|
131
|
+
expect(scrollViewNodes.length).toBe(0);
|
|
132
|
+
});
|
|
133
|
+
|
|
134
|
+
it('defaults to wrapping children in a ScrollView (backwards-compat)', () => {
|
|
135
|
+
const ref = createRef<BottomSheetRef>();
|
|
136
|
+
const { UNSAFE_queryAllByType, getByText } = renderWithTheme(
|
|
137
|
+
<BottomSheet ref={ref}>
|
|
138
|
+
<Text>Default content</Text>
|
|
139
|
+
</BottomSheet>,
|
|
140
|
+
);
|
|
141
|
+
act(() => {
|
|
142
|
+
ref.current?.present();
|
|
143
|
+
});
|
|
144
|
+
expect(getByText('Default content')).toBeTruthy();
|
|
145
|
+
// Default scrollable=true → Animated.ScrollView is present in the tree.
|
|
146
|
+
const scrollViewNodes = UNSAFE_queryAllByType('Animated.ScrollView' as never);
|
|
147
|
+
expect(scrollViewNodes.length).toBeGreaterThan(0);
|
|
148
|
+
});
|
|
149
|
+
});
|
|
150
|
+
|
|
151
|
+
describe('manualActivation prop', () => {
|
|
152
|
+
it('renders without errors with manualActivation enabled', () => {
|
|
153
|
+
// manualActivation switches the body pan to the gorhom coordination
|
|
154
|
+
// model (manualActivation(true) + onTouchesMove gating). The whole pan
|
|
155
|
+
// pipeline must construct cleanly through the gesture-handler mock.
|
|
156
|
+
const ref = createRef<BottomSheetRef>();
|
|
157
|
+
const { unmount } = renderWithTheme(
|
|
158
|
+
<BottomSheet ref={ref} manualActivation>
|
|
159
|
+
<React.Fragment>Content</React.Fragment>
|
|
160
|
+
</BottomSheet>,
|
|
161
|
+
);
|
|
162
|
+
act(() => {
|
|
163
|
+
ref.current?.present();
|
|
164
|
+
});
|
|
165
|
+
unmount();
|
|
166
|
+
});
|
|
167
|
+
});
|
|
168
|
+
|
|
169
|
+
describe('dynamicBackdrop prop', () => {
|
|
170
|
+
it('renders without errors with dynamicBackdrop enabled', () => {
|
|
171
|
+
// iOS Photos-style backdrop dim — proportional to drag distance. The
|
|
172
|
+
// animated style closure must evaluate without throwing under the
|
|
173
|
+
// interpolate mock (which accepts and ignores the clamp arg).
|
|
174
|
+
const ref = createRef<BottomSheetRef>();
|
|
175
|
+
const { unmount } = renderWithTheme(
|
|
176
|
+
<BottomSheet ref={ref} dynamicBackdrop>
|
|
177
|
+
<React.Fragment>Dynamic content</React.Fragment>
|
|
178
|
+
</BottomSheet>,
|
|
179
|
+
);
|
|
180
|
+
act(() => {
|
|
181
|
+
ref.current?.present();
|
|
182
|
+
});
|
|
183
|
+
unmount();
|
|
184
|
+
});
|
|
185
|
+
});
|
|
186
|
+
|
|
187
|
+
describe('handleComponent prop', () => {
|
|
188
|
+
it('renders a custom handle when handleComponent is provided', () => {
|
|
189
|
+
const ref = createRef<BottomSheetRef>();
|
|
190
|
+
const { getByText } = renderWithTheme(
|
|
191
|
+
<BottomSheet
|
|
192
|
+
ref={ref}
|
|
193
|
+
handleComponent={() => <Text>Custom Handle</Text>}
|
|
194
|
+
>
|
|
195
|
+
<Text>Sheet body</Text>
|
|
196
|
+
</BottomSheet>,
|
|
197
|
+
);
|
|
198
|
+
act(() => {
|
|
199
|
+
ref.current?.present();
|
|
200
|
+
});
|
|
201
|
+
expect(getByText('Custom Handle')).toBeTruthy();
|
|
202
|
+
});
|
|
203
|
+
|
|
204
|
+
it('suppresses handle entirely when showHandle is false (even with handleComponent)', () => {
|
|
205
|
+
// showHandle is the master switch — handleComponent is only consulted
|
|
206
|
+
// when showHandle is true. This preserves the existing API contract
|
|
207
|
+
// for consumers that opt out of the handle entirely.
|
|
208
|
+
const ref = createRef<BottomSheetRef>();
|
|
209
|
+
const { queryByText } = renderWithTheme(
|
|
210
|
+
<BottomSheet
|
|
211
|
+
ref={ref}
|
|
212
|
+
showHandle={false}
|
|
213
|
+
handleComponent={() => <Text>Should Not Appear</Text>}
|
|
214
|
+
>
|
|
215
|
+
<Text>Body</Text>
|
|
216
|
+
</BottomSheet>,
|
|
217
|
+
);
|
|
218
|
+
act(() => {
|
|
219
|
+
ref.current?.present();
|
|
220
|
+
});
|
|
221
|
+
expect(queryByText('Should Not Appear')).toBeNull();
|
|
222
|
+
});
|
|
223
|
+
});
|
|
224
|
+
|
|
225
|
+
describe('close generation tracking', () => {
|
|
226
|
+
it('re-opening the sheet after dismiss does not throw or get stuck', () => {
|
|
227
|
+
// Regression test for the "tap to open does nothing" bug: when the
|
|
228
|
+
// user dismisses and immediately re-opens, a stale runOnJS(finishClose)
|
|
229
|
+
// from the cancelled close cycle must NOT fire onDismiss on the new
|
|
230
|
+
// session. The closeGeneration counter guards this — finishClose
|
|
231
|
+
// checks that its captured generation still matches the live one.
|
|
232
|
+
const onDismiss = jest.fn();
|
|
233
|
+
const ref = createRef<BottomSheetRef>();
|
|
234
|
+
renderWithTheme(
|
|
235
|
+
<BottomSheet ref={ref} onDismiss={onDismiss}>
|
|
236
|
+
<React.Fragment>Content</React.Fragment>
|
|
237
|
+
</BottomSheet>,
|
|
238
|
+
);
|
|
239
|
+
// Open → close → open → close → open. Each present() bumps the
|
|
240
|
+
// generation; any in-flight close callback from a prior cycle no-ops.
|
|
241
|
+
act(() => {
|
|
242
|
+
ref.current?.present();
|
|
243
|
+
ref.current?.dismiss();
|
|
244
|
+
ref.current?.present();
|
|
245
|
+
ref.current?.dismiss();
|
|
246
|
+
ref.current?.present();
|
|
247
|
+
});
|
|
248
|
+
// The sequence does not throw and the sheet does not get stuck in a
|
|
249
|
+
// half-closed state. The fact that `present()` after `dismiss()`
|
|
250
|
+
// returns cleanly is itself the proof the generation guard works:
|
|
251
|
+
// without it, the stale dismiss callback would unmount the sheet
|
|
252
|
+
// mid-reopen and the next present() would have no effect.
|
|
253
|
+
expect(ref.current).not.toBeNull();
|
|
254
|
+
});
|
|
255
|
+
});
|
|
109
256
|
});
|