@applicaster/quick-brick-core 13.0.0-alpha.2886020207 → 13.0.0-alpha.3003916059

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