@momo-kits/foundation 0.113.1-beta.0 → 0.113.1-beta.2
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/Button/index.tsx +11 -1
- package/Text/index.tsx +16 -4
- package/package.json +1 -1
package/Button/index.tsx
CHANGED
|
@@ -7,13 +7,18 @@ import {
|
|
|
7
7
|
View,
|
|
8
8
|
} from 'react-native';
|
|
9
9
|
import LinearGradient from 'react-native-linear-gradient';
|
|
10
|
-
import {
|
|
10
|
+
import {
|
|
11
|
+
ApplicationContext,
|
|
12
|
+
ComponentContext,
|
|
13
|
+
SkeletonContext,
|
|
14
|
+
} from '../Application';
|
|
11
15
|
import {Text} from '../Text';
|
|
12
16
|
import {Typography} from '../Text/types';
|
|
13
17
|
import {Colors, Spacing} from '../Consts';
|
|
14
18
|
import styles from './styles';
|
|
15
19
|
import {Icon} from '../Icon';
|
|
16
20
|
import {Loader} from '../Loader';
|
|
21
|
+
import {Skeleton} from '../Skeleton';
|
|
17
22
|
|
|
18
23
|
const AnimationLinear = Animated.createAnimatedComponent(LinearGradient);
|
|
19
24
|
|
|
@@ -88,6 +93,7 @@ const Button: FC<ButtonProps> = ({
|
|
|
88
93
|
...rest
|
|
89
94
|
}) => {
|
|
90
95
|
const {theme, config} = useContext(ApplicationContext);
|
|
96
|
+
const skeleton = useContext(SkeletonContext);
|
|
91
97
|
const {gradient, color} = config?.navigationBar?.buttonColors ?? {};
|
|
92
98
|
let gradientPros;
|
|
93
99
|
let state = 'enabled';
|
|
@@ -289,6 +295,10 @@ const Button: FC<ButtonProps> = ({
|
|
|
289
295
|
full && {width: '100%'},
|
|
290
296
|
]);
|
|
291
297
|
|
|
298
|
+
if (skeleton?.loading) {
|
|
299
|
+
return <Skeleton style={[buttonStyle, {paddingHorizontal: 0}]} />;
|
|
300
|
+
}
|
|
301
|
+
|
|
292
302
|
return (
|
|
293
303
|
<ComponentContext.Provider
|
|
294
304
|
value={{
|
package/Text/index.tsx
CHANGED
|
@@ -141,13 +141,25 @@ const Text: React.FC<TextProps> = ({
|
|
|
141
141
|
|
|
142
142
|
if (skeleton.loading) {
|
|
143
143
|
return (
|
|
144
|
-
<View>
|
|
145
|
-
<
|
|
144
|
+
<View style={style}>
|
|
145
|
+
<RNText
|
|
146
|
+
{...rest}
|
|
147
|
+
{...setAutomationID(rest.accessibilityLabel)}
|
|
148
|
+
allowFontScaling={false}
|
|
146
149
|
style={[
|
|
147
150
|
style,
|
|
148
151
|
textStyle,
|
|
149
|
-
{
|
|
150
|
-
|
|
152
|
+
{
|
|
153
|
+
color: color ?? theme.colors.text.default,
|
|
154
|
+
},
|
|
155
|
+
]}>
|
|
156
|
+
{children ?? ''}
|
|
157
|
+
</RNText>
|
|
158
|
+
<Skeleton
|
|
159
|
+
style={{
|
|
160
|
+
position: 'absolute',
|
|
161
|
+
height: textStyle?.lineHeight * (rest.numberOfLines ?? 1),
|
|
162
|
+
}}
|
|
151
163
|
/>
|
|
152
164
|
</View>
|
|
153
165
|
);
|