@momo-kits/foundation 0.161.1-beta.2 → 0.161.2-beta.1
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.
- package/Application/BottomSheet.tsx +3 -3
- package/Application/BottomTab/BottomTabBar.tsx +17 -17
- package/Application/BottomTab/CustomBottomTabItem.tsx +1 -1
- package/Application/BottomTab/index.tsx +31 -55
- package/Application/Components/BackgroundImageView.tsx +22 -6
- package/Application/Components/HeaderAnimated.tsx +32 -29
- package/Application/Components/HeaderBackground.tsx +21 -27
- package/Application/Components/HeaderExtendHeader.tsx +114 -94
- package/Application/Components/HeaderTitle.tsx +40 -11
- package/Application/Components/SearchHeader.tsx +17 -22
- package/Application/NavigationContainer.tsx +21 -25
- package/Application/ScaleSizeProvider.tsx +16 -0
- package/Application/WidgetContainer.tsx +7 -18
- package/Application/index.ts +2 -0
- package/Application/types.ts +10 -4
- package/Application/utils.tsx +4 -3
- package/Badge/Badge.tsx +3 -9
- package/Badge/BadgeDot.tsx +1 -1
- package/Badge/BadgeDotAnimation.tsx +53 -71
- package/Badge/BadgeRibbon.tsx +1 -1
- package/Button/index.tsx +3 -6
- package/CheckBox/index.tsx +1 -1
- package/Context/index.ts +4 -0
- package/Icon/index.tsx +1 -1
- package/IconButton/index.tsx +1 -1
- package/Image/index.tsx +13 -3
- package/Input/Input.tsx +1 -1
- package/Input/InputDropDown.tsx +1 -1
- package/Input/InputMoney.tsx +1 -1
- package/Input/InputOTP.tsx +39 -24
- package/Input/InputPhoneNumber.tsx +1 -1
- package/Input/InputSearch.tsx +1 -1
- package/Input/InputTextArea.tsx +10 -4
- package/Layout/FloatingButton.tsx +59 -59
- package/Layout/Item.tsx +1 -1
- package/Layout/Screen.tsx +61 -57
- package/Loader/ProgressBar.tsx +20 -18
- package/Pagination/Dot.tsx +2 -2
- package/Pagination/PaginationDot.tsx +1 -1
- package/Pagination/PaginationNumber.tsx +1 -1
- package/Pagination/PaginationScroll.tsx +32 -28
- package/Pagination/PaginationWhiteDot.tsx +1 -1
- package/Popup/PopupNotify.tsx +1 -1
- package/Popup/PopupPromotion.tsx +1 -1
- package/Radio/index.tsx +1 -1
- package/Skeleton/index.tsx +32 -24
- package/Switch/index.tsx +1 -1
- package/Tag/index.tsx +1 -1
- package/Text/index.tsx +1 -1
- package/Text/utils.ts +41 -18
- package/Title/index.tsx +1 -1
- package/package.json +34 -34
package/Application/utils.tsx
CHANGED
|
@@ -5,7 +5,8 @@ import {
|
|
|
5
5
|
} from '@react-navigation/stack';
|
|
6
6
|
import type { HeaderTitleProps, NavigationOptions } from './types';
|
|
7
7
|
import { Colors, Spacing } from '../Consts';
|
|
8
|
-
import {
|
|
8
|
+
import { AppState, Platform } from 'react-native';
|
|
9
|
+
import type { SharedValue } from 'react-native-reanimated';
|
|
9
10
|
import {
|
|
10
11
|
MiniAppContext,
|
|
11
12
|
ScreenContext,
|
|
@@ -60,7 +61,7 @@ const getModalOptions = (): StackNavigationOptions => {
|
|
|
60
61
|
*/
|
|
61
62
|
const getOptions = (
|
|
62
63
|
params: NavigationOptions,
|
|
63
|
-
animatedValue?:
|
|
64
|
+
animatedValue?: SharedValue<number>,
|
|
64
65
|
) => {
|
|
65
66
|
let options: StackNavigationOptions = {};
|
|
66
67
|
|
|
@@ -131,7 +132,7 @@ const getOptions = (
|
|
|
131
132
|
|
|
132
133
|
const exportHeaderTitle = (
|
|
133
134
|
params: NavigationOptions,
|
|
134
|
-
animatedValue?:
|
|
135
|
+
animatedValue?: SharedValue<number>,
|
|
135
136
|
): StackNavigationOptions => {
|
|
136
137
|
if (typeof params.headerTitle === 'object') {
|
|
137
138
|
return {
|
package/Badge/Badge.tsx
CHANGED
|
@@ -18,8 +18,8 @@ const Badge: FC<BadgeProps> = ({
|
|
|
18
18
|
const { componentId } = useComponentId('Badge', accessibilityLabel);
|
|
19
19
|
const scaledSize = useScaleSize(16);
|
|
20
20
|
|
|
21
|
-
const showBaseLineDebug = context?.
|
|
22
|
-
|
|
21
|
+
const showBaseLineDebug = context?.features?.showBaseLineDebug ?? false;
|
|
22
|
+
|
|
23
23
|
const styles = StyleSheet.create({
|
|
24
24
|
badge: {
|
|
25
25
|
paddingHorizontal: Spacing.XS,
|
|
@@ -84,13 +84,7 @@ const Badge: FC<BadgeProps> = ({
|
|
|
84
84
|
}
|
|
85
85
|
|
|
86
86
|
return (
|
|
87
|
-
<View
|
|
88
|
-
style={[
|
|
89
|
-
style,
|
|
90
|
-
styles.badgeContainer,
|
|
91
|
-
showBaseLineDebug && styles.debugBaseLine,
|
|
92
|
-
]}
|
|
93
|
-
>
|
|
87
|
+
<View style={[style, styles.badgeContainer, showBaseLineDebug && styles.debugBaseLine]}>
|
|
94
88
|
<View
|
|
95
89
|
style={[styles.badge, { backgroundColor: badgeColor }]}
|
|
96
90
|
accessibilityLabel={componentId}
|
package/Badge/BadgeDot.tsx
CHANGED
|
@@ -9,7 +9,7 @@ const BadgeDot: FC<BadgeDotProps> = ({ size = 'large', style }) => {
|
|
|
9
9
|
let dotStyle;
|
|
10
10
|
let dotContainerStyle;
|
|
11
11
|
|
|
12
|
-
const showBaseLineDebug = context?.
|
|
12
|
+
const showBaseLineDebug = context?.features?.showBaseLineDebug ?? false;
|
|
13
13
|
|
|
14
14
|
if (size === 'large') {
|
|
15
15
|
dotStyle = styles.dot;
|
|
@@ -1,93 +1,75 @@
|
|
|
1
|
-
import React, { useEffect
|
|
2
|
-
import {
|
|
1
|
+
import React, { useEffect } from 'react';
|
|
2
|
+
import { View } from 'react-native';
|
|
3
|
+
import Animated, {
|
|
4
|
+
cancelAnimation,
|
|
5
|
+
useAnimatedStyle,
|
|
6
|
+
useSharedValue,
|
|
7
|
+
withRepeat,
|
|
8
|
+
withSequence,
|
|
9
|
+
withSpring,
|
|
10
|
+
withTiming,
|
|
11
|
+
} from 'react-native-reanimated';
|
|
3
12
|
import { BadgeDotProps } from './types';
|
|
4
13
|
import styles from './styles';
|
|
5
14
|
|
|
6
15
|
const DURATION = 500;
|
|
7
16
|
|
|
8
17
|
const BadgeDotAnimation = ({ size, style }: BadgeDotProps) => {
|
|
9
|
-
|
|
10
|
-
const
|
|
11
|
-
const
|
|
12
|
-
const waveOpacityAnim = useRef(new Animated.Value(0)).current;
|
|
18
|
+
const scaleAnim = useSharedValue(1);
|
|
19
|
+
const waveScaleAnim = useSharedValue(1);
|
|
20
|
+
const waveOpacityAnim = useSharedValue(0);
|
|
13
21
|
|
|
14
22
|
const dotStyle =
|
|
15
23
|
size === 'small' ? styles.dotAnimationSmall : styles.dotAnimation;
|
|
16
24
|
const waveStyle = size === 'small' ? styles.waveSmall : styles.wave;
|
|
17
25
|
|
|
18
26
|
useEffect(() => {
|
|
19
|
-
|
|
20
|
-
const animation = Animated.loop(
|
|
21
|
-
Animated.parallel([
|
|
22
|
-
// Dot pulse animation
|
|
23
|
-
Animated.sequence([
|
|
24
|
-
Animated.spring(scaleAnim, {
|
|
25
|
-
toValue: 1, // Scale up slightly
|
|
26
|
-
friction: 5, // Controls the "bounciness" of the spring
|
|
27
|
-
tension: 30, // Controls the "stiffness" of the spring
|
|
28
|
-
useNativeDriver: true,
|
|
29
|
-
}),
|
|
30
|
-
Animated.spring(scaleAnim, {
|
|
31
|
-
toValue: 1.1,
|
|
32
|
-
friction: 5,
|
|
33
|
-
tension: 30,
|
|
34
|
-
useNativeDriver: true,
|
|
35
|
-
}),
|
|
36
|
-
]), // Wave animation
|
|
37
|
-
Animated.sequence([
|
|
38
|
-
Animated.timing(waveScaleAnim, {
|
|
39
|
-
toValue: 2.5,
|
|
40
|
-
duration: DURATION * 3,
|
|
41
|
-
useNativeDriver: true,
|
|
42
|
-
}),
|
|
43
|
-
Animated.timing(waveScaleAnim, {
|
|
44
|
-
toValue: 1, // Reset wave size
|
|
45
|
-
duration: 0,
|
|
46
|
-
useNativeDriver: true,
|
|
47
|
-
}),
|
|
48
|
-
]), // Wave opacity animation
|
|
49
|
-
Animated.sequence([
|
|
50
|
-
Animated.timing(waveOpacityAnim, {
|
|
51
|
-
toValue: 0.3, // Wave becomes visible
|
|
52
|
-
duration: DURATION * 2,
|
|
53
|
-
useNativeDriver: true,
|
|
54
|
-
}),
|
|
55
|
-
Animated.timing(waveOpacityAnim, {
|
|
56
|
-
toValue: 0, // Wave fades out
|
|
57
|
-
duration: DURATION,
|
|
58
|
-
useNativeDriver: true,
|
|
59
|
-
}),
|
|
60
|
-
]),
|
|
61
|
-
]),
|
|
62
|
-
);
|
|
63
|
-
animation.start();
|
|
27
|
+
const springCfg = { damping: 5, stiffness: 30, mass: 1 };
|
|
64
28
|
|
|
29
|
+
scaleAnim.value = withRepeat(
|
|
30
|
+
withSequence(
|
|
31
|
+
withSpring(1, springCfg),
|
|
32
|
+
withSpring(1.1, springCfg),
|
|
33
|
+
),
|
|
34
|
+
-1,
|
|
35
|
+
false,
|
|
36
|
+
);
|
|
37
|
+
waveScaleAnim.value = withRepeat(
|
|
38
|
+
withSequence(
|
|
39
|
+
withTiming(2.5, { duration: DURATION * 3 }),
|
|
40
|
+
withTiming(1, { duration: 0 }),
|
|
41
|
+
),
|
|
42
|
+
-1,
|
|
43
|
+
false,
|
|
44
|
+
);
|
|
45
|
+
waveOpacityAnim.value = withRepeat(
|
|
46
|
+
withSequence(
|
|
47
|
+
withTiming(0.3, { duration: DURATION * 2 }),
|
|
48
|
+
withTiming(0, { duration: DURATION }),
|
|
49
|
+
),
|
|
50
|
+
-1,
|
|
51
|
+
false,
|
|
52
|
+
);
|
|
65
53
|
return () => {
|
|
66
|
-
|
|
54
|
+
cancelAnimation(scaleAnim);
|
|
55
|
+
cancelAnimation(waveScaleAnim);
|
|
56
|
+
cancelAnimation(waveOpacityAnim);
|
|
67
57
|
};
|
|
68
58
|
}, [scaleAnim, waveOpacityAnim, waveScaleAnim]);
|
|
69
59
|
|
|
60
|
+
const waveAnimatedStyle = useAnimatedStyle(() => ({
|
|
61
|
+
transform: [{ scale: waveScaleAnim.value }],
|
|
62
|
+
opacity: waveOpacityAnim.value,
|
|
63
|
+
}));
|
|
64
|
+
|
|
65
|
+
const dotAnimatedStyle = useAnimatedStyle(() => ({
|
|
66
|
+
transform: [{ scale: scaleAnim.value }],
|
|
67
|
+
}));
|
|
68
|
+
|
|
70
69
|
return (
|
|
71
70
|
<View style={[styles.dotAnimationContainer, style]}>
|
|
72
|
-
{
|
|
73
|
-
<Animated.View
|
|
74
|
-
style={[
|
|
75
|
-
waveStyle,
|
|
76
|
-
{
|
|
77
|
-
transform: [{ scale: waveScaleAnim }],
|
|
78
|
-
opacity: waveOpacityAnim,
|
|
79
|
-
},
|
|
80
|
-
]}
|
|
81
|
-
/>
|
|
82
|
-
{/* Dot Animation */}
|
|
83
|
-
<Animated.View
|
|
84
|
-
style={[
|
|
85
|
-
dotStyle,
|
|
86
|
-
{
|
|
87
|
-
transform: [{ scale: scaleAnim }],
|
|
88
|
-
},
|
|
89
|
-
]}
|
|
90
|
-
/>
|
|
71
|
+
<Animated.View style={[waveStyle, waveAnimatedStyle]} />
|
|
72
|
+
<Animated.View style={[dotStyle, dotAnimatedStyle]} />
|
|
91
73
|
</View>
|
|
92
74
|
);
|
|
93
75
|
};
|
package/Badge/BadgeRibbon.tsx
CHANGED
|
@@ -19,7 +19,7 @@ const BadgeRibbon: FC<BadgeRibbonProps> = ({
|
|
|
19
19
|
const isRight = position === 'top_right' || position === 'bottom_right';
|
|
20
20
|
const isUpTail = position === 'bottom_left' || position === 'top_right';
|
|
21
21
|
|
|
22
|
-
const showBaseLineDebug = context?.
|
|
22
|
+
const showBaseLineDebug = context?.features?.showBaseLineDebug ?? false;
|
|
23
23
|
|
|
24
24
|
const ribbonRotate = useMemo(() => (isRight ? '180deg' : '0deg'), [isRight]);
|
|
25
25
|
const textRotate = ribbonRotate;
|
package/Button/index.tsx
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import React, { FC, useContext, useRef } from 'react';
|
|
2
2
|
import {
|
|
3
|
-
Animated,
|
|
4
3
|
StyleSheet,
|
|
5
4
|
TouchableOpacity,
|
|
6
5
|
TouchableOpacityProps,
|
|
@@ -29,8 +28,6 @@ import Reanimated, {
|
|
|
29
28
|
withTiming,
|
|
30
29
|
} from 'react-native-reanimated';
|
|
31
30
|
|
|
32
|
-
const AnimationLinear = Animated.createAnimatedComponent(LinearGradient);
|
|
33
|
-
|
|
34
31
|
export interface ButtonProps extends TouchableOpacityProps {
|
|
35
32
|
/**
|
|
36
33
|
* Defines the visual style of the button.
|
|
@@ -77,7 +74,7 @@ const Button: FC<ButtonProps> = ({
|
|
|
77
74
|
const animationRef = useRef<LottieView>(null);
|
|
78
75
|
const pressAnim = useSharedValue(0);
|
|
79
76
|
|
|
80
|
-
const showBaseLineDebug = context?.
|
|
77
|
+
const showBaseLineDebug = context?.features?.showBaseLineDebug ?? false;
|
|
81
78
|
|
|
82
79
|
const componentName = 'Button';
|
|
83
80
|
const { componentId } = useComponentId(
|
|
@@ -355,11 +352,11 @@ const Button: FC<ButtonProps> = ({
|
|
|
355
352
|
onPressOut={animateOut}
|
|
356
353
|
>
|
|
357
354
|
<Reanimated.View style={[buttonStyle, animatedStyle]}>
|
|
358
|
-
|
|
355
|
+
{renderIcon('left')}
|
|
359
356
|
{renderTitle()}
|
|
360
357
|
{renderIcon('right')}
|
|
361
358
|
{gradientPros && (
|
|
362
|
-
<
|
|
359
|
+
<LinearGradient {...gradientPros} style={styles.gradientView} />
|
|
363
360
|
)}
|
|
364
361
|
{gradientPros && <View style={styles.strokeView} />}
|
|
365
362
|
</Reanimated.View>
|
package/CheckBox/index.tsx
CHANGED
|
@@ -34,7 +34,7 @@ const CheckBox: FC<CheckBoxProps> = ({
|
|
|
34
34
|
props.accessibilityLabel,
|
|
35
35
|
);
|
|
36
36
|
|
|
37
|
-
const showBaseLineDebug = context?.
|
|
37
|
+
const showBaseLineDebug = context?.features?.showBaseLineDebug ?? false;
|
|
38
38
|
|
|
39
39
|
if (haveValue) {
|
|
40
40
|
borderColor = theme.colors.primary;
|
package/Context/index.ts
CHANGED
|
@@ -9,6 +9,9 @@ const MiniAppContext = (Platform as any).MiniAppContext ?? Context;
|
|
|
9
9
|
const ScreenContext = (Platform as any).ScreenContext ?? Context;
|
|
10
10
|
const ComponentContext = (Platform as any).ComponentContext ?? Context;
|
|
11
11
|
const SkeletonContext = createContext({ loading: false });
|
|
12
|
+
const ScaleSizeContext = createContext<{ scaleSizeMaxRate?: number }>({
|
|
13
|
+
scaleSizeMaxRate: undefined,
|
|
14
|
+
});
|
|
12
15
|
const TrackingScopeContext = createContext<{ scopeName?: string }>({
|
|
13
16
|
scopeName: undefined,
|
|
14
17
|
});
|
|
@@ -20,4 +23,5 @@ export {
|
|
|
20
23
|
ComponentContext,
|
|
21
24
|
SkeletonContext,
|
|
22
25
|
TrackingScopeContext,
|
|
26
|
+
ScaleSizeContext,
|
|
23
27
|
};
|
package/Icon/index.tsx
CHANGED
|
@@ -17,7 +17,7 @@ const Icon: React.FC<IconProps> = ({
|
|
|
17
17
|
const { theme } = useContext(ApplicationContext);
|
|
18
18
|
const context = useContext<any>(MiniAppContext);
|
|
19
19
|
|
|
20
|
-
const showBaseLineDebug = context?.
|
|
20
|
+
const showBaseLineDebug = context?.features?.showBaseLineDebug ?? false;
|
|
21
21
|
|
|
22
22
|
/**
|
|
23
23
|
* get icon source maps or remote http
|
package/IconButton/index.tsx
CHANGED
|
@@ -46,7 +46,7 @@ const IconButton: React.FC<IconButtonProps> = ({
|
|
|
46
46
|
const { theme } = useContext(ApplicationContext);
|
|
47
47
|
const context = useContext<any>(MiniAppContext);
|
|
48
48
|
|
|
49
|
-
const showBaseLineDebug = context?.
|
|
49
|
+
const showBaseLineDebug = context?.features?.showBaseLineDebug ?? false;
|
|
50
50
|
|
|
51
51
|
/**
|
|
52
52
|
* get size icon button
|
package/Image/index.tsx
CHANGED
|
@@ -28,6 +28,11 @@ const Image: React.FC<ImageProps> = ({
|
|
|
28
28
|
source,
|
|
29
29
|
loading = true,
|
|
30
30
|
children,
|
|
31
|
+
onProgress,
|
|
32
|
+
onLoadStart,
|
|
33
|
+
onLoad,
|
|
34
|
+
onLoadEnd,
|
|
35
|
+
onError,
|
|
31
36
|
...rest
|
|
32
37
|
}) => {
|
|
33
38
|
const { theme } = useContext(ApplicationContext);
|
|
@@ -37,7 +42,7 @@ const Image: React.FC<ImageProps> = ({
|
|
|
37
42
|
const error = useRef(false);
|
|
38
43
|
const [status, setStatus] = useState<Status>('success');
|
|
39
44
|
|
|
40
|
-
const showBaseLineDebug = context?.
|
|
45
|
+
const showBaseLineDebug = context?.features?.showBaseLineDebug ?? false;
|
|
41
46
|
|
|
42
47
|
let accessibilityLabel: any = `img|${getImageName(source)}`;
|
|
43
48
|
if (component?.componentId) {
|
|
@@ -84,17 +89,20 @@ const Image: React.FC<ImageProps> = ({
|
|
|
84
89
|
style,
|
|
85
90
|
showBaseLineDebug && styles.debugBaseLine,
|
|
86
91
|
]}
|
|
87
|
-
onProgress={
|
|
92
|
+
onProgress={event => {
|
|
88
93
|
error.current = false;
|
|
89
94
|
if (status !== 'loading' && loading) {
|
|
90
95
|
setStatus('loading');
|
|
91
96
|
}
|
|
97
|
+
onProgress?.(event);
|
|
92
98
|
}}
|
|
93
99
|
onLoadStart={() => {
|
|
94
100
|
error.current = false;
|
|
101
|
+
onLoadStart?.();
|
|
95
102
|
}}
|
|
96
|
-
onLoad={
|
|
103
|
+
onLoad={event => {
|
|
97
104
|
error.current = false;
|
|
105
|
+
onLoad?.(event);
|
|
98
106
|
}}
|
|
99
107
|
onLoadEnd={() => {
|
|
100
108
|
let current: Status = 'success';
|
|
@@ -102,9 +110,11 @@ const Image: React.FC<ImageProps> = ({
|
|
|
102
110
|
current = 'error';
|
|
103
111
|
}
|
|
104
112
|
setStatus(prevState => (prevState !== current ? current : prevState));
|
|
113
|
+
onLoadEnd?.();
|
|
105
114
|
}}
|
|
106
115
|
onError={() => {
|
|
107
116
|
error.current = true;
|
|
117
|
+
onError?.();
|
|
108
118
|
}}
|
|
109
119
|
>
|
|
110
120
|
{renderContent()}
|
package/Input/Input.tsx
CHANGED
|
@@ -81,7 +81,7 @@ const Input = forwardRef(
|
|
|
81
81
|
const inputRef = useRef<TextInput | null>(null);
|
|
82
82
|
const componentName = 'Input';
|
|
83
83
|
|
|
84
|
-
const showBaseLineDebug = context?.
|
|
84
|
+
const showBaseLineDebug = context?.features?.showBaseLineDebug ?? false;
|
|
85
85
|
|
|
86
86
|
const { componentId } = useComponentId(
|
|
87
87
|
`${componentName}/${placeholder}`,
|
package/Input/InputDropDown.tsx
CHANGED
|
@@ -43,7 +43,7 @@ const InputDropDown = ({
|
|
|
43
43
|
const scaleHeight = useScaleSize(size === 'small' ? 48 : 56);
|
|
44
44
|
const componentName = 'InputDropDown';
|
|
45
45
|
|
|
46
|
-
const showBaseLineDebug = context?.
|
|
46
|
+
const showBaseLineDebug = context?.features?.showBaseLineDebug ?? false;
|
|
47
47
|
|
|
48
48
|
const { componentId } = useComponentId(
|
|
49
49
|
`${componentName}/${placeholder}`,
|
package/Input/InputMoney.tsx
CHANGED
|
@@ -76,7 +76,7 @@ const InputMoney = forwardRef(
|
|
|
76
76
|
const inputRef = useRef<TextInput>(null);
|
|
77
77
|
const componentName = 'InputMoney';
|
|
78
78
|
|
|
79
|
-
const showBaseLineDebug = context?.
|
|
79
|
+
const showBaseLineDebug = context?.features?.showBaseLineDebug ?? false;
|
|
80
80
|
|
|
81
81
|
const { componentId } = useComponentId(
|
|
82
82
|
`${componentName}/${placeholder}`,
|
package/Input/InputOTP.tsx
CHANGED
|
@@ -8,13 +8,22 @@ import React, {
|
|
|
8
8
|
useState,
|
|
9
9
|
} from 'react';
|
|
10
10
|
import {
|
|
11
|
-
Animated,
|
|
12
11
|
PixelRatio,
|
|
13
12
|
TextInput,
|
|
14
13
|
TextInputFocusEvent,
|
|
15
14
|
TouchableOpacity,
|
|
16
15
|
View,
|
|
17
16
|
} from 'react-native';
|
|
17
|
+
import Animated, {
|
|
18
|
+
cancelAnimation,
|
|
19
|
+
Easing,
|
|
20
|
+
useAnimatedStyle,
|
|
21
|
+
useSharedValue,
|
|
22
|
+
withDelay,
|
|
23
|
+
withRepeat,
|
|
24
|
+
withSequence,
|
|
25
|
+
withTiming,
|
|
26
|
+
} from 'react-native-reanimated';
|
|
18
27
|
import { useComponentId } from '../Application';
|
|
19
28
|
import { Spacing, Styles } from '../Consts';
|
|
20
29
|
import { useScaleSize, Text } from '../Text';
|
|
@@ -32,37 +41,43 @@ import {
|
|
|
32
41
|
const OTPCaret: FC<CaretProps> = ({ index, length }) => {
|
|
33
42
|
const DURATION = 300;
|
|
34
43
|
const { theme } = useContext(ApplicationContext);
|
|
35
|
-
const opacity =
|
|
44
|
+
const opacity = useSharedValue(0);
|
|
36
45
|
|
|
37
46
|
useEffect(() => {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
).start();
|
|
47
|
+
opacity.value = withRepeat(
|
|
48
|
+
withSequence(
|
|
49
|
+
withTiming(1, { duration: DURATION, easing: Easing.linear }),
|
|
50
|
+
withDelay(
|
|
51
|
+
DURATION * 2,
|
|
52
|
+
withTiming(0, { duration: DURATION, easing: Easing.linear }),
|
|
53
|
+
),
|
|
54
|
+
),
|
|
55
|
+
-1,
|
|
56
|
+
false,
|
|
57
|
+
);
|
|
58
|
+
return () => {
|
|
59
|
+
cancelAnimation(opacity);
|
|
60
|
+
};
|
|
53
61
|
}, [opacity]);
|
|
62
|
+
|
|
63
|
+
const animatedStyle = useAnimatedStyle(() => ({
|
|
64
|
+
opacity: opacity.value,
|
|
65
|
+
}));
|
|
66
|
+
|
|
54
67
|
const spacingStyle = !isNaN(Number(length)) &&
|
|
55
68
|
index !== Number(length) - 1 && { marginRight: Spacing.L };
|
|
56
69
|
|
|
57
70
|
return (
|
|
58
71
|
<View style={[Styles.rowCenter, spacingStyle]}>
|
|
59
72
|
<Animated.View
|
|
60
|
-
style={
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
73
|
+
style={[
|
|
74
|
+
{
|
|
75
|
+
height: useScaleSize(12),
|
|
76
|
+
width: 1,
|
|
77
|
+
backgroundColor: theme.colors.primary,
|
|
78
|
+
},
|
|
79
|
+
animatedStyle,
|
|
80
|
+
]}
|
|
66
81
|
/>
|
|
67
82
|
<Text color={theme.colors.text.hint} typography={'body_default_regular'}>
|
|
68
83
|
-
|
|
@@ -99,7 +114,7 @@ const InputOTP = forwardRef(
|
|
|
99
114
|
|
|
100
115
|
const componentName = 'InputOTP';
|
|
101
116
|
|
|
102
|
-
const showBaseLineDebug = context?.
|
|
117
|
+
const showBaseLineDebug = context?.features?.showBaseLineDebug ?? false;
|
|
103
118
|
|
|
104
119
|
const { componentId } = useComponentId(
|
|
105
120
|
`${componentName}/${placeholder}`,
|
|
@@ -73,7 +73,7 @@ const InputPhoneNumber = forwardRef(
|
|
|
73
73
|
const inputRef = useRef<TextInput | null>(null);
|
|
74
74
|
const componentName = 'InputPhoneNumber';
|
|
75
75
|
|
|
76
|
-
const showBaseLineDebug = context?.
|
|
76
|
+
const showBaseLineDebug = context?.features?.showBaseLineDebug ?? false;
|
|
77
77
|
|
|
78
78
|
const { componentId } = useComponentId(
|
|
79
79
|
`${componentName}/${placeholder}`,
|
package/Input/InputSearch.tsx
CHANGED
|
@@ -146,7 +146,7 @@ const InputSearch: ForwardRefRenderFunction<InputRef, InputSearchProps> = (
|
|
|
146
146
|
const context = useContext<any>(MiniAppContext);
|
|
147
147
|
const scaledFontSize = useScaleSize(14);
|
|
148
148
|
|
|
149
|
-
const showBaseLineDebug = context?.
|
|
149
|
+
const showBaseLineDebug = context?.features?.showBaseLineDebug ?? false;
|
|
150
150
|
|
|
151
151
|
const [focused, setFocused] = useState(false);
|
|
152
152
|
const [internalText, setInternalText] = useState(defaultValue || '');
|
package/Input/InputTextArea.tsx
CHANGED
|
@@ -21,7 +21,7 @@ import { ErrorView, FloatingView, getBorderColor, MAX_LENGTH } from './common';
|
|
|
21
21
|
import { InputTextAreaProps } from './index';
|
|
22
22
|
import styles from './styles';
|
|
23
23
|
import SystemTextInput from './SystemTextInput';
|
|
24
|
-
import { useComponentId } from '../Application';
|
|
24
|
+
import { setAutomationID, useComponentId } from '../Application';
|
|
25
25
|
|
|
26
26
|
const InputTextArea = forwardRef(
|
|
27
27
|
(
|
|
@@ -57,7 +57,7 @@ const InputTextArea = forwardRef(
|
|
|
57
57
|
const context = useContext<any>(MiniAppContext);
|
|
58
58
|
const DEFAULT_HEIGHT = useScaleSize(104);
|
|
59
59
|
|
|
60
|
-
const showBaseLineDebug = context?.
|
|
60
|
+
const showBaseLineDebug = context?.features?.showBaseLineDebug ?? false;
|
|
61
61
|
const scaledFontSize = useScaleSize(14);
|
|
62
62
|
const [focused, setFocused] = useState(false);
|
|
63
63
|
const [inputValue, setInputValue] = useState(defaultValue ?? '');
|
|
@@ -121,6 +121,8 @@ const InputTextArea = forwardRef(
|
|
|
121
121
|
|
|
122
122
|
return (
|
|
123
123
|
<View
|
|
124
|
+
accessible={false}
|
|
125
|
+
importantForAccessibility="no"
|
|
124
126
|
style={[
|
|
125
127
|
styles.textAreaWrapper,
|
|
126
128
|
{
|
|
@@ -139,11 +141,15 @@ const InputTextArea = forwardRef(
|
|
|
139
141
|
componentId={componentId}
|
|
140
142
|
/>
|
|
141
143
|
<View style={styles.rowArea}>
|
|
142
|
-
<View
|
|
144
|
+
<View
|
|
145
|
+
accessible={false}
|
|
146
|
+
importantForAccessibility="no"
|
|
147
|
+
style={styles.textAreaView}
|
|
148
|
+
>
|
|
143
149
|
<SystemTextInput
|
|
144
150
|
{...props}
|
|
145
151
|
ref={inputRef}
|
|
146
|
-
|
|
152
|
+
{...setAutomationID(componentId)}
|
|
147
153
|
accessibilityState={{
|
|
148
154
|
disabled: disabled,
|
|
149
155
|
...props.accessibilityState,
|