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