@applicaster/quick-brick-core 13.0.0-alpha.5049772260 → 13.0.0-alpha.5131435627
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/App/ModalProvider/ModalBottomSheet/DraggableBottomSheet/index.tsx +0 -1
- package/App/ModalProvider/ModalBottomSheet/ModalBottomSheetFrame.tsx +20 -8
- package/App/ModalProvider/ModalBottomSheet/index.tsx +12 -28
- package/App/ModalProvider/ModalPresenter.tsx +1 -1
- package/App/ModalProvider/index.tsx +5 -1
- package/package.json +8 -8
|
@@ -300,7 +300,6 @@ export class DraggableBottomSheet extends Component<Props, ComponentState> {
|
|
|
300
300
|
simultaneousHandlers={this.drawer}
|
|
301
301
|
>
|
|
302
302
|
<Animated.ScrollView
|
|
303
|
-
style={{ marginBottom: this._snapPoints.top }}
|
|
304
303
|
bounces={false}
|
|
305
304
|
onScrollBeginDrag={this._onRegisterLastScroll}
|
|
306
305
|
scrollEventThrottle={1}
|
|
@@ -1,21 +1,20 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { StyleSheet, View } from "react-native";
|
|
2
|
+
import { LayoutChangeEvent, StyleSheet, View } from "react-native";
|
|
3
3
|
|
|
4
4
|
import { Handle, HandleProps } from "./Handle";
|
|
5
5
|
import { DraggableBottomSheet } from "./DraggableBottomSheet";
|
|
6
|
+
import { SafeAreaView } from "react-native-safe-area-context";
|
|
6
7
|
|
|
7
8
|
type Props = {
|
|
8
9
|
children: React.ReactChild;
|
|
9
10
|
backgroundColor: string;
|
|
10
11
|
cornerRadius: number;
|
|
11
|
-
contentHeight: number;
|
|
12
12
|
maxHeight: number;
|
|
13
13
|
maxWidth: number;
|
|
14
14
|
visible: boolean;
|
|
15
15
|
handleProps: HandleProps;
|
|
16
16
|
closeToast: () => void;
|
|
17
17
|
dimensions: { width: number; height: number };
|
|
18
|
-
paddingBottom: number;
|
|
19
18
|
};
|
|
20
19
|
|
|
21
20
|
const styles = StyleSheet.create({
|
|
@@ -34,9 +33,7 @@ export function ModalBottomSheetFrame(props: Props) {
|
|
|
34
33
|
maxWidth,
|
|
35
34
|
visible,
|
|
36
35
|
handleProps,
|
|
37
|
-
contentHeight,
|
|
38
36
|
dimensions,
|
|
39
|
-
paddingBottom,
|
|
40
37
|
} = props;
|
|
41
38
|
|
|
42
39
|
const extraStyles = {
|
|
@@ -44,13 +41,22 @@ export function ModalBottomSheetFrame(props: Props) {
|
|
|
44
41
|
borderTopLeftRadius: cornerRadius,
|
|
45
42
|
borderTopRightRadius: cornerRadius,
|
|
46
43
|
maxHeight,
|
|
47
|
-
paddingBottom,
|
|
48
44
|
maxWidth: Math.min(Number(maxWidth), dimensions.width),
|
|
49
45
|
};
|
|
50
46
|
|
|
47
|
+
const [height, setHeight] = React.useState(0);
|
|
48
|
+
|
|
49
|
+
const onLayout = (event: LayoutChangeEvent) => {
|
|
50
|
+
const { height } = event.nativeEvent.layout;
|
|
51
|
+
|
|
52
|
+
if (height !== 0) {
|
|
53
|
+
setHeight((oldHeight) => oldHeight || height);
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
|
|
51
57
|
return (
|
|
52
58
|
<DraggableBottomSheet
|
|
53
|
-
sheetHeight={
|
|
59
|
+
sheetHeight={height}
|
|
54
60
|
visible={visible}
|
|
55
61
|
dismiss={props.closeToast}
|
|
56
62
|
hasHeader={handleProps.enabled}
|
|
@@ -58,7 +64,13 @@ export function ModalBottomSheetFrame(props: Props) {
|
|
|
58
64
|
maxWidth={maxWidth}
|
|
59
65
|
{...dimensions}
|
|
60
66
|
>
|
|
61
|
-
<
|
|
67
|
+
<SafeAreaView
|
|
68
|
+
edges={["left", "right", "bottom"]}
|
|
69
|
+
style={[styles.toastFrameContainer, extraStyles]}
|
|
70
|
+
onLayout={onLayout}
|
|
71
|
+
>
|
|
72
|
+
<View>{children}</View>
|
|
73
|
+
</SafeAreaView>
|
|
62
74
|
</DraggableBottomSheet>
|
|
63
75
|
);
|
|
64
76
|
}
|
|
@@ -3,7 +3,7 @@ import { useTheme } from "@applicaster/zapp-react-native-utils/theme";
|
|
|
3
3
|
import { platformSelect } from "@applicaster/zapp-react-native-utils/reactUtils";
|
|
4
4
|
import { useSafeAreaInsets } from "react-native-safe-area-context";
|
|
5
5
|
|
|
6
|
-
import React, {
|
|
6
|
+
import React, { useEffect, useState } from "react";
|
|
7
7
|
import { Keyboard, StyleSheet, View } from "react-native";
|
|
8
8
|
|
|
9
9
|
import { Overlay } from "./Overlay";
|
|
@@ -38,12 +38,11 @@ export function ModalBottomSheet(props: Props) {
|
|
|
38
38
|
const theme = useTheme<BaseThemePropertiesMobile>();
|
|
39
39
|
const navigator = useNavigation();
|
|
40
40
|
const dimensions = useDimensions();
|
|
41
|
-
const [sheetHeight, setSheetHeight] = useState(0);
|
|
42
41
|
const [visible, setVisible] = useState(true);
|
|
43
42
|
const dismiss = () => setVisible(false);
|
|
44
43
|
const { bottom = defaultBottomOffset } = useSafeAreaInsets();
|
|
45
44
|
|
|
46
|
-
const bottomOffset = bottom
|
|
45
|
+
const bottomOffset = bottom;
|
|
47
46
|
|
|
48
47
|
const {
|
|
49
48
|
modal_bottom_sheet_background_color: sheetBackgroundColor,
|
|
@@ -61,14 +60,6 @@ export function ModalBottomSheet(props: Props) {
|
|
|
61
60
|
modalBottomSheetContentProps,
|
|
62
61
|
} = props;
|
|
63
62
|
|
|
64
|
-
const onLayout = useCallback(({ nativeEvent }) => {
|
|
65
|
-
const calculatedHeight = nativeEvent?.layout?.height;
|
|
66
|
-
|
|
67
|
-
if (calculatedHeight > 0 && sheetHeight === 0) {
|
|
68
|
-
setSheetHeight(Math.min(calculatedHeight, sheetMaxHeight));
|
|
69
|
-
}
|
|
70
|
-
}, []);
|
|
71
|
-
|
|
72
63
|
useEffect(() => {
|
|
73
64
|
Keyboard.dismiss();
|
|
74
65
|
}, []);
|
|
@@ -77,8 +68,6 @@ export function ModalBottomSheet(props: Props) {
|
|
|
77
68
|
|
|
78
69
|
const maxWidth = isTablet ? sheetTabletMaxWidth : dimensions.width;
|
|
79
70
|
|
|
80
|
-
const modalVisible = visible && sheetHeight > 0;
|
|
81
|
-
|
|
82
71
|
return (
|
|
83
72
|
<View style={styles.container}>
|
|
84
73
|
<Overlay
|
|
@@ -89,12 +78,10 @@ export function ModalBottomSheet(props: Props) {
|
|
|
89
78
|
<ModalBottomSheetFrame
|
|
90
79
|
backgroundColor={sheetBackgroundColor}
|
|
91
80
|
cornerRadius={sheetCornerRadius}
|
|
92
|
-
contentHeight={sheetHeight + bottomOffset}
|
|
93
81
|
maxHeight={sheetMaxHeight + bottomOffset}
|
|
94
|
-
paddingBottom={bottomOffset}
|
|
95
82
|
maxWidth={maxWidth}
|
|
96
83
|
dimensions={dimensions}
|
|
97
|
-
visible={
|
|
84
|
+
visible={visible}
|
|
98
85
|
closeToast={dismiss}
|
|
99
86
|
handleProps={{
|
|
100
87
|
enabled: sheetHandleEnabled,
|
|
@@ -102,18 +89,15 @@ export function ModalBottomSheet(props: Props) {
|
|
|
102
89
|
focusedColor: sheetHandleFocusedColor,
|
|
103
90
|
}}
|
|
104
91
|
>
|
|
105
|
-
<
|
|
106
|
-
|
|
107
|
-
width
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
currentRoute={navigator.currentRoute}
|
|
115
|
-
/>
|
|
116
|
-
</View>
|
|
92
|
+
<ModalBottomSheetContent
|
|
93
|
+
width={
|
|
94
|
+
Math.min(sheetTabletMaxWidth, dimensions.width) || dimensions.width
|
|
95
|
+
}
|
|
96
|
+
maxHeight={sheetMaxHeight}
|
|
97
|
+
{...modalBottomSheetContentProps}
|
|
98
|
+
dismiss={dismiss}
|
|
99
|
+
currentRoute={navigator.currentRoute}
|
|
100
|
+
/>
|
|
117
101
|
</ModalBottomSheetFrame>
|
|
118
102
|
</View>
|
|
119
103
|
);
|
|
@@ -40,7 +40,11 @@ export function ModalProvider() {
|
|
|
40
40
|
return (
|
|
41
41
|
<PathnameContext.Provider value={pathname}>
|
|
42
42
|
<ScreenContextProvider pathname={pathname}>
|
|
43
|
-
<ModalPresenter
|
|
43
|
+
<ModalPresenter
|
|
44
|
+
visible={shouldShowModal}
|
|
45
|
+
{...modalState?.options}
|
|
46
|
+
statusBarTranslucent
|
|
47
|
+
>
|
|
44
48
|
<ModalChildrenWrapper>
|
|
45
49
|
<ModalContent modalScreenProps={modalScreenProps} />
|
|
46
50
|
</ModalChildrenWrapper>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@applicaster/quick-brick-core",
|
|
3
|
-
"version": "13.0.0-alpha.
|
|
3
|
+
"version": "13.0.0-alpha.5131435627",
|
|
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-alpha.
|
|
32
|
-
"@applicaster/quick-brick-core-plugins": "13.0.0-alpha.
|
|
33
|
-
"@applicaster/zapp-pipes-v2-client": "13.0.0-alpha.
|
|
34
|
-
"@applicaster/zapp-react-native-bridge": "13.0.0-alpha.
|
|
35
|
-
"@applicaster/zapp-react-native-redux": "13.0.0-alpha.
|
|
36
|
-
"@applicaster/zapp-react-native-ui-components": "13.0.0-alpha.
|
|
37
|
-
"@applicaster/zapp-react-native-utils": "13.0.0-alpha.
|
|
31
|
+
"@applicaster/applicaster-types": "13.0.0-alpha.5131435627",
|
|
32
|
+
"@applicaster/quick-brick-core-plugins": "13.0.0-alpha.5131435627",
|
|
33
|
+
"@applicaster/zapp-pipes-v2-client": "13.0.0-alpha.5131435627",
|
|
34
|
+
"@applicaster/zapp-react-native-bridge": "13.0.0-alpha.5131435627",
|
|
35
|
+
"@applicaster/zapp-react-native-redux": "13.0.0-alpha.5131435627",
|
|
36
|
+
"@applicaster/zapp-react-native-ui-components": "13.0.0-alpha.5131435627",
|
|
37
|
+
"@applicaster/zapp-react-native-utils": "13.0.0-alpha.5131435627",
|
|
38
38
|
"atob": "^2.1.2",
|
|
39
39
|
"axios": "^0.28.0",
|
|
40
40
|
"btoa": "^1.2.1",
|