@momo-kits/foundation 1.0.0
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/Assets/header-background.png +0 -0
- package/Button/index.tsx +307 -0
- package/Button/styles.ts +41 -0
- package/Button/types.ts +18 -0
- package/CheckBox/index.js +74 -0
- package/CheckBox/styles.js +3 -0
- package/Consts/colors+spacing+radius.ts +162 -0
- package/Consts/index.ts +76 -0
- package/Consts/styles.ts +137 -0
- package/ContentLoader/index.tsx +71 -0
- package/ContentLoader/styles.ts +5 -0
- package/ContentLoader/types.ts +3 -0
- package/Divider/index.js +43 -0
- package/Divider/styles.js +10 -0
- package/Icon/icon.json +3935 -0
- package/Icon/index.tsx +30 -0
- package/Icon/types.ts +8 -0
- package/IconButton/index.tsx +127 -0
- package/IconButton/types.ts +17 -0
- package/Image/index.tsx +67 -0
- package/Image/styles.ts +13 -0
- package/Image/types.ts +6 -0
- package/Layout/Row.tsx +42 -0
- package/Layout/Screen.tsx +68 -0
- package/Layout/Section.tsx +30 -0
- package/Layout/View.tsx +84 -0
- package/Layout/index.ts +6 -0
- package/Layout/styles.ts +24 -0
- package/Layout/types.ts +39 -0
- package/Layout/utils.ts +37 -0
- package/Navigation/Components.tsx +55 -0
- package/Navigation/ModalScreen.tsx +177 -0
- package/Navigation/Navigation.ts +34 -0
- package/Navigation/NavigationButton.tsx +25 -0
- package/Navigation/NavigationContainer.tsx +74 -0
- package/Navigation/Navigator.ts +45 -0
- package/Navigation/ScreenContainer.tsx +38 -0
- package/Navigation/StackScreen.tsx +19 -0
- package/Navigation/index.ts +10 -0
- package/Navigation/types.ts +87 -0
- package/Navigation/utils.tsx +84 -0
- package/SizedBox/index.js +23 -0
- package/SizedBox/styles.js +7 -0
- package/Text/index.tsx +164 -0
- package/Text/styles.ts +34 -0
- package/Text/types.ts +47 -0
- package/TextInput/index.js +225 -0
- package/TextInput/styles.js +55 -0
- package/index.ts +18 -0
- package/package.json +41 -0
- package/publish.sh +26 -0
package/Consts/styles.ts
ADDED
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import {StyleSheet} from 'react-native';
|
|
2
|
+
|
|
3
|
+
const Styles = StyleSheet.create({
|
|
4
|
+
flex: {
|
|
5
|
+
flex: 1,
|
|
6
|
+
},
|
|
7
|
+
flexCenter: {
|
|
8
|
+
flex: 1,
|
|
9
|
+
alignItems: 'center',
|
|
10
|
+
justifyContent: 'center',
|
|
11
|
+
},
|
|
12
|
+
row: {
|
|
13
|
+
flexDirection: 'row',
|
|
14
|
+
alignItems: 'center',
|
|
15
|
+
},
|
|
16
|
+
rowSpace: {
|
|
17
|
+
flexDirection: 'row',
|
|
18
|
+
alignItems: 'center',
|
|
19
|
+
justifyContent: 'space-between',
|
|
20
|
+
},
|
|
21
|
+
rowCenter: {
|
|
22
|
+
flexDirection: 'row',
|
|
23
|
+
alignItems: 'center',
|
|
24
|
+
justifyContent: 'center',
|
|
25
|
+
},
|
|
26
|
+
rowWrap: {
|
|
27
|
+
flexDirection: 'row',
|
|
28
|
+
flexWrap: 'wrap',
|
|
29
|
+
},
|
|
30
|
+
columnSpace: {
|
|
31
|
+
flexDirection: 'column',
|
|
32
|
+
alignItems: 'center',
|
|
33
|
+
justifyContent: 'space-between',
|
|
34
|
+
},
|
|
35
|
+
columnSpaceRight: {
|
|
36
|
+
flexDirection: 'column',
|
|
37
|
+
alignItems: 'flex-end',
|
|
38
|
+
justifyContent: 'space-between',
|
|
39
|
+
},
|
|
40
|
+
columnCenter: {
|
|
41
|
+
flexDirection: 'column',
|
|
42
|
+
alignItems: 'center',
|
|
43
|
+
justifyContent: 'center',
|
|
44
|
+
},
|
|
45
|
+
columnCenterRight: {
|
|
46
|
+
flexDirection: 'column',
|
|
47
|
+
alignItems: 'flex-end',
|
|
48
|
+
justifyContent: 'center',
|
|
49
|
+
},
|
|
50
|
+
//padding
|
|
51
|
+
padding4: {
|
|
52
|
+
padding: 4,
|
|
53
|
+
},
|
|
54
|
+
padding8: {
|
|
55
|
+
padding: 8,
|
|
56
|
+
},
|
|
57
|
+
padding16: {
|
|
58
|
+
padding: 16,
|
|
59
|
+
},
|
|
60
|
+
padding24: {
|
|
61
|
+
padding: 24,
|
|
62
|
+
},
|
|
63
|
+
padding32: {
|
|
64
|
+
padding: 32,
|
|
65
|
+
},
|
|
66
|
+
//margin
|
|
67
|
+
margin4: {
|
|
68
|
+
margin: 4,
|
|
69
|
+
},
|
|
70
|
+
margin8: {
|
|
71
|
+
margin: 8,
|
|
72
|
+
},
|
|
73
|
+
margin16: {
|
|
74
|
+
margin: 16,
|
|
75
|
+
},
|
|
76
|
+
margin24: {
|
|
77
|
+
margin: 24,
|
|
78
|
+
},
|
|
79
|
+
margin32: {
|
|
80
|
+
margin: 32,
|
|
81
|
+
},
|
|
82
|
+
//paddingHorizontal
|
|
83
|
+
paddingHorizontal4: {
|
|
84
|
+
paddingHorizontal: 4,
|
|
85
|
+
},
|
|
86
|
+
paddingHorizontal8: {
|
|
87
|
+
paddingHorizontal: 8,
|
|
88
|
+
},
|
|
89
|
+
paddingHorizontal16: {
|
|
90
|
+
paddingHorizontal: 16,
|
|
91
|
+
},
|
|
92
|
+
paddingHorizontal24: {
|
|
93
|
+
paddingHorizontal: 24,
|
|
94
|
+
},
|
|
95
|
+
//paddingVertical
|
|
96
|
+
paddingVertical4: {
|
|
97
|
+
paddingVertical: 4,
|
|
98
|
+
},
|
|
99
|
+
paddingVertical8: {
|
|
100
|
+
paddingVertical: 8,
|
|
101
|
+
},
|
|
102
|
+
paddingVertical16: {
|
|
103
|
+
paddingVertical: 16,
|
|
104
|
+
},
|
|
105
|
+
paddingVertical24: {
|
|
106
|
+
paddingVertical: 24,
|
|
107
|
+
},
|
|
108
|
+
//button
|
|
109
|
+
buttonContent: {
|
|
110
|
+
paddingHorizontal: 16,
|
|
111
|
+
paddingVertical: 8,
|
|
112
|
+
flexDirection: 'row',
|
|
113
|
+
},
|
|
114
|
+
|
|
115
|
+
headerRightButton: {
|
|
116
|
+
flexDirection: 'row',
|
|
117
|
+
overflow: 'hidden',
|
|
118
|
+
justifyContent: 'center',
|
|
119
|
+
alignItems: 'center',
|
|
120
|
+
paddingHorizontal: 8,
|
|
121
|
+
},
|
|
122
|
+
//text
|
|
123
|
+
textCenter: {textAlign: 'center'},
|
|
124
|
+
//card
|
|
125
|
+
card: {
|
|
126
|
+
shadowColor: 'gray',
|
|
127
|
+
shadowOffset: {
|
|
128
|
+
width: 1,
|
|
129
|
+
height: 1,
|
|
130
|
+
},
|
|
131
|
+
shadowOpacity: 0.3,
|
|
132
|
+
shadowRadius: 4,
|
|
133
|
+
elevation: 4,
|
|
134
|
+
},
|
|
135
|
+
});
|
|
136
|
+
|
|
137
|
+
export {Styles};
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import React, {useContext, useEffect, useMemo, useRef} from 'react';
|
|
2
|
+
import {Animated, Platform, useWindowDimensions, View} from 'react-native';
|
|
3
|
+
import {
|
|
4
|
+
ContentLoaderTypes,
|
|
5
|
+
LinearGradient,
|
|
6
|
+
NavigationContext,
|
|
7
|
+
Styles,
|
|
8
|
+
} from '../index';
|
|
9
|
+
import styles from './styles';
|
|
10
|
+
|
|
11
|
+
const ContentLoader: React.FC<ContentLoaderTypes> = props => {
|
|
12
|
+
const {width} = useWindowDimensions();
|
|
13
|
+
const {theme} = useContext(NavigationContext);
|
|
14
|
+
const beginShimmerPosition = useRef(new Animated.Value(-1)).current;
|
|
15
|
+
const {style} = props;
|
|
16
|
+
|
|
17
|
+
const shimmerColors = [
|
|
18
|
+
theme.colors.border + '40',
|
|
19
|
+
theme.colors.border + '80',
|
|
20
|
+
theme.colors.border,
|
|
21
|
+
];
|
|
22
|
+
const location = [0.3, 0.5, 0.7];
|
|
23
|
+
const linearTranslate = beginShimmerPosition.interpolate({
|
|
24
|
+
inputRange: [-1, 1],
|
|
25
|
+
outputRange: [0, width],
|
|
26
|
+
});
|
|
27
|
+
const animatedValue = useMemo(() => {
|
|
28
|
+
return Animated.loop(
|
|
29
|
+
Animated.timing(beginShimmerPosition, {
|
|
30
|
+
toValue: 1,
|
|
31
|
+
delay: 0,
|
|
32
|
+
duration: 1000,
|
|
33
|
+
useNativeDriver: Platform.OS !== 'web',
|
|
34
|
+
}),
|
|
35
|
+
);
|
|
36
|
+
}, [beginShimmerPosition]);
|
|
37
|
+
|
|
38
|
+
useEffect(() => {
|
|
39
|
+
animatedValue.start();
|
|
40
|
+
return () => {
|
|
41
|
+
animatedValue.stop();
|
|
42
|
+
};
|
|
43
|
+
}, [animatedValue]);
|
|
44
|
+
|
|
45
|
+
return (
|
|
46
|
+
<View style={[styles.container, style]}>
|
|
47
|
+
<View style={[Styles.flex, {backgroundColor: shimmerColors[0]}]}>
|
|
48
|
+
<Animated.View
|
|
49
|
+
style={[Styles.flex, {transform: [{translateX: linearTranslate}]}]}>
|
|
50
|
+
<LinearGradient
|
|
51
|
+
colors={shimmerColors}
|
|
52
|
+
style={[Styles.flex, {width: width}]}
|
|
53
|
+
start={{
|
|
54
|
+
x: -1,
|
|
55
|
+
y: 0.5,
|
|
56
|
+
}}
|
|
57
|
+
end={{
|
|
58
|
+
x: 2,
|
|
59
|
+
y: 0.5,
|
|
60
|
+
}}
|
|
61
|
+
locations={location}
|
|
62
|
+
/>
|
|
63
|
+
</Animated.View>
|
|
64
|
+
</View>
|
|
65
|
+
</View>
|
|
66
|
+
);
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
ContentLoader.defaultProps = {};
|
|
70
|
+
|
|
71
|
+
export {ContentLoader};
|
package/Divider/index.js
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import React, {useContext} from 'react';
|
|
2
|
+
import {View} from 'react-native';
|
|
3
|
+
import PropTypes from 'prop-types';
|
|
4
|
+
import {ApplicationContext} from '@components';
|
|
5
|
+
import styles from './styles';
|
|
6
|
+
|
|
7
|
+
const Index = props => {
|
|
8
|
+
const {theme} = useContext(ApplicationContext);
|
|
9
|
+
const {color, thickness, direction} = props;
|
|
10
|
+
|
|
11
|
+
let style = [
|
|
12
|
+
styles.horizontal,
|
|
13
|
+
{
|
|
14
|
+
backgroundColor: color ?? theme.colors.border,
|
|
15
|
+
height: thickness,
|
|
16
|
+
},
|
|
17
|
+
];
|
|
18
|
+
|
|
19
|
+
if (direction === 'vertical') {
|
|
20
|
+
style = [
|
|
21
|
+
styles.vertical,
|
|
22
|
+
{
|
|
23
|
+
backgroundColor: color ?? theme.colors.border,
|
|
24
|
+
width: thickness,
|
|
25
|
+
},
|
|
26
|
+
];
|
|
27
|
+
}
|
|
28
|
+
return <View style={style} />;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
Index.propTypes = {
|
|
32
|
+
color: PropTypes.string,
|
|
33
|
+
thickness: PropTypes.number,
|
|
34
|
+
direction: PropTypes.oneOf('horizontal', 'vertical'),
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
Index.defaultProps = {
|
|
38
|
+
color: null,
|
|
39
|
+
thickness: 1,
|
|
40
|
+
direction: 'horizontal',
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
export default Index;
|