@momo-kits/foundation 0.92.25 → 0.92.26-beta.0

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,10 +1,4 @@
1
- import React, {
2
- useCallback,
3
- useContext,
4
- useEffect,
5
- useRef,
6
- useState,
7
- } from 'react';
1
+ import React, {useCallback, useContext, useEffect, useRef} from 'react';
8
2
  import {
9
3
  Animated,
10
4
  Dimensions,
@@ -25,7 +19,7 @@ import {Icon} from '../Icon';
25
19
 
26
20
  const BottomSheet: React.FC<BottomSheetParams> = props => {
27
21
  const {theme, navigator} = useContext(ApplicationContext);
28
- const [show, setShow] = useState(true);
22
+ const closed = useRef(false);
29
23
  const heightDevice = Dimensions.get('screen').height;
30
24
  const insets = useSafeAreaInsets();
31
25
  const {
@@ -81,10 +75,12 @@ const BottomSheet: React.FC<BottomSheetParams> = props => {
81
75
  Animated.timing(pan, {
82
76
  toValue: {x: 0, y: 0},
83
77
  useNativeDriver: false,
84
- duration: 150,
78
+ duration: 200,
85
79
  }).start();
86
80
  return () => {
87
- setShow(false);
81
+ if (!closed.current) {
82
+ navigator?.pop();
83
+ }
88
84
  props.route.params?.onDismiss?.();
89
85
  };
90
86
  }, []);
@@ -96,16 +92,16 @@ const BottomSheet: React.FC<BottomSheetParams> = props => {
96
92
  if (barrierDismissible && !force) {
97
93
  return;
98
94
  }
95
+ closed.current = true;
99
96
  setTimeout(() => {
97
+ navigator?.pop();
100
98
  callback?.();
101
- }, 350);
99
+ }, 300);
102
100
  Animated.timing(pan, {
103
101
  toValue: {x: 0, y: heightDevice},
104
102
  useNativeDriver: false,
105
- duration: 150,
106
- }).start(() => {
107
- navigator?.pop();
108
- });
103
+ duration: 200,
104
+ }).start();
109
105
  };
110
106
 
111
107
  /**
@@ -156,7 +152,7 @@ const BottomSheet: React.FC<BottomSheetParams> = props => {
156
152
  }, []);
157
153
 
158
154
  return (
159
- <Modal transparent visible={show} onRequestClose={() => onDismiss()}>
155
+ <Modal transparent visible={true} onRequestClose={() => onDismiss()}>
160
156
  <KeyboardAvoidingView
161
157
  behavior={Platform.OS === 'ios' ? 'padding' : 'height'}
162
158
  keyboardVerticalOffset={keyboardVerticalOffset ?? -20}
@@ -172,7 +168,7 @@ const BottomSheet: React.FC<BottomSheetParams> = props => {
172
168
  <Screen
173
169
  {...props}
174
170
  {...props.route.params}
175
- requestClose={requestClose}
171
+ // requestClose={requestClose}
176
172
  />
177
173
  {useBottomInset && (
178
174
  <View style={{height: Math.min(insets.bottom, 21)}} />
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@momo-kits/foundation",
3
- "version": "0.92.25",
3
+ "version": "0.92.26-beta.0",
4
4
  "description": "React Native Component Kits",
5
5
  "main": "index.ts",
6
6
  "scripts": {},
@@ -43,4 +43,4 @@
43
43
  },
44
44
  "author": "@momo-kits/foundation",
45
45
  "license": "ISC"
46
- }
46
+ }
package/publish.sh CHANGED
@@ -7,16 +7,16 @@ rsync -r --exclude=/dist ./* dist
7
7
  cd dist
8
8
 
9
9
  if [ "$1" == "stable" ]; then
10
- npm version $(npm view @momo-kits/foundation@stable version)
11
- npm version patch
10
+ #npm version $(npm view @momo-kits/foundation@stable version)
11
+ #npm version patch
12
12
  npm publish --tag stable --access=public
13
13
  elif [ "$1" == "latest" ]; then
14
- npm version $(npm view @momo-kits/foundation@latest version)
15
- npm version prerelease --preid=rc
14
+ #npm version $(npm view @momo-kits/foundation@latest version)
15
+ #npm version prerelease --preid=rc
16
16
  npm publish --tag latest --access=public
17
17
  else
18
- npm version $(npm view @momo-kits/foundation@beta version)
19
- npm version prerelease --preid=beta
18
+ #npm version $(npm view @momo-kits/foundation@beta version)
19
+ #npm version prerelease --preid=beta
20
20
  npm publish --tag beta --access=public
21
21
  fi
22
22