@momo-kits/foundation 0.75.1-beta.9 → 0.76.1-beta.1
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/{Navigation → Application}/BottomTab.tsx +19 -6
- package/{Navigation → Application}/Components.tsx +24 -15
- package/{Navigation → Application}/ModalScreen.tsx +17 -13
- package/{Navigation → Application}/Navigation.ts +5 -5
- package/{Navigation → Application}/NavigationContainer.tsx +3 -3
- package/{Navigation → Application}/StackScreen.tsx +7 -7
- package/{Navigation → Application}/index.ts +7 -3
- package/{Navigation → Application}/types.ts +23 -5
- package/{Navigation → Application}/utils.tsx +4 -6
- package/Assets/icon.json +6 -0
- package/Button/index.tsx +1 -1
- package/CheckBox/index.tsx +1 -1
- package/Consts/theme.ts +1 -1
- package/Divider/index.tsx +1 -1
- package/Icon/index.tsx +2 -2
- package/IconButton/index.tsx +1 -1
- package/Image/index.tsx +4 -2
- package/Input/Input.tsx +2 -1
- package/Input/InputMoney.tsx +2 -1
- package/Input/InputSearch.tsx +4 -2
- package/Input/InputTextArea.tsx +20 -19
- package/Input/common.tsx +1 -1
- package/Input/index.tsx +2 -0
- package/Layout/Card.tsx +13 -12
- package/Layout/GridSystem.tsx +4 -2
- package/Layout/Item.tsx +14 -14
- package/Layout/Screen.tsx +188 -0
- package/Layout/Section.tsx +9 -3
- package/Layout/types.ts +3 -1
- package/Layout/utils.ts +24 -4
- package/Pagination/Dot.tsx +1 -1
- package/Pagination/PaginationDot.tsx +1 -1
- package/Pagination/PaginationNumber.tsx +1 -2
- package/Pagination/PaginationScroll.tsx +2 -1
- package/Pagination/PaginationWhiteDot.tsx +1 -1
- package/Popup/PopupNotify.tsx +1 -1
- package/Popup/PopupPromotion.tsx +1 -1
- package/Radio/index.tsx +1 -1
- package/Switch/index.tsx +1 -1
- package/Tag/index.tsx +3 -1
- package/Text/index.tsx +5 -4
- package/Text/utils.ts +14 -0
- package/index.ts +9 -2
- package/package.json +40 -40
- package/publish.sh +2 -5
- package/Layout/ScreenContainer.tsx +0 -121
- package/Navigation/Observer.ts +0 -79
- /package/{Navigation → Application}/NavigationButton.tsx +0 -0
- /package/{Navigation → Application}/Navigator.ts +0 -0
package/Input/InputTextArea.tsx
CHANGED
|
@@ -8,7 +8,6 @@ import {
|
|
|
8
8
|
} from 'react-native';
|
|
9
9
|
import styles from './styles';
|
|
10
10
|
import {Text} from '../Text';
|
|
11
|
-
import {ApplicationContext} from '../Navigation';
|
|
12
11
|
import {
|
|
13
12
|
DEFAULT_HEIGHT,
|
|
14
13
|
ErrorView,
|
|
@@ -18,26 +17,26 @@ import {
|
|
|
18
17
|
} from './common';
|
|
19
18
|
import {InputTextAreaProps} from './index';
|
|
20
19
|
import {Icon} from '../Icon';
|
|
20
|
+
import {ApplicationContext} from '../Application';
|
|
21
21
|
|
|
22
|
-
const InputTextArea: FC<InputTextAreaProps> =
|
|
22
|
+
const InputTextArea: FC<InputTextAreaProps> = ({
|
|
23
|
+
errorMessage,
|
|
24
|
+
onChangeText,
|
|
25
|
+
floatingIconColor,
|
|
26
|
+
floatingIcon,
|
|
27
|
+
floatingValue,
|
|
28
|
+
onFocus,
|
|
29
|
+
onBlur,
|
|
30
|
+
disabled,
|
|
31
|
+
value,
|
|
32
|
+
defaultValue,
|
|
33
|
+
height,
|
|
34
|
+
placeholder,
|
|
35
|
+
maxLength,
|
|
36
|
+
required,
|
|
37
|
+
...props
|
|
38
|
+
}) => {
|
|
23
39
|
const {theme} = useContext(ApplicationContext);
|
|
24
|
-
const {
|
|
25
|
-
errorMessage,
|
|
26
|
-
onChangeText,
|
|
27
|
-
floatingIconColor,
|
|
28
|
-
floatingIcon,
|
|
29
|
-
floatingValue,
|
|
30
|
-
onFocus,
|
|
31
|
-
onBlur,
|
|
32
|
-
disabled,
|
|
33
|
-
value,
|
|
34
|
-
defaultValue,
|
|
35
|
-
height,
|
|
36
|
-
placeholder,
|
|
37
|
-
maxLength,
|
|
38
|
-
required,
|
|
39
|
-
} = props;
|
|
40
|
-
|
|
41
40
|
const [focused, setFocused] = useState(false);
|
|
42
41
|
const [inputValue, setInputValue] = useState(defaultValue ?? '');
|
|
43
42
|
const inputRef = useRef<any>(null);
|
|
@@ -101,6 +100,8 @@ const InputTextArea: FC<InputTextAreaProps> = props => {
|
|
|
101
100
|
<View style={styles.rowArea}>
|
|
102
101
|
<View style={styles.textAreaView}>
|
|
103
102
|
<TextInput
|
|
103
|
+
{...props}
|
|
104
|
+
accessibilityLabel={`TextInput`}
|
|
104
105
|
ref={inputRef}
|
|
105
106
|
editable={!disabled}
|
|
106
107
|
textAlignVertical="top"
|
package/Input/common.tsx
CHANGED
|
@@ -2,7 +2,7 @@ import {View} from 'react-native';
|
|
|
2
2
|
import styles from './styles';
|
|
3
3
|
import {Text} from '../Text';
|
|
4
4
|
import React, {FC, useContext} from 'react';
|
|
5
|
-
import {ApplicationContext} from '../
|
|
5
|
+
import {ApplicationContext} from '../Application';
|
|
6
6
|
import {Icon} from '../Icon';
|
|
7
7
|
import {Styles} from '../Consts';
|
|
8
8
|
|
package/Input/index.tsx
CHANGED
|
@@ -89,6 +89,8 @@ export interface InputSearchProps extends InputPropsOmitForSearch {
|
|
|
89
89
|
* Defaults to `true` if not provided.
|
|
90
90
|
*/
|
|
91
91
|
showBorder?: boolean;
|
|
92
|
+
|
|
93
|
+
onPressButtonText?: () => void;
|
|
92
94
|
}
|
|
93
95
|
|
|
94
96
|
export interface InputMoneyProps extends InputPropsWithoutPlaceholder {}
|
package/Layout/Card.tsx
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import {Dimensions, View} from 'react-native';
|
|
3
|
-
import {validateChildren} from './utils';
|
|
3
|
+
import {useGridSystem, validateChildren} from './utils';
|
|
4
4
|
import {CardProps, GridContextProps} from './types';
|
|
5
5
|
import {GridContext} from './index';
|
|
6
6
|
import {GRIDVIEW} from '../Consts';
|
|
7
7
|
import Item from './Item';
|
|
8
8
|
|
|
9
9
|
const Card: React.FC<CardProps> = ({children, style}) => {
|
|
10
|
-
const numberOfColumns =
|
|
10
|
+
const {numberOfColumns} = useGridSystem();
|
|
11
|
+
|
|
11
12
|
const gutterSize = 8;
|
|
12
13
|
const margin = 12;
|
|
13
14
|
|
|
@@ -115,20 +116,20 @@ const Card: React.FC<CardProps> = ({children, style}) => {
|
|
|
115
116
|
return element;
|
|
116
117
|
};
|
|
117
118
|
|
|
118
|
-
const styles: any = style ?? {};
|
|
119
|
-
|
|
120
119
|
return (
|
|
121
120
|
<GridContext.Provider value={gridContext}>
|
|
122
121
|
<View
|
|
123
122
|
accessibilityLabel={`Card`}
|
|
124
|
-
style={
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
123
|
+
style={[
|
|
124
|
+
style,
|
|
125
|
+
{
|
|
126
|
+
width: widthSection,
|
|
127
|
+
marginHorizontal: gridContext.margin,
|
|
128
|
+
padding: 12,
|
|
129
|
+
flexDirection: 'row',
|
|
130
|
+
flexWrap: 'wrap',
|
|
131
|
+
},
|
|
132
|
+
]}>
|
|
132
133
|
{renderView(validateChildren(children, [Item]))}
|
|
133
134
|
{GRIDVIEW && renderOverlay()}
|
|
134
135
|
</View>
|
package/Layout/GridSystem.tsx
CHANGED
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import React, {useContext} from 'react';
|
|
2
2
|
import {useSafeAreaInsets} from 'react-native-safe-area-context';
|
|
3
3
|
import {Dimensions, StyleSheet, View} from 'react-native';
|
|
4
|
-
import {ApplicationContext} from '../
|
|
4
|
+
import {ApplicationContext} from '../Application';
|
|
5
5
|
import {Colors, Spacing} from '../Consts';
|
|
6
6
|
import {GridContextProps} from './types';
|
|
7
|
+
import {useGridSystem} from './utils';
|
|
7
8
|
|
|
8
9
|
const GridSystem: React.FC = () => {
|
|
9
10
|
const {theme} = useContext(ApplicationContext);
|
|
10
|
-
const numberOfColumns =
|
|
11
|
+
const {numberOfColumns} = useGridSystem();
|
|
12
|
+
|
|
11
13
|
const gutterSize = 12;
|
|
12
14
|
const margin = 12;
|
|
13
15
|
const widthSection = Dimensions.get('window').width - margin * 2;
|
package/Layout/Item.tsx
CHANGED
|
@@ -6,7 +6,7 @@ import {GridContext} from './index';
|
|
|
6
6
|
import {GRIDVIEW} from '../Consts';
|
|
7
7
|
|
|
8
8
|
const Item: React.FC<ItemProps> = ({
|
|
9
|
-
widthSpan
|
|
9
|
+
widthSpan,
|
|
10
10
|
heightSpan,
|
|
11
11
|
children,
|
|
12
12
|
style,
|
|
@@ -33,22 +33,22 @@ const Item: React.FC<ItemProps> = ({
|
|
|
33
33
|
);
|
|
34
34
|
};
|
|
35
35
|
|
|
36
|
-
const styles: any = style ?? {};
|
|
37
|
-
|
|
38
36
|
return (
|
|
39
37
|
<View
|
|
40
38
|
accessibilityLabel={`Item`}
|
|
41
|
-
style={
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
39
|
+
style={[
|
|
40
|
+
style,
|
|
41
|
+
{
|
|
42
|
+
width: grid.getSizeSpan(widthSpan ?? grid.numberOfColumns),
|
|
43
|
+
height: heightSpan ? grid.getSizeSpan(heightSpan) : undefined,
|
|
44
|
+
overflow: 'hidden',
|
|
45
|
+
margin: undefined,
|
|
46
|
+
marginTop: undefined,
|
|
47
|
+
marginBottom: undefined,
|
|
48
|
+
marginLeft: undefined,
|
|
49
|
+
marginRight: undefined,
|
|
50
|
+
},
|
|
51
|
+
]}>
|
|
52
52
|
{children}
|
|
53
53
|
{GRIDVIEW && renderOverlay()}
|
|
54
54
|
</View>
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Animated,
|
|
3
|
+
KeyboardAvoidingView,
|
|
4
|
+
Platform,
|
|
5
|
+
Text,
|
|
6
|
+
View,
|
|
7
|
+
} from 'react-native';
|
|
8
|
+
import {useHeaderHeight} from '@react-navigation/stack';
|
|
9
|
+
import {useSafeAreaInsets} from 'react-native-safe-area-context';
|
|
10
|
+
import React, {useContext, useEffect, useRef} from 'react';
|
|
11
|
+
import {ScreenProps} from '../Application/types';
|
|
12
|
+
import {Spacing, Styles} from '../Consts';
|
|
13
|
+
import {Card, Section, validateChildren} from './index';
|
|
14
|
+
import {ApplicationContext} from '../Application';
|
|
15
|
+
import Navigation from '../Application/Navigation';
|
|
16
|
+
import {HeaderTitle} from '../Application/Components';
|
|
17
|
+
|
|
18
|
+
const Screen: React.FC<ScreenProps> = ({
|
|
19
|
+
children,
|
|
20
|
+
enableKeyboardAvoidingView = false,
|
|
21
|
+
scrollable = false,
|
|
22
|
+
navigation,
|
|
23
|
+
marginHeader,
|
|
24
|
+
useAnimatedHeader = false,
|
|
25
|
+
useExtendedHeader = false,
|
|
26
|
+
headerBackground,
|
|
27
|
+
scrollViewProps,
|
|
28
|
+
footerComponent: Footer,
|
|
29
|
+
}) => {
|
|
30
|
+
const animatedValue = useRef<Animated.Value | undefined>(undefined);
|
|
31
|
+
const {theme} = useContext(ApplicationContext);
|
|
32
|
+
const insets = useSafeAreaInsets();
|
|
33
|
+
const headerTransparent = useAnimatedHeader || useExtendedHeader;
|
|
34
|
+
|
|
35
|
+
let handleScroll;
|
|
36
|
+
let imageAnimatedStyle = {};
|
|
37
|
+
let opacity;
|
|
38
|
+
let Component: any = View;
|
|
39
|
+
animatedValue.current = undefined;
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* automatic margin content if use header transparent
|
|
43
|
+
*/
|
|
44
|
+
if (headerTransparent) {
|
|
45
|
+
animatedValue.current = new Animated.Value(0);
|
|
46
|
+
marginHeader = marginHeader ?? useHeaderHeight();
|
|
47
|
+
if (useExtendedHeader) {
|
|
48
|
+
headerBackground = theme.assets?.headerBackground;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
useEffect(() => {
|
|
53
|
+
let title = {};
|
|
54
|
+
if (useExtendedHeader) {
|
|
55
|
+
title = {headerTitle: HeaderTitle};
|
|
56
|
+
}
|
|
57
|
+
navigation?.setOptions({
|
|
58
|
+
animatedValue: animatedValue.current,
|
|
59
|
+
headerTransparent,
|
|
60
|
+
...title,
|
|
61
|
+
});
|
|
62
|
+
}, [useExtendedHeader, useAnimatedHeader]);
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* animated for header stack when used bottom tab
|
|
66
|
+
*/
|
|
67
|
+
useEffect(() => {
|
|
68
|
+
const current: any = navigation;
|
|
69
|
+
if (headerTransparent) {
|
|
70
|
+
return current?.addListener?.('focus', () => {
|
|
71
|
+
const stackNavigation = new Navigation(current?.getParent(), theme);
|
|
72
|
+
stackNavigation?.setOptions({
|
|
73
|
+
animatedValue: animatedValue.current,
|
|
74
|
+
headerTransparent: true,
|
|
75
|
+
});
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
}, [useAnimatedHeader, useExtendedHeader, navigation]);
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* animated when use scroll && animated value
|
|
82
|
+
*/
|
|
83
|
+
if (scrollable) {
|
|
84
|
+
Component = Animated.ScrollView;
|
|
85
|
+
if (useAnimatedHeader) {
|
|
86
|
+
opacity = animatedValue.current?.interpolate({
|
|
87
|
+
inputRange: [0, 100],
|
|
88
|
+
outputRange: [1, 0],
|
|
89
|
+
extrapolate: 'clamp',
|
|
90
|
+
});
|
|
91
|
+
imageAnimatedStyle = {
|
|
92
|
+
transform: [
|
|
93
|
+
{
|
|
94
|
+
scale: animatedValue.current?.interpolate?.({
|
|
95
|
+
inputRange: [-300, 0, 1],
|
|
96
|
+
outputRange: [1.75, 1, 1],
|
|
97
|
+
extrapolate: 'clamp',
|
|
98
|
+
}),
|
|
99
|
+
},
|
|
100
|
+
],
|
|
101
|
+
};
|
|
102
|
+
handleScroll = Animated.event(
|
|
103
|
+
[
|
|
104
|
+
{
|
|
105
|
+
nativeEvent: {
|
|
106
|
+
contentOffset: {y: animatedValue.current as Animated.Value},
|
|
107
|
+
},
|
|
108
|
+
},
|
|
109
|
+
],
|
|
110
|
+
{useNativeDriver: true},
|
|
111
|
+
);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* build content for screen
|
|
117
|
+
*/
|
|
118
|
+
const renderContent = () => {
|
|
119
|
+
const results = validateChildren(children, [Section, Card]);
|
|
120
|
+
if (Array.isArray(results)) {
|
|
121
|
+
return results.map((item, index) => {
|
|
122
|
+
const space = item.props?.useMargin === false ? 0 : Spacing.M;
|
|
123
|
+
return (
|
|
124
|
+
<View
|
|
125
|
+
key={`ScreenItem${index}`}
|
|
126
|
+
style={{
|
|
127
|
+
marginTop: space,
|
|
128
|
+
flex: item.props?.expanded ? 1 : undefined,
|
|
129
|
+
}}>
|
|
130
|
+
{item}
|
|
131
|
+
</View>
|
|
132
|
+
);
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
return results;
|
|
136
|
+
};
|
|
137
|
+
|
|
138
|
+
return (
|
|
139
|
+
<View style={Styles.flex} accessibilityLabel={`ScreenContainer`}>
|
|
140
|
+
<View
|
|
141
|
+
style={{
|
|
142
|
+
position: 'absolute',
|
|
143
|
+
maxHeight: 215,
|
|
144
|
+
width: '100%',
|
|
145
|
+
overflow: 'hidden',
|
|
146
|
+
}}>
|
|
147
|
+
{!!headerBackground && (
|
|
148
|
+
<Animated.Image
|
|
149
|
+
source={{
|
|
150
|
+
uri: headerBackground,
|
|
151
|
+
}}
|
|
152
|
+
style={{
|
|
153
|
+
opacity: opacity ?? 1,
|
|
154
|
+
aspectRatio: 1.75,
|
|
155
|
+
...imageAnimatedStyle,
|
|
156
|
+
}}
|
|
157
|
+
/>
|
|
158
|
+
)}
|
|
159
|
+
</View>
|
|
160
|
+
<KeyboardAvoidingView
|
|
161
|
+
style={Styles.flex}
|
|
162
|
+
enabled={enableKeyboardAvoidingView}
|
|
163
|
+
behavior={Platform.select({
|
|
164
|
+
ios: 'padding',
|
|
165
|
+
android: undefined,
|
|
166
|
+
})}>
|
|
167
|
+
<Component
|
|
168
|
+
{...scrollViewProps}
|
|
169
|
+
onScroll={handleScroll}
|
|
170
|
+
style={[Styles.flex, {marginTop: marginHeader}]}>
|
|
171
|
+
{renderContent()}
|
|
172
|
+
</Component>
|
|
173
|
+
{Footer && (
|
|
174
|
+
<View
|
|
175
|
+
style={{
|
|
176
|
+
paddingTop: Spacing.S,
|
|
177
|
+
paddingBottom: insets.bottom + Spacing.S,
|
|
178
|
+
backgroundColor: theme.colors.background.surface,
|
|
179
|
+
}}>
|
|
180
|
+
<Section>{Footer}</Section>
|
|
181
|
+
</View>
|
|
182
|
+
)}
|
|
183
|
+
</KeyboardAvoidingView>
|
|
184
|
+
</View>
|
|
185
|
+
);
|
|
186
|
+
};
|
|
187
|
+
|
|
188
|
+
export default Screen;
|
package/Layout/Section.tsx
CHANGED
|
@@ -1,13 +1,18 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import {Dimensions, View} from 'react-native';
|
|
3
|
-
import {validateChildren} from './utils';
|
|
3
|
+
import {useGridSystem, validateChildren} from './utils';
|
|
4
4
|
import {GridContextProps, SectionProps} from './types';
|
|
5
5
|
import {GridContext} from './index';
|
|
6
6
|
import {GRIDVIEW} from '../Consts';
|
|
7
7
|
import Item from './Item';
|
|
8
8
|
|
|
9
|
-
const Section: React.FC<SectionProps> = ({
|
|
10
|
-
|
|
9
|
+
const Section: React.FC<SectionProps> = ({
|
|
10
|
+
children,
|
|
11
|
+
useMargin = true,
|
|
12
|
+
backgroundColor,
|
|
13
|
+
}) => {
|
|
14
|
+
const {numberOfColumns} = useGridSystem();
|
|
15
|
+
|
|
11
16
|
const gutterSize = 12;
|
|
12
17
|
let margin = 0;
|
|
13
18
|
if (useMargin) {
|
|
@@ -128,6 +133,7 @@ const Section: React.FC<SectionProps> = ({children, useMargin = true}) => {
|
|
|
128
133
|
marginHorizontal: gridContext.margin,
|
|
129
134
|
flexDirection: 'row',
|
|
130
135
|
flexWrap: 'wrap',
|
|
136
|
+
backgroundColor: backgroundColor,
|
|
131
137
|
}}>
|
|
132
138
|
{renderView(validateChildren(children, [Item]))}
|
|
133
139
|
{GRIDVIEW && renderOverlay()}
|
package/Layout/types.ts
CHANGED
|
@@ -40,13 +40,15 @@ export interface SectionProps extends ViewProps {
|
|
|
40
40
|
* Defaults to `false` if not provided.
|
|
41
41
|
*/
|
|
42
42
|
useMargin?: boolean;
|
|
43
|
+
|
|
44
|
+
backgroundColor?: string;
|
|
43
45
|
}
|
|
44
46
|
|
|
45
47
|
export interface ItemProps extends ViewProps {
|
|
46
48
|
/**
|
|
47
49
|
* Represents the width of the Card component in terms of span numbers (1-12).
|
|
48
50
|
*/
|
|
49
|
-
widthSpan
|
|
51
|
+
widthSpan?: SpanNumber;
|
|
50
52
|
|
|
51
53
|
/**
|
|
52
54
|
* Optional. Represents the height of the Card component in terms of span numbers (1-12).
|
package/Layout/utils.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import {Alert} from 'react-native';
|
|
2
|
-
import React, {
|
|
3
|
-
import {SectionProps} from './types';
|
|
1
|
+
import {Alert, Dimensions} from 'react-native';
|
|
2
|
+
import React, {useEffect, useState} from 'react';
|
|
4
3
|
|
|
5
4
|
/**
|
|
6
5
|
* validate children type
|
|
@@ -57,4 +56,25 @@ const validateChildren = (
|
|
|
57
56
|
return results;
|
|
58
57
|
};
|
|
59
58
|
|
|
60
|
-
|
|
59
|
+
const useGridSystem = () => {
|
|
60
|
+
const [numberOfColumns, setNumberOfColumns] = useState(
|
|
61
|
+
Dimensions.get('window').width > 600 ? 24 : 12,
|
|
62
|
+
);
|
|
63
|
+
|
|
64
|
+
useEffect(() => {
|
|
65
|
+
const subscription: any = Dimensions.addEventListener(
|
|
66
|
+
'change',
|
|
67
|
+
({window}: any) => {
|
|
68
|
+
const newColumns = Dimensions.get('window').width > 600 ? 24 : 12;
|
|
69
|
+
if (newColumns != numberOfColumns) {
|
|
70
|
+
setNumberOfColumns(newColumns);
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
);
|
|
74
|
+
return () => subscription?.remove();
|
|
75
|
+
}, []);
|
|
76
|
+
|
|
77
|
+
return {numberOfColumns};
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
export {validateChildren, useGridSystem};
|
package/Pagination/Dot.tsx
CHANGED
|
@@ -2,7 +2,7 @@ import React, {FC, useContext} from 'react';
|
|
|
2
2
|
import {Animated} from 'react-native';
|
|
3
3
|
import styles from './styles';
|
|
4
4
|
import {DotProps} from './types';
|
|
5
|
-
import {ApplicationContext} from '../
|
|
5
|
+
import {ApplicationContext} from '../Application';
|
|
6
6
|
|
|
7
7
|
const Dot: FC<DotProps> = ({active, style}) => {
|
|
8
8
|
const {theme} = useContext(ApplicationContext);
|
|
@@ -4,7 +4,7 @@ import {ChildPaginationProps} from './types';
|
|
|
4
4
|
import Dot from './Dot';
|
|
5
5
|
import styles from './styles';
|
|
6
6
|
import {Spacing} from '../Consts';
|
|
7
|
-
import {ApplicationContext} from '../
|
|
7
|
+
import {ApplicationContext} from '../Application';
|
|
8
8
|
|
|
9
9
|
const PaginationDot: FC<ChildPaginationProps> = ({
|
|
10
10
|
dataLength = 2,
|
|
@@ -3,14 +3,13 @@ import {View} from 'react-native';
|
|
|
3
3
|
import {ChildPaginationProps} from './types';
|
|
4
4
|
import styles from './styles';
|
|
5
5
|
import {Text} from '../Text';
|
|
6
|
-
import {ApplicationContext} from '../
|
|
6
|
+
import {ApplicationContext} from '../Application';
|
|
7
7
|
import {Colors} from '../Consts';
|
|
8
8
|
|
|
9
9
|
const PaginationNumber: FC<ChildPaginationProps> = ({
|
|
10
10
|
activeIndex = 0,
|
|
11
11
|
dataLength = 2,
|
|
12
12
|
}) => {
|
|
13
|
-
const {theme} = useContext(ApplicationContext);
|
|
14
13
|
return (
|
|
15
14
|
<View style={[styles.paginationNumberContainer]}>
|
|
16
15
|
<Text color={Colors.black_01} typography={'label_default'}>{`${
|
|
@@ -2,7 +2,7 @@ import React, {FC, useContext, useRef, useState} from 'react';
|
|
|
2
2
|
import {Animated, View} from 'react-native';
|
|
3
3
|
import {ScrollIndicatorProps} from './types';
|
|
4
4
|
import styles from './styles';
|
|
5
|
-
import {ApplicationContext} from '../
|
|
5
|
+
import {ApplicationContext} from '../Application';
|
|
6
6
|
|
|
7
7
|
const INDICATOR_WIDTH = 24;
|
|
8
8
|
const INDICATOR_CONTAINER_WIDTH = 72;
|
|
@@ -31,6 +31,7 @@ const PaginationScroll: FC<ScrollIndicatorProps> = ({
|
|
|
31
31
|
const renderScrollView = () => {
|
|
32
32
|
return (
|
|
33
33
|
<Animated.ScrollView
|
|
34
|
+
accessibilityLabel={'PaginationScroll'}
|
|
34
35
|
ref={scrollViewRef}
|
|
35
36
|
onScroll={Animated.event(
|
|
36
37
|
[
|
|
@@ -4,7 +4,7 @@ import {ChildPaginationProps} from './types';
|
|
|
4
4
|
import styles from './styles';
|
|
5
5
|
import Dot from './Dot';
|
|
6
6
|
import {Colors, Spacing} from '../Consts';
|
|
7
|
-
import {ApplicationContext} from '../
|
|
7
|
+
import {ApplicationContext} from '../Application';
|
|
8
8
|
|
|
9
9
|
const PaginationWhiteDot: FC<ChildPaginationProps> = ({
|
|
10
10
|
dataLength = 2,
|
package/Popup/PopupNotify.tsx
CHANGED
|
@@ -4,7 +4,7 @@ import {PopupNotifyProps} from './types';
|
|
|
4
4
|
import {Radius, Spacing, Styles} from '../Consts';
|
|
5
5
|
import {Image} from '../Image';
|
|
6
6
|
import {Text} from '../Text';
|
|
7
|
-
import {ApplicationContext} from '../
|
|
7
|
+
import {ApplicationContext} from '../Application';
|
|
8
8
|
import {Button} from '../Button';
|
|
9
9
|
import {Icon} from '../Icon';
|
|
10
10
|
|
package/Popup/PopupPromotion.tsx
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, {useContext} from 'react';
|
|
2
2
|
import {StyleSheet, TouchableOpacity, View} from 'react-native';
|
|
3
3
|
import {PopupPromotionProps} from './types';
|
|
4
|
-
import {ApplicationContext} from '../
|
|
4
|
+
import {ApplicationContext} from '../Application';
|
|
5
5
|
import {Image} from '../Image';
|
|
6
6
|
import {Radius, Spacing} from '../Consts';
|
|
7
7
|
import {Icon} from '../Icon';
|
package/Radio/index.tsx
CHANGED
|
@@ -4,7 +4,7 @@ import {TouchableOpacity, View} from 'react-native';
|
|
|
4
4
|
import {RadioProps} from './types';
|
|
5
5
|
import {Text} from '../Text';
|
|
6
6
|
import styles from './styles';
|
|
7
|
-
import {ApplicationContext} from '../
|
|
7
|
+
import {ApplicationContext} from '../Application';
|
|
8
8
|
import {Spacing} from '../Consts';
|
|
9
9
|
|
|
10
10
|
const Radio: FC<RadioProps> = ({
|
package/Switch/index.tsx
CHANGED
|
@@ -2,7 +2,7 @@ import React, {FC, useContext} from 'react';
|
|
|
2
2
|
import {TouchableOpacity, View} from 'react-native';
|
|
3
3
|
import {SwitchProps} from './types';
|
|
4
4
|
import styles from './styles';
|
|
5
|
-
import {ApplicationContext} from '../
|
|
5
|
+
import {ApplicationContext} from '../Application';
|
|
6
6
|
import {Colors} from '../Consts';
|
|
7
7
|
|
|
8
8
|
const Switch: FC<SwitchProps> = props => {
|
package/Tag/index.tsx
CHANGED
|
@@ -60,7 +60,9 @@ const Tag: FC<TagProps> = ({
|
|
|
60
60
|
}
|
|
61
61
|
|
|
62
62
|
return (
|
|
63
|
-
<View
|
|
63
|
+
<View
|
|
64
|
+
style={[style, sizeStyle, {backgroundColor: tagColor}]}
|
|
65
|
+
accessibilityLabel={`Tag/${label}`}>
|
|
64
66
|
{!!icon && (
|
|
65
67
|
<Icon
|
|
66
68
|
style={styles.icon}
|
package/Text/index.tsx
CHANGED
|
@@ -2,8 +2,9 @@ import React, {useContext} from 'react';
|
|
|
2
2
|
import {Text as RNText, TextProps as RNTextProps} from 'react-native';
|
|
3
3
|
import styles from './styles';
|
|
4
4
|
import {Typography, TypographyWeight} from './types';
|
|
5
|
-
import {ApplicationContext} from '../
|
|
5
|
+
import {ApplicationContext} from '../Application';
|
|
6
6
|
import {GridContext} from '../Layout';
|
|
7
|
+
import {scaleSize} from './utils';
|
|
7
8
|
|
|
8
9
|
const SFProText: TypographyWeight = {
|
|
9
10
|
100: 'Thin',
|
|
@@ -93,8 +94,8 @@ const Text: React.FC<TextProps> = ({
|
|
|
93
94
|
|
|
94
95
|
return {
|
|
95
96
|
fontFamily,
|
|
96
|
-
fontSize,
|
|
97
|
-
lineHeight,
|
|
97
|
+
fontSize: scaleSize(fontSize),
|
|
98
|
+
lineHeight: scaleSize(lineHeight),
|
|
98
99
|
fontStyle,
|
|
99
100
|
};
|
|
100
101
|
};
|
|
@@ -120,4 +121,4 @@ Text.defaultProps = {
|
|
|
120
121
|
typography: 'paragraph_default',
|
|
121
122
|
};
|
|
122
123
|
|
|
123
|
-
export {Text};
|
|
124
|
+
export {Text, scaleSize};
|
package/Text/utils.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import {Dimensions} from 'react-native';
|
|
2
|
+
|
|
3
|
+
const deviceWidth = Dimensions.get('window').width;
|
|
4
|
+
const DEFAULT_SCREEN_SIZE = 375;
|
|
5
|
+
const scaleSize = (size: number) => {
|
|
6
|
+
const scaleRate = deviceWidth / DEFAULT_SCREEN_SIZE;
|
|
7
|
+
|
|
8
|
+
if (scaleRate > 1) {
|
|
9
|
+
return Math.min(Math.round(size * scaleRate), size + 5);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
return size;
|
|
13
|
+
};
|
|
14
|
+
export {scaleSize};
|
package/index.ts
CHANGED
|
@@ -5,8 +5,15 @@ import {
|
|
|
5
5
|
} from 'react-native-safe-area-context';
|
|
6
6
|
import LinearGradient from 'react-native-linear-gradient';
|
|
7
7
|
|
|
8
|
+
/**
|
|
9
|
+
* native export
|
|
10
|
+
*/
|
|
8
11
|
export {SafeAreaView, useSafeAreaInsets, SafeAreaProvider, LinearGradient};
|
|
9
12
|
|
|
13
|
+
/**
|
|
14
|
+
* foundation component
|
|
15
|
+
*/
|
|
16
|
+
|
|
10
17
|
export * from './Consts';
|
|
11
18
|
export * from './Layout';
|
|
12
19
|
export * from './Layout/types';
|
|
@@ -15,8 +22,8 @@ export * from './Popup/types';
|
|
|
15
22
|
export * from './Text';
|
|
16
23
|
export * from './Text/types';
|
|
17
24
|
export * from './Button';
|
|
18
|
-
export * from './
|
|
19
|
-
export * from './
|
|
25
|
+
export * from './Application';
|
|
26
|
+
export * from './Application/types';
|
|
20
27
|
export * from './Icon';
|
|
21
28
|
export * from './Icon/types';
|
|
22
29
|
export * from './IconButton';
|