@momo-kits/foundation 0.111.1-beta.13 → 0.111.1-beta.15
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.
|
@@ -18,12 +18,16 @@ import {BottomSheetParams} from './types';
|
|
|
18
18
|
import {Colors, Radius, Spacing, Styles} from '../Consts';
|
|
19
19
|
import {Text} from '../Text';
|
|
20
20
|
import {Icon} from '../Icon';
|
|
21
|
+
import {useHeaderHeight} from '@react-navigation/stack';
|
|
21
22
|
|
|
22
23
|
const BottomSheet: React.FC<BottomSheetParams> = props => {
|
|
23
24
|
const {theme, navigator} = useContext(ApplicationContext);
|
|
24
25
|
const heightDevice = Dimensions.get('screen').height;
|
|
25
26
|
const action = useRef<undefined | string>();
|
|
26
27
|
const insets = useSafeAreaInsets();
|
|
28
|
+
const heightHeader = useHeaderHeight();
|
|
29
|
+
const keyboardOffset = heightHeader - Math.min(insets.bottom, 21);
|
|
30
|
+
|
|
27
31
|
const {
|
|
28
32
|
screen: Screen,
|
|
29
33
|
options,
|
|
@@ -184,12 +188,13 @@ const BottomSheet: React.FC<BottomSheetParams> = props => {
|
|
|
184
188
|
style={StyleSheet.absoluteFillObject}>
|
|
185
189
|
<KeyboardAvoidingView
|
|
186
190
|
behavior={Platform.select({
|
|
187
|
-
ios: '
|
|
191
|
+
ios: 'position',
|
|
188
192
|
android: undefined,
|
|
189
193
|
})}
|
|
190
|
-
keyboardVerticalOffset={keyboardVerticalOffset ??
|
|
194
|
+
keyboardVerticalOffset={keyboardVerticalOffset ?? keyboardOffset}
|
|
191
195
|
enabled={useKeyboardAvoidingView}
|
|
192
|
-
|
|
196
|
+
contentContainerStyle={styles.container}
|
|
197
|
+
style={styles.container}>
|
|
193
198
|
<Pressable
|
|
194
199
|
style={StyleSheet.absoluteFillObject}
|
|
195
200
|
onPress={() => {
|
|
@@ -232,6 +237,10 @@ const BottomSheet: React.FC<BottomSheetParams> = props => {
|
|
|
232
237
|
};
|
|
233
238
|
|
|
234
239
|
const styles = StyleSheet.create({
|
|
240
|
+
container: {
|
|
241
|
+
flex: 1,
|
|
242
|
+
justifyContent: 'flex-end',
|
|
243
|
+
},
|
|
235
244
|
overlay: {
|
|
236
245
|
flex: 1,
|
|
237
246
|
backgroundColor: 'rgba(0, 0, 0, 0.6)',
|
|
@@ -12,7 +12,6 @@ const LinearGradientAnimated = Animated.createAnimatedComponent(LinearGradient);
|
|
|
12
12
|
* header background for default
|
|
13
13
|
*/
|
|
14
14
|
const HeaderBackground: React.FC<HeaderBackgroundProps> = ({
|
|
15
|
-
image,
|
|
16
15
|
animatedValue = new Animated.Value(0),
|
|
17
16
|
useGradient = true,
|
|
18
17
|
useShadowHeader = true,
|
|
@@ -20,13 +19,8 @@ const HeaderBackground: React.FC<HeaderBackgroundProps> = ({
|
|
|
20
19
|
headerBackground,
|
|
21
20
|
}) => {
|
|
22
21
|
const {theme} = useContext(ApplicationContext);
|
|
23
|
-
|
|
24
22
|
const gradientColor = customGradientColor ?? theme.colors.gradient;
|
|
25
|
-
|
|
26
|
-
let headerImage = headerBackground ?? theme.assets?.headerBackground;
|
|
27
|
-
if (image === null) {
|
|
28
|
-
headerImage = undefined;
|
|
29
|
-
}
|
|
23
|
+
const headerImage = headerBackground ?? theme.assets?.headerBackground;
|
|
30
24
|
|
|
31
25
|
const opacityBackground = animatedValue?.interpolate({
|
|
32
26
|
inputRange: [0, 52],
|
|
@@ -39,6 +33,10 @@ const HeaderBackground: React.FC<HeaderBackgroundProps> = ({
|
|
|
39
33
|
extrapolate: 'clamp',
|
|
40
34
|
});
|
|
41
35
|
|
|
36
|
+
if (Platform.OS === 'android' && headerImage) {
|
|
37
|
+
useShadowHeader = false;
|
|
38
|
+
}
|
|
39
|
+
|
|
42
40
|
return (
|
|
43
41
|
<View style={Styles.flex}>
|
|
44
42
|
<Animated.View
|
|
@@ -46,7 +46,6 @@ const HeaderExtendHeader: React.FC<{
|
|
|
46
46
|
const gradientColor = customGradientColor ?? theme.colors.gradient;
|
|
47
47
|
const headerBackground = customBackground ?? theme.assets?.headerBackground;
|
|
48
48
|
const leftPosition = inputSearchProps?.leftPosition || BACK_WIDTH + 20;
|
|
49
|
-
const isIos = Platform.OS === 'ios';
|
|
50
49
|
|
|
51
50
|
const opacityBackground = animatedValue?.interpolate({
|
|
52
51
|
inputRange: [0, 52],
|
|
@@ -89,15 +88,17 @@ const HeaderExtendHeader: React.FC<{
|
|
|
89
88
|
extrapolate: 'clamp',
|
|
90
89
|
});
|
|
91
90
|
|
|
91
|
+
if (Platform.OS === 'android' && headerBackground) {
|
|
92
|
+
useShadowHeader = false;
|
|
93
|
+
}
|
|
94
|
+
|
|
92
95
|
if (inputSearchProps) {
|
|
93
96
|
return (
|
|
94
97
|
<>
|
|
95
98
|
<Animated.View style={{height: height}} />
|
|
96
99
|
<Animated.View
|
|
97
100
|
style={[
|
|
98
|
-
|
|
99
|
-
? styles.shadowHeader
|
|
100
|
-
: styles.dividerHeader,
|
|
101
|
+
useShadowHeader ? styles.shadowHeader : styles.dividerHeader,
|
|
101
102
|
{
|
|
102
103
|
position: 'absolute',
|
|
103
104
|
width: '100%',
|
package/Application/types.ts
CHANGED