@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.
Files changed (51) hide show
  1. package/Assets/header-background.png +0 -0
  2. package/Button/index.tsx +307 -0
  3. package/Button/styles.ts +41 -0
  4. package/Button/types.ts +18 -0
  5. package/CheckBox/index.js +74 -0
  6. package/CheckBox/styles.js +3 -0
  7. package/Consts/colors+spacing+radius.ts +162 -0
  8. package/Consts/index.ts +76 -0
  9. package/Consts/styles.ts +137 -0
  10. package/ContentLoader/index.tsx +71 -0
  11. package/ContentLoader/styles.ts +5 -0
  12. package/ContentLoader/types.ts +3 -0
  13. package/Divider/index.js +43 -0
  14. package/Divider/styles.js +10 -0
  15. package/Icon/icon.json +3935 -0
  16. package/Icon/index.tsx +30 -0
  17. package/Icon/types.ts +8 -0
  18. package/IconButton/index.tsx +127 -0
  19. package/IconButton/types.ts +17 -0
  20. package/Image/index.tsx +67 -0
  21. package/Image/styles.ts +13 -0
  22. package/Image/types.ts +6 -0
  23. package/Layout/Row.tsx +42 -0
  24. package/Layout/Screen.tsx +68 -0
  25. package/Layout/Section.tsx +30 -0
  26. package/Layout/View.tsx +84 -0
  27. package/Layout/index.ts +6 -0
  28. package/Layout/styles.ts +24 -0
  29. package/Layout/types.ts +39 -0
  30. package/Layout/utils.ts +37 -0
  31. package/Navigation/Components.tsx +55 -0
  32. package/Navigation/ModalScreen.tsx +177 -0
  33. package/Navigation/Navigation.ts +34 -0
  34. package/Navigation/NavigationButton.tsx +25 -0
  35. package/Navigation/NavigationContainer.tsx +74 -0
  36. package/Navigation/Navigator.ts +45 -0
  37. package/Navigation/ScreenContainer.tsx +38 -0
  38. package/Navigation/StackScreen.tsx +19 -0
  39. package/Navigation/index.ts +10 -0
  40. package/Navigation/types.ts +87 -0
  41. package/Navigation/utils.tsx +84 -0
  42. package/SizedBox/index.js +23 -0
  43. package/SizedBox/styles.js +7 -0
  44. package/Text/index.tsx +164 -0
  45. package/Text/styles.ts +34 -0
  46. package/Text/types.ts +47 -0
  47. package/TextInput/index.js +225 -0
  48. package/TextInput/styles.js +55 -0
  49. package/index.ts +18 -0
  50. package/package.json +41 -0
  51. package/publish.sh +26 -0
@@ -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};
@@ -0,0 +1,5 @@
1
+ import {StyleSheet} from 'react-native';
2
+
3
+ export default StyleSheet.create({
4
+ container: {overflow: 'hidden', width: '100%', height: '100%'},
5
+ });
@@ -0,0 +1,3 @@
1
+ export type ContentLoaderTypes = {
2
+ style?: object;
3
+ };
@@ -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;
@@ -0,0 +1,10 @@
1
+ import {StyleSheet} from 'react-native';
2
+
3
+ export default StyleSheet.create({
4
+ horizontal: {
5
+ width: '100%',
6
+ },
7
+ vertical: {
8
+ height: '100%',
9
+ },
10
+ });