@applicaster/quick-brick-core 13.0.0-alpha.1244047241 → 13.0.0-alpha.1290120403

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.
@@ -3,15 +3,7 @@ import { LayoutChangeEvent, StyleSheet, View } from "react-native";
3
3
 
4
4
  import { Handle, HandleProps } from "./Handle";
5
5
  import { DraggableBottomSheet } from "./DraggableBottomSheet";
6
- import {
7
- SafeAreaView,
8
- useSafeAreaInsets,
9
- } from "react-native-safe-area-context";
10
- import {
11
- isAndroidPlatform,
12
- isAndroidVersionAtLeast,
13
- platformSelect,
14
- } from "@applicaster/zapp-react-native-utils/reactUtils";
6
+ import { SafeAreaView } from "react-native-safe-area-context";
15
7
 
16
8
  type Props = {
17
9
  children: React.ReactChild;
@@ -22,11 +14,7 @@ type Props = {
22
14
  visible: boolean;
23
15
  handleProps: HandleProps;
24
16
  closeToast: () => void;
25
- dimensions: {
26
- statusBarHeight: any;
27
- width: number;
28
- height: number;
29
- };
17
+ dimensions: { width: number; height: number };
30
18
  };
31
19
 
32
20
  const styles = StyleSheet.create({
@@ -36,34 +24,6 @@ const styles = StyleSheet.create({
36
24
  },
37
25
  });
38
26
 
39
- const defaultBottomOffset = platformSelect({
40
- ios: 34,
41
- android: 0,
42
- });
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
-
67
27
  export function ModalBottomSheetFrame(props: Props) {
68
28
  const {
69
29
  children,
@@ -94,28 +54,22 @@ export function ModalBottomSheetFrame(props: Props) {
94
54
  }
95
55
  };
96
56
 
97
- const { bottom = defaultBottomOffset } = useSafeAreaInsets();
98
-
99
- const bottomOffset = bottom;
100
-
101
- const sheetHeight = useGetSheetHeight(height, maxHeight, dimensions);
102
-
103
57
  return (
104
58
  <DraggableBottomSheet
105
- sheetHeight={sheetHeight}
106
- visible={height > 0 && visible}
59
+ sheetHeight={height}
60
+ visible={visible}
107
61
  dismiss={props.closeToast}
108
62
  hasHeader={handleProps.enabled}
109
63
  header={(dragging) => <Handle {...handleProps} focused={dragging} />}
110
64
  maxWidth={maxWidth}
111
65
  {...dimensions}
112
- height={dimensions.height - bottomOffset}
113
66
  >
114
67
  <SafeAreaView
115
68
  edges={["left", "right", "bottom"]}
116
69
  style={[styles.toastFrameContainer, extraStyles]}
70
+ onLayout={onLayout}
117
71
  >
118
- <View onLayout={onLayout}>{children}</View>
72
+ <View>{children}</View>
119
73
  </SafeAreaView>
120
74
  </DraggableBottomSheet>
121
75
  );
@@ -1,7 +1,9 @@
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";
3
5
 
4
- import React, { useCallback, useEffect, useState } from "react";
6
+ import React, { useEffect, useState } from "react";
5
7
  import { Keyboard, StyleSheet, View } from "react-native";
6
8
 
7
9
  import { Overlay } from "./Overlay";
@@ -27,11 +29,20 @@ type Props = {
27
29
  modalBottomSheetContentProps: Record<string, any>;
28
30
  };
29
31
 
32
+ const defaultBottomOffset = platformSelect({
33
+ ios: 34,
34
+ android: 0,
35
+ });
36
+
30
37
  export function ModalBottomSheet(props: Props) {
31
38
  const theme = useTheme<BaseThemePropertiesMobile>();
32
39
  const navigator = useNavigation();
33
40
  const dimensions = useDimensions();
34
41
  const [visible, setVisible] = useState(true);
42
+ const dismiss = () => setVisible(false);
43
+ const { bottom = defaultBottomOffset } = useSafeAreaInsets();
44
+
45
+ const bottomOffset = bottom;
35
46
 
36
47
  const {
37
48
  modal_bottom_sheet_background_color: sheetBackgroundColor,
@@ -54,8 +65,6 @@ export function ModalBottomSheet(props: Props) {
54
65
  Keyboard.dismiss();
55
66
  }, []);
56
67
 
57
- const dismiss = useCallback(() => setVisible(false), []);
58
-
59
68
  const isTablet = useIsTablet();
60
69
 
61
70
  const maxWidth = isTablet ? sheetTabletMaxWidth : dimensions.width;
@@ -70,7 +79,7 @@ export function ModalBottomSheet(props: Props) {
70
79
  <ModalBottomSheetFrame
71
80
  backgroundColor={sheetBackgroundColor}
72
81
  cornerRadius={sheetCornerRadius}
73
- maxHeight={sheetMaxHeight}
82
+ maxHeight={sheetMaxHeight + bottomOffset}
74
83
  maxWidth={maxWidth}
75
84
  dimensions={dimensions}
76
85
  visible={visible}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@applicaster/quick-brick-core",
3
- "version": "13.0.0-alpha.1244047241",
3
+ "version": "13.0.0-alpha.1290120403",
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.1244047241",
32
- "@applicaster/quick-brick-core-plugins": "13.0.0-alpha.1244047241",
33
- "@applicaster/zapp-pipes-v2-client": "13.0.0-alpha.1244047241",
34
- "@applicaster/zapp-react-native-bridge": "13.0.0-alpha.1244047241",
35
- "@applicaster/zapp-react-native-redux": "13.0.0-alpha.1244047241",
36
- "@applicaster/zapp-react-native-ui-components": "13.0.0-alpha.1244047241",
37
- "@applicaster/zapp-react-native-utils": "13.0.0-alpha.1244047241",
31
+ "@applicaster/applicaster-types": "13.0.0-alpha.1290120403",
32
+ "@applicaster/quick-brick-core-plugins": "13.0.0-alpha.1290120403",
33
+ "@applicaster/zapp-pipes-v2-client": "13.0.0-alpha.1290120403",
34
+ "@applicaster/zapp-react-native-bridge": "13.0.0-alpha.1290120403",
35
+ "@applicaster/zapp-react-native-redux": "13.0.0-alpha.1290120403",
36
+ "@applicaster/zapp-react-native-ui-components": "13.0.0-alpha.1290120403",
37
+ "@applicaster/zapp-react-native-utils": "13.0.0-alpha.1290120403",
38
38
  "atob": "^2.1.2",
39
39
  "axios": "^0.28.0",
40
40
  "btoa": "^1.2.1",