@applicaster/quick-brick-core 13.0.0-alpha.3013095924 → 13.0.0-alpha.3044917147

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.
@@ -56,6 +56,7 @@ export class DraggableBottomSheet extends Component<Props, ComponentState> {
56
56
  _translateYOffset: Animated.Value;
57
57
  _translateY: Animated.AnimatedAddition;
58
58
  _snapPoints: SnapPoints;
59
+ _prevContentHeight = 0;
59
60
 
60
61
  _callWhenMounted: () => void | null;
61
62
 
@@ -89,6 +90,14 @@ export class DraggableBottomSheet extends Component<Props, ComponentState> {
89
90
  this._lastScrollY
90
91
  );
91
92
 
93
+ const initialSnapPoints = new SnapPoints(props.height, props.sheetHeight);
94
+
95
+ this._translateYOffset = new Animated.Value(
96
+ props.visible ? initialSnapPoints.top : initialSnapPoints.bottom
97
+ );
98
+
99
+ this._prevContentHeight = initialSnapPoints.contentHeight;
100
+
92
101
  this.state = {
93
102
  lastSnap: props.height,
94
103
  dragging: false,
@@ -150,12 +159,25 @@ export class DraggableBottomSheet extends Component<Props, ComponentState> {
150
159
 
151
160
  if (!this._snapPoints) {
152
161
  this._snapPoints = new SnapPoints(windowHeight, totalSheetHeight);
162
+ this._prevContentHeight = totalSheetHeight;
153
163
  } else {
154
164
  this._snapPoints.windowHeight = windowHeight;
155
165
  this._snapPoints.contentHeight = totalSheetHeight;
156
- }
157
166
 
158
- this._translateYOffset = new Animated.Value(this._snapPoints.bottom);
167
+ if (this.props.visible && this._isMounted) {
168
+ Animated.timing(this._translateYOffset, {
169
+ toValue: this._snapPoints.top,
170
+ duration: ANIMATION_DURATION,
171
+ easing: ANIMATION_EASING,
172
+ delay: ANIMATION_DELAY,
173
+ useNativeDriver: USE_NATIVE_DRIVER,
174
+ }).start();
175
+ } else {
176
+ this._translateYOffset.setValue(this._snapPoints.top);
177
+ }
178
+
179
+ this._prevContentHeight = totalSheetHeight;
180
+ }
159
181
 
160
182
  this._translateY = Animated.add(
161
183
  this._translateYOffset,
@@ -254,6 +276,7 @@ export class DraggableBottomSheet extends Component<Props, ComponentState> {
254
276
  getDraggableAreaStyles() {
255
277
  return {
256
278
  width: this.props.maxWidth,
279
+ top: 0,
257
280
  left: (this.props.width - this.props.maxWidth) / 2 || 0,
258
281
  };
259
282
  }
@@ -1,10 +1,11 @@
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
6
  import {
7
7
  SafeAreaView,
8
+ useSafeAreaFrame,
8
9
  useSafeAreaInsets,
9
10
  } from "react-native-safe-area-context";
10
11
  import {
@@ -41,17 +42,16 @@ const defaultBottomOffset = platformSelect({
41
42
  android: 0,
42
43
  });
43
44
 
44
- const getSheetHeight = ({ height, bottomOffset, maxHeight, dimensions }) => {
45
+ const getSheetHeight = ({ height, bottomOffset, maxHeight }) => {
45
46
  return platformSelect({
46
47
  ios: height - bottomOffset,
47
48
  default:
48
- !isAndroidVersionAtLeast(35) && isAndroidPlatform()
49
- ? (height || maxHeight) - (bottomOffset + dimensions.statusBarHeight)
50
- : height || maxHeight,
49
+ (height || maxHeight) -
50
+ (!isAndroidVersionAtLeast(35) && isAndroidPlatform() ? bottomOffset : 0),
51
51
  });
52
52
  };
53
53
 
54
- const useGetSheetHeight = (height, maxHeight, dimensions) => {
54
+ const useGetSheetHeight = (height, maxHeight) => {
55
55
  const { bottom = defaultBottomOffset } = useSafeAreaInsets();
56
56
 
57
57
  const bottomOffset = bottom;
@@ -60,7 +60,6 @@ const useGetSheetHeight = (height, maxHeight, dimensions) => {
60
60
  height,
61
61
  bottomOffset,
62
62
  maxHeight,
63
- dimensions,
64
63
  });
65
64
  };
66
65
 
@@ -76,12 +75,14 @@ export function ModalBottomSheetFrame(props: Props) {
76
75
  dimensions,
77
76
  } = props;
78
77
 
78
+ const safeAreaDims = useSafeAreaFrame();
79
+
79
80
  const extraStyles = {
80
81
  backgroundColor,
81
82
  borderTopLeftRadius: cornerRadius,
82
83
  borderTopRightRadius: cornerRadius,
83
84
  maxHeight,
84
- maxWidth: Math.min(Number(maxWidth), dimensions.width),
85
+ maxWidth: Math.min(Number(maxWidth), safeAreaDims.width),
85
86
  };
86
87
 
87
88
  const [height, setHeight] = React.useState(0);
@@ -90,15 +91,13 @@ export function ModalBottomSheetFrame(props: Props) {
90
91
  const { height } = event.nativeEvent.layout;
91
92
 
92
93
  if (height !== 0) {
93
- setHeight((oldHeight) => oldHeight || height);
94
+ setHeight(height);
94
95
  }
95
96
  };
96
97
 
97
98
  const { bottom = defaultBottomOffset } = useSafeAreaInsets();
98
99
 
99
- const bottomOffset = bottom;
100
-
101
- const sheetHeight = useGetSheetHeight(height, maxHeight, dimensions);
100
+ const sheetHeight = useGetSheetHeight(height, maxHeight);
102
101
 
103
102
  return (
104
103
  <DraggableBottomSheet
@@ -109,7 +108,7 @@ export function ModalBottomSheetFrame(props: Props) {
109
108
  header={(dragging) => <Handle {...handleProps} focused={dragging} />}
110
109
  maxWidth={maxWidth}
111
110
  {...dimensions}
112
- height={dimensions.height - bottomOffset}
111
+ height={safeAreaDims.height - (Platform.OS === "ios" ? bottom : 0)}
113
112
  >
114
113
  <SafeAreaView
115
114
  edges={["left", "right", "bottom"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@applicaster/quick-brick-core",
3
- "version": "13.0.0-alpha.3013095924",
3
+ "version": "13.0.0-alpha.3044917147",
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.3013095924",
32
- "@applicaster/quick-brick-core-plugins": "13.0.0-alpha.3013095924",
33
- "@applicaster/zapp-pipes-v2-client": "13.0.0-alpha.3013095924",
34
- "@applicaster/zapp-react-native-bridge": "13.0.0-alpha.3013095924",
35
- "@applicaster/zapp-react-native-redux": "13.0.0-alpha.3013095924",
36
- "@applicaster/zapp-react-native-ui-components": "13.0.0-alpha.3013095924",
37
- "@applicaster/zapp-react-native-utils": "13.0.0-alpha.3013095924",
31
+ "@applicaster/applicaster-types": "13.0.0-alpha.3044917147",
32
+ "@applicaster/quick-brick-core-plugins": "13.0.0-alpha.3044917147",
33
+ "@applicaster/zapp-pipes-v2-client": "13.0.0-alpha.3044917147",
34
+ "@applicaster/zapp-react-native-bridge": "13.0.0-alpha.3044917147",
35
+ "@applicaster/zapp-react-native-redux": "13.0.0-alpha.3044917147",
36
+ "@applicaster/zapp-react-native-ui-components": "13.0.0-alpha.3044917147",
37
+ "@applicaster/zapp-react-native-utils": "13.0.0-alpha.3044917147",
38
38
  "atob": "^2.1.2",
39
39
  "axios": "^0.28.0",
40
40
  "btoa": "^1.2.1",
@@ -1 +0,0 @@
1
- export { Fragment as ModalChildrenWrapper } from "react";