@momo-kits/foundation 0.92.6-rc.15 → 0.92.6-rc.17

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.
@@ -12,8 +12,7 @@ import {
12
12
  } from './Components';
13
13
  import {NavigationOptions, Theme} from './types';
14
14
  import {Colors} from '../Consts';
15
- import {Platform} from 'react-native';
16
- const isIOS = Platform.OS === 'ios';
15
+
17
16
  /**
18
17
  * default options for stack screen
19
18
  */
@@ -142,22 +141,6 @@ const getOptions = (params: NavigationOptions, theme: Theme) => {
142
141
  };
143
142
  };
144
143
 
145
- const getAccessibilityID = (
146
- key = '',
147
- override: string | undefined = undefined,
148
- ) => {
149
- if (isIOS) {
150
- return {
151
- accessible: true,
152
- testID: override || key,
153
- };
154
- } else {
155
- return {
156
- accessibilityLabel: override || key,
157
- };
158
- }
159
- };
160
-
161
144
  const formatNameLength = (name = '') => {
162
145
  let formattedName = name;
163
146
  if (formattedName.length > 100) {
@@ -171,5 +154,4 @@ export {
171
154
  getModalOptions,
172
155
  getOptions,
173
156
  formatNameLength,
174
- getAccessibilityID,
175
157
  };
package/Icon/index.tsx CHANGED
@@ -33,6 +33,7 @@ const Icon: React.FC<IconProps> = ({
33
33
  loading={false}
34
34
  source={getIconSource()}
35
35
  style={[style, {width: size, height: size}]}
36
+ resizeMode='contain'
36
37
  {...tintColorProps}
37
38
  />
38
39
  );
@@ -4,6 +4,7 @@ import {
4
4
  LayoutChangeEvent,
5
5
  StyleSheet,
6
6
  TouchableOpacity,
7
+ View,
7
8
  } from 'react-native';
8
9
  import {ApplicationContext} from '../Application';
9
10
  import {Icon} from '../Icon';
@@ -18,9 +19,11 @@ export interface FloatingButtonProps {
18
19
  size?: 'small' | 'large';
19
20
  animatedValue?: Animated.Value;
20
21
  bottom?: number;
22
+ renderComponent?: () => React.ReactNode;
21
23
  }
22
24
 
23
25
  export const FloatingButton: React.FC<FloatingButtonProps> = ({
26
+ renderComponent,
24
27
  label = '',
25
28
  onPress = () => {},
26
29
  position = 'right',
@@ -49,17 +52,17 @@ export const FloatingButton: React.FC<FloatingButtonProps> = ({
49
52
  if (down) {
50
53
  Animated.timing(widthAnimated!, {
51
54
  toValue: minWidth,
52
- duration: 300,
55
+ duration: 200,
53
56
  useNativeDriver: false,
54
57
  }).start(() => setShowText(false));
55
58
  } else {
56
59
  Animated.timing(widthAnimated!, {
57
60
  toValue: maxWidth.current,
58
- duration: 300,
61
+ duration: 200,
59
62
  useNativeDriver: false,
60
63
  }).start(() => setShowText(true));
61
64
  }
62
- }, 500);
65
+ }, 300);
63
66
  });
64
67
 
65
68
  return () => {
@@ -76,6 +79,23 @@ export const FloatingButton: React.FC<FloatingButtonProps> = ({
76
79
  setWidthAnimated(new Animated.Value(layout.width));
77
80
  };
78
81
 
82
+ if (renderComponent) {
83
+ return (
84
+ <View
85
+ onLayout={handleLayout}
86
+ style={[
87
+ styles.container,
88
+ {
89
+ right: position === 'right' ? 12 : undefined,
90
+ alignSelf: position === 'center' ? 'center' : 'flex-end',
91
+ bottom,
92
+ },
93
+ ]}>
94
+ {renderComponent()}
95
+ </View>
96
+ );
97
+ }
98
+
79
99
  return (
80
100
  <Animated.View
81
101
  onLayout={handleLayout}
@@ -199,16 +199,20 @@ const PopupNotify: React.FC<PopupNotifyProps> = ({
199
199
  {title}
200
200
  </Text>
201
201
  <Description style={[styles.description, descriptionStyle]}>
202
- <Text
203
- typography={'body_default_regular'}
204
- onTextLayout={({nativeEvent: {lines}}) => {
205
- const enableScroll = lines.length > 3;
206
- if (enableScroll != scrollContent) {
207
- setScrollContent(enableScroll);
208
- }
209
- }}>
210
- {description}
211
- </Text>
202
+ {typeof description === 'string' ? (
203
+ <Text
204
+ typography={'body_default_regular'}
205
+ onTextLayout={({nativeEvent: {lines}}) => {
206
+ const enableScroll = lines.length > 3;
207
+ if (enableScroll != scrollContent) {
208
+ setScrollContent(enableScroll);
209
+ }
210
+ }}>
211
+ {description}
212
+ </Text>
213
+ ) : (
214
+ description
215
+ )}
212
216
  </Description>
213
217
  {!!error && (
214
218
  <View style={styles.information}>
package/index.ts CHANGED
@@ -4,12 +4,11 @@ import {
4
4
  useSafeAreaInsets,
5
5
  } from 'react-native-safe-area-context';
6
6
  import LinearGradient from 'react-native-linear-gradient';
7
- import {getAccessibilityID} from "./Application/utils";
8
7
 
9
8
  /**
10
9
  * native export
11
10
  */
12
- export {SafeAreaView, useSafeAreaInsets, SafeAreaProvider, LinearGradient, getAccessibilityID};
11
+ export {SafeAreaView, useSafeAreaInsets, SafeAreaProvider, LinearGradient};
13
12
 
14
13
  /**
15
14
  * foundation component
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@momo-kits/foundation",
3
- "version": "0.92.6-rc.15",
3
+ "version": "0.92.6-rc.17",
4
4
  "description": "React Native Component Kits",
5
5
  "main": "index.ts",
6
6
  "scripts": {},