@momo-kits/foundation 0.169.17-beta.5 → 0.169.17-beta.7
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.
|
@@ -41,47 +41,9 @@ const ModalScreen: React.FC<any> = props => {
|
|
|
41
41
|
if (props.route?.params?.isBottomSheet) {
|
|
42
42
|
return <BottomSheet {...props} />;
|
|
43
43
|
}
|
|
44
|
-
if (props.route?.params?.fullScreen) {
|
|
45
|
-
return <FullScreenModal {...props} />;
|
|
46
|
-
}
|
|
47
44
|
return <Modal {...props} />;
|
|
48
45
|
};
|
|
49
46
|
|
|
50
|
-
/**
|
|
51
|
-
* Edge to edge layer for overlays that draw their own scrim (e.g. Coachmark):
|
|
52
|
-
* no scrim, no animation, Android back is swallowed; the screen closes itself.
|
|
53
|
-
*/
|
|
54
|
-
const FullScreenModal: React.FC<ModalParams> = props => {
|
|
55
|
-
const { screen, onDismiss } = props.route.params;
|
|
56
|
-
const Component = useRef(screen).current;
|
|
57
|
-
const params = { ...props.route.params };
|
|
58
|
-
delete params.screen;
|
|
59
|
-
|
|
60
|
-
useEffect(() => {
|
|
61
|
-
return () => {
|
|
62
|
-
onDismiss?.();
|
|
63
|
-
};
|
|
64
|
-
}, [onDismiss]);
|
|
65
|
-
|
|
66
|
-
useEffect(() => {
|
|
67
|
-
const backHandler = BackHandler.addEventListener(
|
|
68
|
-
'hardwareBackPress',
|
|
69
|
-
() => true,
|
|
70
|
-
);
|
|
71
|
-
return () => backHandler.remove();
|
|
72
|
-
}, []);
|
|
73
|
-
|
|
74
|
-
const handleClose = useCallback(() => {
|
|
75
|
-
props.navigation.goBack();
|
|
76
|
-
}, [props.navigation]);
|
|
77
|
-
|
|
78
|
-
return (
|
|
79
|
-
<View style={StyleSheet.absoluteFillObject}>
|
|
80
|
-
<Component {...params} onRequestClose={handleClose} />
|
|
81
|
-
</View>
|
|
82
|
-
);
|
|
83
|
-
};
|
|
84
|
-
|
|
85
47
|
/**
|
|
86
48
|
* Centered popup that fades and scales in over a scrim. On foldables it is
|
|
87
49
|
* centered in the modal placement area, at most a popup wide.
|
package/Application/types.ts
CHANGED
|
@@ -96,8 +96,6 @@ export type ModalParams = {
|
|
|
96
96
|
barrierDismissible?: boolean;
|
|
97
97
|
modalStyle?: ViewStyle;
|
|
98
98
|
useNativeModal?: boolean;
|
|
99
|
-
/** Edge to edge screen with no scrim or animation; it closes itself. */
|
|
100
|
-
fullScreen?: boolean;
|
|
101
99
|
};
|
|
102
100
|
|
|
103
101
|
export type BottomSheetParams = {
|
package/Input/InputSearch.tsx
CHANGED
|
@@ -33,6 +33,7 @@ const SEARCH_ICON_SIZE = 24;
|
|
|
33
33
|
/**
|
|
34
34
|
* Search field with search icon, clear icon, optional trailing icon and a
|
|
35
35
|
* cancel button; with `typingData` it shows an animated placeholder instead.
|
|
36
|
+
* Deprecated `icon*` props fall back into the `trailing*` ones.
|
|
36
37
|
*/
|
|
37
38
|
const InputSearch: ForwardRefRenderFunction<InputRef, InputSearchProps> = (
|
|
38
39
|
{
|
|
@@ -40,9 +41,12 @@ const InputSearch: ForwardRefRenderFunction<InputRef, InputSearchProps> = (
|
|
|
40
41
|
onFocus,
|
|
41
42
|
onBlur,
|
|
42
43
|
value,
|
|
43
|
-
trailing,
|
|
44
|
-
trailingColor,
|
|
45
|
-
onPressTrailing,
|
|
44
|
+
trailing: trailingProp,
|
|
45
|
+
trailingColor: trailingColorProp,
|
|
46
|
+
onPressTrailing: onPressTrailingProp,
|
|
47
|
+
icon,
|
|
48
|
+
iconColor,
|
|
49
|
+
onPressIcon,
|
|
46
50
|
onChangeText,
|
|
47
51
|
buttonText = 'Hủy',
|
|
48
52
|
showButtonText = true,
|
|
@@ -59,6 +63,9 @@ const InputSearch: ForwardRefRenderFunction<InputRef, InputSearchProps> = (
|
|
|
59
63
|
ref,
|
|
60
64
|
) => {
|
|
61
65
|
const { theme } = useContext(ApplicationContext);
|
|
66
|
+
const trailing = trailingProp ?? icon;
|
|
67
|
+
const trailingColor = trailingColorProp ?? iconColor;
|
|
68
|
+
const onPressTrailing = onPressTrailingProp ?? onPressIcon;
|
|
62
69
|
const context = useContext<any>(MiniAppContext);
|
|
63
70
|
const scaledFontSize = useScaleSize(INPUT_FONT_SIZE);
|
|
64
71
|
const searchFontFamily = exportFontFamily('regular');
|
|
@@ -75,6 +75,12 @@ export const FloatingButton: React.FC<FloatingButtonProps> = ({
|
|
|
75
75
|
opacityAnimated.value = withTiming(1, { duration: ANIMATION_DURATION });
|
|
76
76
|
}, [label, opacityAnimated]);
|
|
77
77
|
|
|
78
|
+
// Re-measure the expanded width when the label or its scaled size changes.
|
|
79
|
+
useEffect(() => {
|
|
80
|
+
if (lastDirection.value === 'down') return;
|
|
81
|
+
widthAnimated.value = null;
|
|
82
|
+
}, [label, scaledFontSize, lastDirection, widthAnimated]);
|
|
83
|
+
|
|
78
84
|
useAnimatedReaction(
|
|
79
85
|
() => sharedValue.value,
|
|
80
86
|
value => {
|
|
@@ -115,7 +121,8 @@ export const FloatingButton: React.FC<FloatingButtonProps> = ({
|
|
|
115
121
|
);
|
|
116
122
|
|
|
117
123
|
const containerStyle = useAnimatedStyle(() => ({
|
|
118
|
-
width
|
|
124
|
+
// 'auto' (not undefined) so Reanimated drops the old width and re-lays out.
|
|
125
|
+
width: widthAnimated.value ?? 'auto',
|
|
119
126
|
}));
|
|
120
127
|
|
|
121
128
|
const labelStyle = useAnimatedStyle(() => ({
|