@bigbinary/neetoui-rn 3.1.3 → 3.1.5
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/lib/typescript/src/components/Alert/Alert.d.ts +1 -1
- package/lib/typescript/src/components/Alert/Alert.d.ts.map +1 -1
- package/lib/typescript/src/components/BottomSheetMenu/BottomSheetMenu.d.ts +2 -1
- package/lib/typescript/src/components/BottomSheetMenu/BottomSheetMenu.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/components/Alert/Alert.tsx +19 -2
- package/src/components/BottomSheetMenu/BottomSheetMenu.tsx +3 -0
|
@@ -7,7 +7,7 @@ export type AlertButton = {
|
|
|
7
7
|
export type AlertParams = {
|
|
8
8
|
title: string;
|
|
9
9
|
description?: string;
|
|
10
|
-
/** When true (default), backdrop tap
|
|
10
|
+
/** When true (default), backdrop tap, swipe-down and Android back dismiss the sheet. */
|
|
11
11
|
isCancelable?: boolean;
|
|
12
12
|
/**
|
|
13
13
|
* First button is the full-width primary action; the rest render as
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Alert.d.ts","sourceRoot":"","sources":["../../../../../src/components/Alert/Alert.tsx"],"names":[],"mappings":"AAWA,OAAO,EAAU,KAAK,WAAW,EAAE,MAAM,WAAW,CAAC;AAGrD,MAAM,MAAM,WAAW,GAAG;IACxB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,WAAW,CAAC,SAAS,CAAC,CAAC;IACjC,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACtB,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG;IACxB,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,
|
|
1
|
+
{"version":3,"file":"Alert.d.ts","sourceRoot":"","sources":["../../../../../src/components/Alert/Alert.tsx"],"names":[],"mappings":"AAWA,OAAO,EAAU,KAAK,WAAW,EAAE,MAAM,WAAW,CAAC;AAGrD,MAAM,MAAM,WAAW,GAAG;IACxB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,WAAW,CAAC,SAAS,CAAC,CAAC;IACjC,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACtB,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG;IACxB,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,wFAAwF;IACxF,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB;;;;OAIG;IACH,OAAO,CAAC,EAAE,WAAW,EAAE,CAAC;IACxB,kEAAkE;IAClE,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;CACxB,CAAC;AAQF;;;;;;GAMG;AACH,eAAO,MAAM,KAAK;;iBAsII,WAAW;CAHhC,CAAC"}
|
|
@@ -19,10 +19,11 @@ export type BottomSheetMenuProps = {
|
|
|
19
19
|
header?: ReactNode;
|
|
20
20
|
title?: string;
|
|
21
21
|
cancelLabel?: string;
|
|
22
|
+
maxHeightRatio?: number;
|
|
22
23
|
};
|
|
23
24
|
/**
|
|
24
25
|
* Action-menu sheet (promoted from neeto-commons-rn, 10 call sites).
|
|
25
26
|
* Same props; rows render as the sheet's footer content.
|
|
26
27
|
*/
|
|
27
|
-
export declare const BottomSheetMenu: ({ isVisible, onClose, items, onItemPress, header, title, cancelLabel, }: BottomSheetMenuProps) => import("react").JSX.Element;
|
|
28
|
+
export declare const BottomSheetMenu: ({ isVisible, onClose, items, onItemPress, header, title, cancelLabel, maxHeightRatio, }: BottomSheetMenuProps) => import("react").JSX.Element;
|
|
28
29
|
//# sourceMappingURL=BottomSheetMenu.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BottomSheetMenu.d.ts","sourceRoot":"","sources":["../../../../../src/components/BottomSheetMenu/BottomSheetMenu.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,aAAa,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO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F,MAAM,MAAM,oBAAoB,GAAG;IACjC,SAAS,EAAE,OAAO,CAAC;IACnB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,KAAK,EAAE,mBAAmB,EAAE,CAAC;IAC7B,WAAW,CAAC,EAAE,CAAC,IAAI,EAAE,mBAAmB,KAAK,IAAI,CAAC;IAClD,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,eAAe,GAAI,yFAS7B,oBAAoB,gCA8DtB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useCallback, useEffect, useRef, useState } from "react";
|
|
2
|
-
import { Pressable, View } from "react-native";
|
|
2
|
+
import { BackHandler, Pressable, View } from "react-native";
|
|
3
3
|
import {
|
|
4
4
|
BottomSheetBackdrop,
|
|
5
5
|
BottomSheetModal,
|
|
@@ -21,7 +21,7 @@ export type AlertButton = {
|
|
|
21
21
|
export type AlertParams = {
|
|
22
22
|
title: string;
|
|
23
23
|
description?: string;
|
|
24
|
-
/** When true (default), backdrop tap
|
|
24
|
+
/** When true (default), backdrop tap, swipe-down and Android back dismiss the sheet. */
|
|
25
25
|
isCancelable?: boolean;
|
|
26
26
|
/**
|
|
27
27
|
* First button is the full-width primary action; the rest render as
|
|
@@ -88,6 +88,23 @@ export const Alert = () => {
|
|
|
88
88
|
}
|
|
89
89
|
}, [isVisible]);
|
|
90
90
|
|
|
91
|
+
// gorhom leaves Android back alone, so without this the press falls
|
|
92
|
+
// through to the navigator and pops the screen underneath the sheet.
|
|
93
|
+
useEffect(() => {
|
|
94
|
+
if (!isVisible) return undefined;
|
|
95
|
+
|
|
96
|
+
const subscription = BackHandler.addEventListener(
|
|
97
|
+
"hardwareBackPress",
|
|
98
|
+
() => {
|
|
99
|
+
if (isCancelable) setIsVisible(false);
|
|
100
|
+
|
|
101
|
+
return true;
|
|
102
|
+
}
|
|
103
|
+
);
|
|
104
|
+
|
|
105
|
+
return () => subscription.remove();
|
|
106
|
+
}, [isVisible, isCancelable]);
|
|
107
|
+
|
|
91
108
|
const hide = () => setIsVisible(false);
|
|
92
109
|
|
|
93
110
|
// Fires for every close path — button press, backdrop tap, swipe down and
|
|
@@ -24,6 +24,7 @@ export type BottomSheetMenuProps = {
|
|
|
24
24
|
header?: ReactNode;
|
|
25
25
|
title?: string;
|
|
26
26
|
cancelLabel?: string;
|
|
27
|
+
maxHeightRatio?: number;
|
|
27
28
|
};
|
|
28
29
|
|
|
29
30
|
/**
|
|
@@ -38,6 +39,7 @@ export const BottomSheetMenu = ({
|
|
|
38
39
|
header,
|
|
39
40
|
title,
|
|
40
41
|
cancelLabel = "Cancel",
|
|
42
|
+
maxHeightRatio,
|
|
41
43
|
}: BottomSheetMenuProps) => {
|
|
42
44
|
const { theme } = useUnistyles();
|
|
43
45
|
|
|
@@ -46,6 +48,7 @@ export const BottomSheetMenu = ({
|
|
|
46
48
|
data={[]}
|
|
47
49
|
hide={onClose}
|
|
48
50
|
isVisible={isVisible}
|
|
51
|
+
maxHeightRatio={maxHeightRatio}
|
|
49
52
|
shouldShowItemSeparator={false}
|
|
50
53
|
style={styles.sheetContent}
|
|
51
54
|
onBackdropPress={onClose}
|