@momo-kits/foundation 0.150.2-beta.5 → 0.150.2-beta.test.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.
- package/Application/BottomTab/Badge.tsx +13 -6
- package/Application/BottomTab/BottomTabBar.tsx +6 -1
- package/Application/BottomTab/index.tsx +18 -3
- package/Application/Components/HeaderBackground.tsx +4 -1
- package/Application/Components/HeaderExtendHeader.tsx +37 -27
- package/Application/Components/SearchHeader.tsx +6 -1
- package/Application/ModalScreen.tsx +12 -2
- package/Application/utils.tsx +0 -2
- package/Badge/BadgeDotAnimation.tsx +18 -3
- package/Input/InputOTP.tsx +6 -1
- package/Layout/FloatingButton.tsx +12 -2
- package/Layout/Screen.tsx +1 -1
- package/Loader/ProgressBar.tsx +16 -10
- package/Pagination/PaginationScroll.tsx +18 -11
- package/Skeleton/index.tsx +6 -1
- package/package.json +2 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {useTheme} from '@react-navigation/native';
|
|
1
|
+
import { useTheme } from '@react-navigation/native';
|
|
2
2
|
import color from 'color';
|
|
3
3
|
import * as React from 'react';
|
|
4
4
|
import {
|
|
@@ -38,10 +38,16 @@ export function Badge({
|
|
|
38
38
|
size = 18,
|
|
39
39
|
...rest
|
|
40
40
|
}: Props) {
|
|
41
|
-
const [opacity] = React.useState(
|
|
41
|
+
const [opacity] = React.useState(
|
|
42
|
+
() =>
|
|
43
|
+
new Animated.Value(visible ? 1 : 0, {
|
|
44
|
+
useNativeDriver: true,
|
|
45
|
+
unstable_disableBatchingForNativeCreate: true,
|
|
46
|
+
}),
|
|
47
|
+
);
|
|
42
48
|
const [rendered, setRendered] = React.useState(visible);
|
|
43
49
|
|
|
44
|
-
const {colors, fonts} = useTheme();
|
|
50
|
+
const { colors, fonts } = useTheme();
|
|
45
51
|
|
|
46
52
|
React.useEffect(() => {
|
|
47
53
|
if (!rendered) {
|
|
@@ -52,7 +58,7 @@ export function Badge({
|
|
|
52
58
|
toValue: visible ? 1 : 0,
|
|
53
59
|
duration: 150,
|
|
54
60
|
useNativeDriver,
|
|
55
|
-
}).start(({finished}) => {
|
|
61
|
+
}).start(({ finished }) => {
|
|
56
62
|
if (finished && !visible) {
|
|
57
63
|
setRendered(false);
|
|
58
64
|
}
|
|
@@ -70,7 +76,7 @@ export function Badge({
|
|
|
70
76
|
}
|
|
71
77
|
|
|
72
78
|
// @ts-expect-error: backgroundColor definitely exists
|
|
73
|
-
const {backgroundColor = colors.notification, ...restStyle} =
|
|
79
|
+
const { backgroundColor = colors.notification, ...restStyle } =
|
|
74
80
|
StyleSheet.flatten(style) || {};
|
|
75
81
|
const textColor = color(backgroundColor).isLight() ? 'black' : 'white';
|
|
76
82
|
|
|
@@ -103,7 +109,8 @@ export function Badge({
|
|
|
103
109
|
styles.container,
|
|
104
110
|
restStyle,
|
|
105
111
|
]}
|
|
106
|
-
{...rest}
|
|
112
|
+
{...rest}
|
|
113
|
+
>
|
|
107
114
|
{children}
|
|
108
115
|
</Animated.Text>
|
|
109
116
|
);
|
|
@@ -57,7 +57,12 @@ export default function BottomTabBar({
|
|
|
57
57
|
const useFloating = floatingButton && state.routes.length % 2 === 0;
|
|
58
58
|
const itemWidth = widthDevice / (state.routes.length + (useFloating ? 1 : 0));
|
|
59
59
|
// const buildLink = useLinkBuilder();
|
|
60
|
-
const indicatorAnimated = React.useRef(
|
|
60
|
+
const indicatorAnimated = React.useRef(
|
|
61
|
+
new Animated.Value(0, {
|
|
62
|
+
useNativeDriver: true,
|
|
63
|
+
unstable_disableBatchingForNativeCreate: true,
|
|
64
|
+
}),
|
|
65
|
+
).current;
|
|
61
66
|
const insets = useSafeAreaInsets();
|
|
62
67
|
const paddingBottom = getPaddingBottom(insets);
|
|
63
68
|
const focusedTab = state?.routes[state.index]?.name || routes[0]?.params;
|
|
@@ -42,8 +42,18 @@ const TabScreen: React.FC<any> = ({ route, navigation }) => {
|
|
|
42
42
|
|
|
43
43
|
const opacityValue = 0.3;
|
|
44
44
|
const scaleValue = 0.97;
|
|
45
|
-
const opacity = useRef(
|
|
46
|
-
|
|
45
|
+
const opacity = useRef(
|
|
46
|
+
new Animated.Value(opacityValue, {
|
|
47
|
+
useNativeDriver: true,
|
|
48
|
+
unstable_disableBatchingForNativeCreate: true,
|
|
49
|
+
}),
|
|
50
|
+
).current;
|
|
51
|
+
const scale = useRef(
|
|
52
|
+
new Animated.Value(scaleValue, {
|
|
53
|
+
useNativeDriver: true,
|
|
54
|
+
unstable_disableBatchingForNativeCreate: true,
|
|
55
|
+
}),
|
|
56
|
+
).current;
|
|
47
57
|
const screenName = screen?.name || screen?.type?.name || 'Invalid';
|
|
48
58
|
|
|
49
59
|
const onScreenNavigated = useCallback(
|
|
@@ -233,7 +243,12 @@ const BottomTab: React.FC<BottomTabProps> = ({
|
|
|
233
243
|
const dimensions = useWindowDimensions();
|
|
234
244
|
const insets = useSafeAreaInsets();
|
|
235
245
|
const initialIndex = tabs.findIndex(i => i.name === initialRouteName);
|
|
236
|
-
const indicatorAnimated = useRef(
|
|
246
|
+
const indicatorAnimated = useRef(
|
|
247
|
+
new Animated.Value(0, {
|
|
248
|
+
useNativeDriver: true,
|
|
249
|
+
unstable_disableBatchingForNativeCreate: true,
|
|
250
|
+
}),
|
|
251
|
+
);
|
|
237
252
|
const activeIndex = useRef(initialIndex > 0 ? initialIndex : 0);
|
|
238
253
|
const itemWidth = dimensions.width / tabs.length;
|
|
239
254
|
|
|
@@ -13,7 +13,10 @@ const LinearGradientAnimated = Animated.createAnimatedComponent(LinearGradient);
|
|
|
13
13
|
* header background for default
|
|
14
14
|
*/
|
|
15
15
|
const HeaderBackground: React.FC<HeaderBackgroundProps> = ({
|
|
16
|
-
animatedValue = new Animated.Value(0
|
|
16
|
+
animatedValue = new Animated.Value(0, {
|
|
17
|
+
useNativeDriver: true,
|
|
18
|
+
unstable_disableBatchingForNativeCreate: true,
|
|
19
|
+
}),
|
|
17
20
|
useGradient = true,
|
|
18
21
|
useShadowHeader = true,
|
|
19
22
|
gradientColor: customGradientColor,
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import React, {Ref, useContext, useEffect, useRef} from 'react';
|
|
1
|
+
import React, { Ref, useContext, useEffect, useRef } from 'react';
|
|
2
2
|
import LinearGradient from 'react-native-linear-gradient';
|
|
3
|
-
import {ApplicationContext, MiniAppContext} from '../index';
|
|
4
|
-
import {Animated, Dimensions, Platform, StyleSheet, View} from 'react-native';
|
|
5
|
-
import {HeaderType} from '../../Layout/types';
|
|
6
|
-
import {InputRef, InputSearch} from '../../Input';
|
|
3
|
+
import { ApplicationContext, MiniAppContext } from '../index';
|
|
4
|
+
import { Animated, Dimensions, Platform, StyleSheet, View } from 'react-native';
|
|
5
|
+
import { HeaderType } from '../../Layout/types';
|
|
6
|
+
import { InputRef, InputSearch } from '../../Input';
|
|
7
7
|
import Navigation from '../Navigation';
|
|
8
|
-
import {Colors, Radius, Spacing} from '../../Consts';
|
|
9
|
-
import {Image} from '../../Image';
|
|
10
|
-
import {SearchHeaderProps} from '../types';
|
|
8
|
+
import { Colors, Radius, Spacing } from '../../Consts';
|
|
9
|
+
import { Image } from '../../Image';
|
|
10
|
+
import { SearchHeaderProps } from '../types';
|
|
11
11
|
import BackgroundImageView from './BackgroundImageView';
|
|
12
12
|
|
|
13
13
|
const SCREEN_PADDING = 12;
|
|
14
14
|
const BACK_WIDTH = 28;
|
|
15
15
|
|
|
16
|
-
const {width: screenWidth} = Dimensions.get('window');
|
|
16
|
+
const { width: screenWidth } = Dimensions.get('window');
|
|
17
17
|
const LinearGradientAnimated = Animated.createAnimatedComponent(LinearGradient);
|
|
18
18
|
|
|
19
19
|
/**
|
|
@@ -42,8 +42,13 @@ const HeaderExtendHeader: React.FC<{
|
|
|
42
42
|
gradientColor: customGradientColor,
|
|
43
43
|
headerBackground: customBackground,
|
|
44
44
|
}) => {
|
|
45
|
-
const {theme} = useContext(ApplicationContext);
|
|
46
|
-
const animated = useRef(
|
|
45
|
+
const { theme } = useContext(ApplicationContext);
|
|
46
|
+
const animated = useRef(
|
|
47
|
+
new Animated.Value(0, {
|
|
48
|
+
useNativeDriver: true,
|
|
49
|
+
unstable_disableBatchingForNativeCreate: true,
|
|
50
|
+
}),
|
|
51
|
+
);
|
|
47
52
|
const gradientColor = customGradientColor ?? theme.colors.gradient;
|
|
48
53
|
const headerBackground = customBackground ?? theme.assets?.headerBackground;
|
|
49
54
|
const leftPosition = inputSearchProps?.leftPosition || BACK_WIDTH + 20;
|
|
@@ -60,7 +65,7 @@ const HeaderExtendHeader: React.FC<{
|
|
|
60
65
|
});
|
|
61
66
|
|
|
62
67
|
useEffect(() => {
|
|
63
|
-
const listener = animatedValue.addListener(({value}) => {
|
|
68
|
+
const listener = animatedValue.addListener(({ value }) => {
|
|
64
69
|
animated.current.setValue(value);
|
|
65
70
|
});
|
|
66
71
|
return () => {
|
|
@@ -95,8 +100,8 @@ const HeaderExtendHeader: React.FC<{
|
|
|
95
100
|
|
|
96
101
|
if (inputSearchProps) {
|
|
97
102
|
return (
|
|
98
|
-
<View style={{zIndex: 0}}>
|
|
99
|
-
<Animated.View style={{height: height}} />
|
|
103
|
+
<View style={{ zIndex: 0 }}>
|
|
104
|
+
<Animated.View style={{ height: height }} />
|
|
100
105
|
<BackgroundImageView
|
|
101
106
|
useShadowHeader={useShadowHeader}
|
|
102
107
|
heightHeader={heightHeader}
|
|
@@ -106,16 +111,18 @@ const HeaderExtendHeader: React.FC<{
|
|
|
106
111
|
<Animated.View
|
|
107
112
|
style={[
|
|
108
113
|
styles.headerBox,
|
|
109
|
-
{height: headerType === 'extended' ? height : heightHeader},
|
|
110
|
-
]}
|
|
114
|
+
{ height: headerType === 'extended' ? height : heightHeader },
|
|
115
|
+
]}
|
|
116
|
+
>
|
|
111
117
|
{!!gradientColor && (
|
|
112
118
|
<LinearGradientAnimated
|
|
113
119
|
colors={[gradientColor, gradientColor + '00']}
|
|
114
|
-
style={[styles.extendedHeader, {opacity: opacityGradient}]}
|
|
120
|
+
style={[styles.extendedHeader, { opacity: opacityGradient }]}
|
|
121
|
+
>
|
|
115
122
|
{!!theme.assets?.headerBackground && (
|
|
116
123
|
<Image
|
|
117
124
|
style={styles.headerBackground}
|
|
118
|
-
source={{uri: theme.assets?.headerBackground}}
|
|
125
|
+
source={{ uri: theme.assets?.headerBackground }}
|
|
119
126
|
loading={false}
|
|
120
127
|
/>
|
|
121
128
|
)}
|
|
@@ -128,10 +135,11 @@ const HeaderExtendHeader: React.FC<{
|
|
|
128
135
|
height,
|
|
129
136
|
position: 'absolute',
|
|
130
137
|
zIndex: 2,
|
|
131
|
-
}}
|
|
138
|
+
}}
|
|
139
|
+
>
|
|
132
140
|
<Animated.View
|
|
133
141
|
style={{
|
|
134
|
-
transform: [{translateX}],
|
|
142
|
+
transform: [{ translateX }],
|
|
135
143
|
marginVertical: Spacing.S,
|
|
136
144
|
width: animated.current.interpolate({
|
|
137
145
|
inputRange: [0, 100],
|
|
@@ -141,8 +149,9 @@ const HeaderExtendHeader: React.FC<{
|
|
|
141
149
|
],
|
|
142
150
|
extrapolate: 'clamp',
|
|
143
151
|
}),
|
|
144
|
-
}}
|
|
145
|
-
|
|
152
|
+
}}
|
|
153
|
+
>
|
|
154
|
+
<Animated.View style={{ backgroundColor, borderRadius: Radius.XL }}>
|
|
146
155
|
<InputSearch
|
|
147
156
|
{...inputSearchProps}
|
|
148
157
|
ref={inputSearchRef}
|
|
@@ -159,7 +168,7 @@ const HeaderExtendHeader: React.FC<{
|
|
|
159
168
|
|
|
160
169
|
if (headerType === 'extended') {
|
|
161
170
|
return (
|
|
162
|
-
<View style={{zIndex: 0}}>
|
|
171
|
+
<View style={{ zIndex: 0 }}>
|
|
163
172
|
<BackgroundImageView
|
|
164
173
|
useShadowHeader={useShadowHeader}
|
|
165
174
|
heightHeader={heightHeader}
|
|
@@ -169,17 +178,18 @@ const HeaderExtendHeader: React.FC<{
|
|
|
169
178
|
{!!gradientColor && (
|
|
170
179
|
<LinearGradientAnimated
|
|
171
180
|
colors={[gradientColor, gradientColor + '00']}
|
|
172
|
-
style={[styles.extendedHeader, {opacity: opacityGradient}]}
|
|
181
|
+
style={[styles.extendedHeader, { opacity: opacityGradient }]}
|
|
182
|
+
>
|
|
173
183
|
{!!headerBackground && (
|
|
174
184
|
<Image
|
|
175
185
|
style={styles.headerBackground}
|
|
176
|
-
source={{uri: headerBackground}}
|
|
186
|
+
source={{ uri: headerBackground }}
|
|
177
187
|
loading={false}
|
|
178
188
|
/>
|
|
179
189
|
)}
|
|
180
190
|
</LinearGradientAnimated>
|
|
181
191
|
)}
|
|
182
|
-
<View style={{height: heightHeader}} />
|
|
192
|
+
<View style={{ height: heightHeader }} />
|
|
183
193
|
<Verified />
|
|
184
194
|
</View>
|
|
185
195
|
);
|
|
@@ -223,4 +233,4 @@ const styles = StyleSheet.create({
|
|
|
223
233
|
},
|
|
224
234
|
});
|
|
225
235
|
|
|
226
|
-
export {HeaderExtendHeader};
|
|
236
|
+
export { HeaderExtendHeader };
|
|
@@ -20,7 +20,12 @@ const SearchHeader = React.forwardRef<InputRef, SearchHeaderProps>(
|
|
|
20
20
|
const { theme, navigator } = useContext(ApplicationContext);
|
|
21
21
|
const context = useContext<any>(MiniAppContext);
|
|
22
22
|
|
|
23
|
-
const animated = useRef(
|
|
23
|
+
const animated = useRef(
|
|
24
|
+
new Animated.Value(0, {
|
|
25
|
+
useNativeDriver: true,
|
|
26
|
+
unstable_disableBatchingForNativeCreate: true,
|
|
27
|
+
}),
|
|
28
|
+
);
|
|
24
29
|
|
|
25
30
|
useEffect(() => {
|
|
26
31
|
const listener = animatedValue?.addListener(({ value }) => {
|
|
@@ -33,8 +33,18 @@ const Modal: React.FC<ModalParams> = props => {
|
|
|
33
33
|
useNativeModal = false,
|
|
34
34
|
} = props.route.params;
|
|
35
35
|
const Component = useRef(screen).current;
|
|
36
|
-
const opacity = useRef(
|
|
37
|
-
|
|
36
|
+
const opacity = useRef(
|
|
37
|
+
new Animated.Value(0, {
|
|
38
|
+
useNativeDriver: true,
|
|
39
|
+
unstable_disableBatchingForNativeCreate: true,
|
|
40
|
+
}),
|
|
41
|
+
).current;
|
|
42
|
+
const scale = useRef(
|
|
43
|
+
new Animated.Value(0.8, {
|
|
44
|
+
useNativeDriver: true,
|
|
45
|
+
unstable_disableBatchingForNativeCreate: true,
|
|
46
|
+
}),
|
|
47
|
+
).current;
|
|
38
48
|
|
|
39
49
|
const navigation = new Navigation(props.navigation);
|
|
40
50
|
const params = {
|
package/Application/utils.tsx
CHANGED
|
@@ -36,8 +36,6 @@ const getStackOptions = (): StackNavigationOptions => {
|
|
|
36
36
|
headerRight: (props: any) => <HeaderRight {...props} />,
|
|
37
37
|
headerTintColor: Colors.black_17,
|
|
38
38
|
gestureEnabled: false,
|
|
39
|
-
freezeOnBlur: true,
|
|
40
|
-
animation: 'none',
|
|
41
39
|
...TransitionPresets.SlideFromRightIOS,
|
|
42
40
|
};
|
|
43
41
|
};
|
|
@@ -7,9 +7,24 @@ const DURATION = 500;
|
|
|
7
7
|
|
|
8
8
|
const BadgeDotAnimation = ({ size, style }: BadgeDotProps) => {
|
|
9
9
|
// Refs for animated values
|
|
10
|
-
const scaleAnim = useRef(
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
const scaleAnim = useRef(
|
|
11
|
+
new Animated.Value(1, {
|
|
12
|
+
useNativeDriver: true,
|
|
13
|
+
unstable_disableBatchingForNativeCreate: true,
|
|
14
|
+
}),
|
|
15
|
+
).current;
|
|
16
|
+
const waveScaleAnim = useRef(
|
|
17
|
+
new Animated.Value(1, {
|
|
18
|
+
useNativeDriver: true,
|
|
19
|
+
unstable_disableBatchingForNativeCreate: true,
|
|
20
|
+
}),
|
|
21
|
+
).current;
|
|
22
|
+
const waveOpacityAnim = useRef(
|
|
23
|
+
new Animated.Value(0, {
|
|
24
|
+
useNativeDriver: true,
|
|
25
|
+
unstable_disableBatchingForNativeCreate: true,
|
|
26
|
+
}),
|
|
27
|
+
).current;
|
|
13
28
|
|
|
14
29
|
const dotStyle =
|
|
15
30
|
size === 'small' ? styles.dotAnimationSmall : styles.dotAnimation;
|
package/Input/InputOTP.tsx
CHANGED
|
@@ -30,7 +30,12 @@ import SystemTextInput from './SystemTextInput';
|
|
|
30
30
|
const OTPCaret: FC<CaretProps> = ({ index, length }) => {
|
|
31
31
|
const DURATION = 300;
|
|
32
32
|
const { theme } = useContext(ApplicationContext);
|
|
33
|
-
const opacity = useRef(
|
|
33
|
+
const opacity = useRef(
|
|
34
|
+
new Animated.Value(0, {
|
|
35
|
+
useNativeDriver: true,
|
|
36
|
+
unstable_disableBatchingForNativeCreate: true,
|
|
37
|
+
}),
|
|
38
|
+
).current;
|
|
34
39
|
|
|
35
40
|
useEffect(() => {
|
|
36
41
|
Animated.loop(
|
|
@@ -41,7 +41,12 @@ export const FloatingButton: React.FC<FloatingButtonProps> = ({
|
|
|
41
41
|
const { theme } = useContext(ApplicationContext);
|
|
42
42
|
const maxWidth = useRef(0);
|
|
43
43
|
const minWidth = size === 'small' ? 36 : 48;
|
|
44
|
-
const [opacityAnimated] = useState(
|
|
44
|
+
const [opacityAnimated] = useState(
|
|
45
|
+
new Animated.Value(0, {
|
|
46
|
+
useNativeDriver: true,
|
|
47
|
+
unstable_disableBatchingForNativeCreate: true,
|
|
48
|
+
}),
|
|
49
|
+
); // Initial opacity set to 0
|
|
45
50
|
const [widthAnimated, setWidthAnimated] = useState<Animated.Value>();
|
|
46
51
|
const lastOffset = useRef(0);
|
|
47
52
|
const lastDirection = useRef<string>(null);
|
|
@@ -100,7 +105,12 @@ export const FloatingButton: React.FC<FloatingButtonProps> = ({
|
|
|
100
105
|
const layout = event.nativeEvent.layout;
|
|
101
106
|
if (widthAnimated) return;
|
|
102
107
|
maxWidth.current = layout.width;
|
|
103
|
-
setWidthAnimated(
|
|
108
|
+
setWidthAnimated(
|
|
109
|
+
new Animated.Value(layout.width, {
|
|
110
|
+
useNativeDriver: true,
|
|
111
|
+
unstable_disableBatchingForNativeCreate: true,
|
|
112
|
+
}),
|
|
113
|
+
);
|
|
104
114
|
};
|
|
105
115
|
|
|
106
116
|
if (renderComponent) {
|
package/Layout/Screen.tsx
CHANGED
|
@@ -194,7 +194,7 @@ const Screen = forwardRef(
|
|
|
194
194
|
const insets = useSafeAreaInsets();
|
|
195
195
|
const heightHeader = useHeaderHeight();
|
|
196
196
|
const animatedValue = useRef<Animated.Value>(
|
|
197
|
-
customAnimatedValue || new Animated.Value(0),
|
|
197
|
+
customAnimatedValue || new Animated.Value(0, {useNativeDriver: true, unstable_disableBatchingForNativeCreate: true}),
|
|
198
198
|
);
|
|
199
199
|
const currentTint = useRef<string | undefined>(undefined);
|
|
200
200
|
const isTab = navigation?.instance?.getState?.()?.type === 'tab';
|
package/Loader/ProgressBar.tsx
CHANGED
|
@@ -1,13 +1,18 @@
|
|
|
1
|
-
import React, {FC, useContext, useEffect, useRef} from 'react';
|
|
2
|
-
import {Animated, View} from 'react-native';
|
|
1
|
+
import React, { FC, useContext, useEffect, useRef } from 'react';
|
|
2
|
+
import { Animated, View } from 'react-native';
|
|
3
3
|
import styles from './styles';
|
|
4
|
-
import {ProgressBarProps} from './types';
|
|
5
|
-
import {ApplicationContext} from '../Application';
|
|
6
|
-
import {Radius} from '../Consts';
|
|
4
|
+
import { ProgressBarProps } from './types';
|
|
5
|
+
import { ApplicationContext } from '../Application';
|
|
6
|
+
import { Radius } from '../Consts';
|
|
7
7
|
|
|
8
|
-
const ProgressBar: FC<ProgressBarProps> = ({percent = 0, style}) => {
|
|
9
|
-
const {theme} = useContext(ApplicationContext);
|
|
10
|
-
const animation = useRef(
|
|
8
|
+
const ProgressBar: FC<ProgressBarProps> = ({ percent = 0, style }) => {
|
|
9
|
+
const { theme } = useContext(ApplicationContext);
|
|
10
|
+
const animation = useRef(
|
|
11
|
+
new Animated.Value(0, {
|
|
12
|
+
useNativeDriver: true,
|
|
13
|
+
unstable_disableBatchingForNativeCreate: true,
|
|
14
|
+
}),
|
|
15
|
+
).current;
|
|
11
16
|
|
|
12
17
|
useEffect(() => {
|
|
13
18
|
Animated.timing(animation, {
|
|
@@ -27,8 +32,9 @@ const ProgressBar: FC<ProgressBarProps> = ({percent = 0, style}) => {
|
|
|
27
32
|
style={[
|
|
28
33
|
style,
|
|
29
34
|
styles.progressContainer,
|
|
30
|
-
{backgroundColor: theme.colors.background.default},
|
|
31
|
-
]}
|
|
35
|
+
{ backgroundColor: theme.colors.background.default },
|
|
36
|
+
]}
|
|
37
|
+
>
|
|
32
38
|
<Animated.View
|
|
33
39
|
style={{
|
|
34
40
|
height: 4,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import React, {FC, useContext, useRef, useState} from 'react';
|
|
2
|
-
import {Animated, View} from 'react-native';
|
|
3
|
-
import {ScrollIndicatorProps} from './types';
|
|
1
|
+
import React, { FC, useContext, useRef, useState } from 'react';
|
|
2
|
+
import { Animated, View } from 'react-native';
|
|
3
|
+
import { ScrollIndicatorProps } from './types';
|
|
4
4
|
import styles from './styles';
|
|
5
|
-
import {ApplicationContext} from '../Application';
|
|
5
|
+
import { ApplicationContext } from '../Application';
|
|
6
6
|
|
|
7
7
|
const INDICATOR_WIDTH = 24;
|
|
8
8
|
const INDICATOR_CONTAINER_WIDTH = 72;
|
|
@@ -11,8 +11,13 @@ const PaginationScroll: FC<ScrollIndicatorProps> = ({
|
|
|
11
11
|
children,
|
|
12
12
|
scrollViewRef,
|
|
13
13
|
}) => {
|
|
14
|
-
const {theme} = useContext(ApplicationContext);
|
|
15
|
-
const left = useRef(
|
|
14
|
+
const { theme } = useContext(ApplicationContext);
|
|
15
|
+
const left = useRef(
|
|
16
|
+
new Animated.Value(0, {
|
|
17
|
+
useNativeDriver: true,
|
|
18
|
+
unstable_disableBatchingForNativeCreate: true,
|
|
19
|
+
}),
|
|
20
|
+
).current;
|
|
16
21
|
const [scrollViewWidth, setScrollViewWidth] = useState(0);
|
|
17
22
|
const [scrollContentWidth, setScrollContentWidth] = useState(0);
|
|
18
23
|
|
|
@@ -23,7 +28,7 @@ const PaginationScroll: FC<ScrollIndicatorProps> = ({
|
|
|
23
28
|
outputRange: [0, INDICATOR_CONTAINER_WIDTH - INDICATOR_WIDTH],
|
|
24
29
|
extrapolate: 'clamp',
|
|
25
30
|
});
|
|
26
|
-
return {transform: [{translateX: value}]};
|
|
31
|
+
return { transform: [{ translateX: value }] };
|
|
27
32
|
}
|
|
28
33
|
return {};
|
|
29
34
|
};
|
|
@@ -42,7 +47,7 @@ const PaginationScroll: FC<ScrollIndicatorProps> = ({
|
|
|
42
47
|
},
|
|
43
48
|
},
|
|
44
49
|
],
|
|
45
|
-
{useNativeDriver: true}
|
|
50
|
+
{ useNativeDriver: true },
|
|
46
51
|
)}
|
|
47
52
|
alwaysBounceHorizontal={false}
|
|
48
53
|
showsHorizontalScrollIndicator={false}
|
|
@@ -53,7 +58,8 @@ const PaginationScroll: FC<ScrollIndicatorProps> = ({
|
|
|
53
58
|
}}
|
|
54
59
|
onLayout={e => {
|
|
55
60
|
setScrollViewWidth(e.nativeEvent.layout.width);
|
|
56
|
-
}}
|
|
61
|
+
}}
|
|
62
|
+
>
|
|
57
63
|
{children}
|
|
58
64
|
</Animated.ScrollView>
|
|
59
65
|
);
|
|
@@ -63,8 +69,9 @@ const PaginationScroll: FC<ScrollIndicatorProps> = ({
|
|
|
63
69
|
<View
|
|
64
70
|
style={[
|
|
65
71
|
styles.indicatorContainer,
|
|
66
|
-
{backgroundColor: theme.colors.background.pressed},
|
|
67
|
-
]}
|
|
72
|
+
{ backgroundColor: theme.colors.background.pressed },
|
|
73
|
+
]}
|
|
74
|
+
>
|
|
68
75
|
<Animated.View
|
|
69
76
|
style={[
|
|
70
77
|
styles.indicator,
|
package/Skeleton/index.tsx
CHANGED
|
@@ -20,7 +20,12 @@ const Skeleton: React.FC<SkeletonTypes> = ({ style }) => {
|
|
|
20
20
|
const PRIMARY_COLOR = Colors.black_05;
|
|
21
21
|
const HIGHLIGHT_COLOR1 = Colors.black_05;
|
|
22
22
|
const HIGHLIGHT_COLOR2 = Colors.black_03;
|
|
23
|
-
const beginShimmerPosition = useRef(
|
|
23
|
+
const beginShimmerPosition = useRef(
|
|
24
|
+
new Animated.Value(0, {
|
|
25
|
+
useNativeDriver: true,
|
|
26
|
+
unstable_disableBatchingForNativeCreate: true,
|
|
27
|
+
}),
|
|
28
|
+
).current;
|
|
24
29
|
|
|
25
30
|
const shimmerColors = [HIGHLIGHT_COLOR1, HIGHLIGHT_COLOR2, HIGHLIGHT_COLOR1];
|
|
26
31
|
const linearTranslate = beginShimmerPosition.interpolate({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@momo-kits/foundation",
|
|
3
|
-
"version": "0.150.2-beta.
|
|
3
|
+
"version": "0.150.2-beta.test.15",
|
|
4
4
|
"description": "React Native Component Kits",
|
|
5
5
|
"main": "index.ts",
|
|
6
6
|
"scripts": {},
|
|
@@ -32,4 +32,4 @@
|
|
|
32
32
|
"registry": "https://registry.npmjs.org/"
|
|
33
33
|
},
|
|
34
34
|
"license": "MoMo"
|
|
35
|
-
}
|
|
35
|
+
}
|