@momo-kits/foundation 0.150.2-beta.33 → 0.150.2-beta.35

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.
@@ -37,7 +37,6 @@ const TabScreen: React.FC<any> = ({ route, navigation }) => {
37
37
  const { navigator } = useContext(ApplicationContext);
38
38
  const context = useContext<any>(MiniAppContext);
39
39
  const { nested, options, screen, initialParams } = route?.params;
40
- const useAnimation = route?.params?.useAnimation ?? true;
41
40
  const insets = useSafeAreaInsets();
42
41
 
43
42
  const opacityValue = 0.3;
@@ -74,75 +73,78 @@ const TabScreen: React.FC<any> = ({ route, navigation }) => {
74
73
  );
75
74
 
76
75
  useFocusEffect(
77
- React.useCallback(() => {
78
- Animated.parallel([
79
- Animated.timing(opacity, {
80
- toValue: 1,
81
- duration: 200,
82
- useNativeDriver: true,
83
- }),
84
- Animated.timing(scale, {
85
- toValue: 1,
86
- duration: 200,
87
- useNativeDriver: true,
88
- }),
89
- ]).start();
76
+ React.useCallback(
77
+ () => {
78
+ Animated.parallel([
79
+ Animated.timing(opacity, {
80
+ toValue: 1,
81
+ duration: 200,
82
+ useNativeDriver: true,
83
+ }),
84
+ Animated.timing(scale, {
85
+ toValue: 1,
86
+ duration: 200,
87
+ useNativeDriver: true,
88
+ }),
89
+ ]).start();
90
90
 
91
- setTimeout(() => {
92
- navigator?.maxApi?.getDataObserver?.('current_screen', (data: any) => {
93
- onScreenNavigated(data?.screenName, screenName);
94
- navigator?.maxApi?.setObserver?.('current_screen', { screenName });
95
- });
96
- }, 100);
91
+ setTimeout(() => {
92
+ navigator?.maxApi?.getDataObserver?.(
93
+ 'current_screen',
94
+ (data: any) => {
95
+ onScreenNavigated(data?.screenName, screenName);
96
+ navigator?.maxApi?.setObserver?.('current_screen', {
97
+ screenName,
98
+ });
99
+ },
100
+ );
101
+ }, 100);
97
102
 
98
- return () => {
99
- if (navigation.getState().index !== route?.params.index) {
100
- Animated.parallel([
101
- Animated.timing(opacity, {
102
- toValue: opacityValue,
103
- duration: 200,
104
- useNativeDriver: true,
105
- }),
106
- Animated.timing(scale, {
107
- toValue: scaleValue,
108
- duration: 200,
109
- useNativeDriver: true,
110
- }),
111
- ]).start();
112
- }
113
- };
114
- }, [
115
- navigation,
116
- navigator?.maxApi,
117
- onScreenNavigated,
118
- opacity,
119
- route?.params.index,
120
- scale,
121
- screenName,
122
- ]),
103
+ return () => {
104
+ if (navigation.getState().index !== route?.params.index) {
105
+ Animated.parallel([
106
+ Animated.timing(opacity, {
107
+ toValue: opacityValue,
108
+ duration: 200,
109
+ useNativeDriver: true,
110
+ }),
111
+ Animated.timing(scale, {
112
+ toValue: scaleValue,
113
+ duration: 200,
114
+ useNativeDriver: true,
115
+ }),
116
+ ]).start();
117
+ }
118
+ };
119
+ },
120
+ // eslint-disable-next-line react-hooks/exhaustive-deps
121
+ [],
122
+ ),
123
123
  );
124
124
 
125
- useEffect(() => {
126
- const onFocusApp = navigator?.maxApi?.listen?.('onFocusApp', () => {
127
- if (navigation.isFocused()) {
128
- navigator?.maxApi?.getDataObserver?.('current_screen', (data: any) => {
129
- onScreenNavigated(data?.screenName, screenName);
130
- navigator?.maxApi?.setObserver?.('current_screen', { screenName });
131
- });
132
- }
133
- });
134
-
135
- return () => {
136
- onFocusApp?.remove?.();
137
- };
138
- }, [navigation, navigator?.maxApi, onScreenNavigated, screenName]);
125
+ useEffect(
126
+ () => {
127
+ const onFocusApp = navigator?.maxApi?.listen?.('onFocusApp', () => {
128
+ if (navigation.isFocused()) {
129
+ navigator?.maxApi?.getDataObserver?.(
130
+ 'current_screen',
131
+ (data: any) => {
132
+ onScreenNavigated(data?.screenName, screenName);
133
+ navigator?.maxApi?.setObserver?.('current_screen', {
134
+ screenName,
135
+ });
136
+ },
137
+ );
138
+ }
139
+ });
139
140
 
140
- let opacityStyle: undefined | Animated.Value;
141
- let scaleStyle: number | Animated.Value = 1;
142
- if (useAnimation) {
143
- opacityStyle = opacity;
144
- scaleStyle = scale;
145
- }
141
+ return () => {
142
+ onFocusApp?.remove?.();
143
+ };
144
+ },
145
+ // eslint-disable-next-line react-hooks/exhaustive-deps
146
+ [],
147
+ );
146
148
 
147
149
  let stackOptions = {};
148
150
  if (options) {
@@ -155,8 +157,8 @@ const TabScreen: React.FC<any> = ({ route, navigation }) => {
155
157
  style={[
156
158
  styles.container,
157
159
  {
158
- opacity: opacityStyle,
159
- transform: [{ scale: scaleStyle }],
160
+ opacity,
161
+ transform: [{ scale }],
160
162
  },
161
163
  ]}
162
164
  >
@@ -188,8 +190,8 @@ const TabScreen: React.FC<any> = ({ route, navigation }) => {
188
190
  style={[
189
191
  styles.container,
190
192
  {
191
- opacity: opacityStyle,
192
- transform: [{ scale: scaleStyle }],
193
+ opacity,
194
+ transform: [{ scale }],
193
195
  },
194
196
  ]}
195
197
  >
@@ -227,7 +229,6 @@ const BottomTab: React.FC<BottomTabProps> = ({
227
229
  navigation,
228
230
  initialRouteName,
229
231
  floatingButton,
230
- useAnimation = true,
231
232
  }) => {
232
233
  const { theme, navigator } = useContext(ApplicationContext);
233
234
  const dimensions = useWindowDimensions();
@@ -340,7 +341,7 @@ const BottomTab: React.FC<BottomTabProps> = ({
340
341
  key={`BottomTab-${item.name}`}
341
342
  name={item.name}
342
343
  component={TabScreen}
343
- initialParams={{ ...item, nested, index, useAnimation }}
344
+ initialParams={{ ...item, nested, index }}
344
345
  listeners={handler}
345
346
  options={{
346
347
  tabBarLabel: ({ focused, color }) => {
@@ -269,7 +269,6 @@ export type BottomTabProps = {
269
269
  blur?: (e: EventArg<'blur', false, unknown>) => void;
270
270
  };
271
271
  floatingButton?: FloatingButtonProps;
272
- useAnimation?: boolean;
273
272
  };
274
273
 
275
274
  export type FloatingButtonProps = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@momo-kits/foundation",
3
- "version": "0.150.2-beta.33",
3
+ "version": "0.150.2-beta.35",
4
4
  "description": "React Native Component Kits",
5
5
  "main": "index.ts",
6
6
  "scripts": {},