@applicaster/quick-brick-core 13.0.0-rc.117 → 13.0.0-rc.118
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.
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { LayoutChangeEvent,
|
|
2
|
+
import { LayoutChangeEvent, StyleSheet, View } from "react-native";
|
|
3
3
|
|
|
4
4
|
import { Handle, HandleProps } from "./Handle";
|
|
5
5
|
import { DraggableBottomSheet } from "./DraggableBottomSheet";
|
|
@@ -7,7 +7,11 @@ import {
|
|
|
7
7
|
SafeAreaView,
|
|
8
8
|
useSafeAreaInsets,
|
|
9
9
|
} from "react-native-safe-area-context";
|
|
10
|
-
import {
|
|
10
|
+
import {
|
|
11
|
+
isAndroidPlatform,
|
|
12
|
+
isAndroidVersionAtLeast,
|
|
13
|
+
platformSelect,
|
|
14
|
+
} from "@applicaster/zapp-react-native-utils/reactUtils";
|
|
11
15
|
|
|
12
16
|
type Props = {
|
|
13
17
|
children: React.ReactChild;
|
|
@@ -37,6 +41,29 @@ const defaultBottomOffset = platformSelect({
|
|
|
37
41
|
android: 0,
|
|
38
42
|
});
|
|
39
43
|
|
|
44
|
+
const getSheetHeight = ({ height, bottomOffset, maxHeight, dimensions }) => {
|
|
45
|
+
return platformSelect({
|
|
46
|
+
ios: height - bottomOffset,
|
|
47
|
+
default:
|
|
48
|
+
!isAndroidVersionAtLeast(35) && isAndroidPlatform()
|
|
49
|
+
? (height || maxHeight) - (bottomOffset + dimensions.statusBarHeight)
|
|
50
|
+
: height || maxHeight,
|
|
51
|
+
});
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
const useGetSheetHeight = (height, maxHeight, dimensions) => {
|
|
55
|
+
const { bottom = defaultBottomOffset } = useSafeAreaInsets();
|
|
56
|
+
|
|
57
|
+
const bottomOffset = bottom;
|
|
58
|
+
|
|
59
|
+
return getSheetHeight({
|
|
60
|
+
height,
|
|
61
|
+
bottomOffset,
|
|
62
|
+
maxHeight,
|
|
63
|
+
dimensions,
|
|
64
|
+
});
|
|
65
|
+
};
|
|
66
|
+
|
|
40
67
|
export function ModalBottomSheetFrame(props: Props) {
|
|
41
68
|
const {
|
|
42
69
|
children,
|
|
@@ -69,19 +96,20 @@ export function ModalBottomSheetFrame(props: Props) {
|
|
|
69
96
|
|
|
70
97
|
const { bottom = defaultBottomOffset } = useSafeAreaInsets();
|
|
71
98
|
|
|
72
|
-
const bottomOffset = bottom
|
|
99
|
+
const bottomOffset = bottom;
|
|
100
|
+
|
|
101
|
+
const sheetHeight = useGetSheetHeight(height, maxHeight, dimensions);
|
|
73
102
|
|
|
74
103
|
return (
|
|
75
104
|
<DraggableBottomSheet
|
|
76
|
-
sheetHeight={
|
|
77
|
-
|
|
78
|
-
}
|
|
79
|
-
visible={visible}
|
|
105
|
+
sheetHeight={sheetHeight}
|
|
106
|
+
visible={height > 0 && visible}
|
|
80
107
|
dismiss={props.closeToast}
|
|
81
108
|
hasHeader={handleProps.enabled}
|
|
82
109
|
header={(dragging) => <Handle {...handleProps} focused={dragging} />}
|
|
83
110
|
maxWidth={maxWidth}
|
|
84
111
|
{...dimensions}
|
|
112
|
+
height={dimensions.height - bottomOffset}
|
|
85
113
|
>
|
|
86
114
|
<SafeAreaView
|
|
87
115
|
edges={["left", "right", "bottom"]}
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
/// <reference types="@applicaster/applicaster-types" />
|
|
2
2
|
import { useTheme } from "@applicaster/zapp-react-native-utils/theme";
|
|
3
|
-
import { platformSelect } from "@applicaster/zapp-react-native-utils/reactUtils";
|
|
4
|
-
import { useSafeAreaInsets } from "react-native-safe-area-context";
|
|
5
3
|
|
|
6
|
-
import React, { useEffect, useState } from "react";
|
|
7
|
-
import { Keyboard,
|
|
4
|
+
import React, { useCallback, useEffect, useState } from "react";
|
|
5
|
+
import { Keyboard, StyleSheet, View } from "react-native";
|
|
8
6
|
|
|
9
7
|
import { Overlay } from "./Overlay";
|
|
10
8
|
import { ModalBottomSheetFrame } from "./ModalBottomSheetFrame";
|
|
@@ -29,20 +27,11 @@ type Props = {
|
|
|
29
27
|
modalBottomSheetContentProps: Record<string, any>;
|
|
30
28
|
};
|
|
31
29
|
|
|
32
|
-
const defaultBottomOffset = platformSelect({
|
|
33
|
-
ios: 34,
|
|
34
|
-
android: 0,
|
|
35
|
-
});
|
|
36
|
-
|
|
37
30
|
export function ModalBottomSheet(props: Props) {
|
|
38
31
|
const theme = useTheme<BaseThemePropertiesMobile>();
|
|
39
32
|
const navigator = useNavigation();
|
|
40
33
|
const dimensions = useDimensions();
|
|
41
34
|
const [visible, setVisible] = useState(true);
|
|
42
|
-
const dismiss = () => setVisible(false);
|
|
43
|
-
const { bottom = defaultBottomOffset } = useSafeAreaInsets();
|
|
44
|
-
|
|
45
|
-
const bottomOffset = bottom;
|
|
46
35
|
|
|
47
36
|
const {
|
|
48
37
|
modal_bottom_sheet_background_color: sheetBackgroundColor,
|
|
@@ -65,6 +54,8 @@ export function ModalBottomSheet(props: Props) {
|
|
|
65
54
|
Keyboard.dismiss();
|
|
66
55
|
}, []);
|
|
67
56
|
|
|
57
|
+
const dismiss = useCallback(() => setVisible(false), []);
|
|
58
|
+
|
|
68
59
|
const isTablet = useIsTablet();
|
|
69
60
|
|
|
70
61
|
const maxWidth = isTablet ? sheetTabletMaxWidth : dimensions.width;
|
|
@@ -79,9 +70,7 @@ export function ModalBottomSheet(props: Props) {
|
|
|
79
70
|
<ModalBottomSheetFrame
|
|
80
71
|
backgroundColor={sheetBackgroundColor}
|
|
81
72
|
cornerRadius={sheetCornerRadius}
|
|
82
|
-
maxHeight={
|
|
83
|
-
Platform.OS === "ios" ? sheetMaxHeight + bottomOffset : sheetMaxHeight
|
|
84
|
-
}
|
|
73
|
+
maxHeight={sheetMaxHeight}
|
|
85
74
|
maxWidth={maxWidth}
|
|
86
75
|
dimensions={dimensions}
|
|
87
76
|
visible={visible}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@applicaster/quick-brick-core",
|
|
3
|
-
"version": "13.0.0-rc.
|
|
3
|
+
"version": "13.0.0-rc.118",
|
|
4
4
|
"description": "Core package for Applicaster's Quick Brick App",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
@@ -28,13 +28,13 @@
|
|
|
28
28
|
},
|
|
29
29
|
"homepage": "https://github.com/applicaster/quickbrick#readme",
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@applicaster/applicaster-types": "13.0.0-rc.
|
|
32
|
-
"@applicaster/quick-brick-core-plugins": "13.0.0-rc.
|
|
33
|
-
"@applicaster/zapp-pipes-v2-client": "13.0.0-rc.
|
|
34
|
-
"@applicaster/zapp-react-native-bridge": "13.0.0-rc.
|
|
35
|
-
"@applicaster/zapp-react-native-redux": "13.0.0-rc.
|
|
36
|
-
"@applicaster/zapp-react-native-ui-components": "13.0.0-rc.
|
|
37
|
-
"@applicaster/zapp-react-native-utils": "13.0.0-rc.
|
|
31
|
+
"@applicaster/applicaster-types": "13.0.0-rc.118",
|
|
32
|
+
"@applicaster/quick-brick-core-plugins": "13.0.0-rc.118",
|
|
33
|
+
"@applicaster/zapp-pipes-v2-client": "13.0.0-rc.118",
|
|
34
|
+
"@applicaster/zapp-react-native-bridge": "13.0.0-rc.118",
|
|
35
|
+
"@applicaster/zapp-react-native-redux": "13.0.0-rc.118",
|
|
36
|
+
"@applicaster/zapp-react-native-ui-components": "13.0.0-rc.118",
|
|
37
|
+
"@applicaster/zapp-react-native-utils": "13.0.0-rc.118",
|
|
38
38
|
"atob": "^2.1.2",
|
|
39
39
|
"axios": "^0.28.0",
|
|
40
40
|
"btoa": "^1.2.1",
|