@momo-kits/foundation 1.0.1 → 1.0.3
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 +39 -22
- package/CheckBox/index.tsx +10 -4
- package/CheckBox/types.ts +6 -3
- package/Consts/theme.ts +57 -1
- package/ContentLoader/index.tsx +1 -2
- package/Icon/index.tsx +3 -0
- package/IconButton/index.tsx +24 -4
- package/Image/index.tsx +4 -4
- package/Input/Input.tsx +161 -0
- package/Input/TextArea.tsx +15 -55
- package/Input/common.tsx +70 -0
- package/Input/index.tsx +23 -197
- package/Layout/GridSystem.tsx +1 -1
- package/Layout/ScreenContainer.tsx +6 -0
- package/Layout/ScreenSection.tsx +13 -0
- package/Layout/SectionItem.tsx +3 -0
- package/Layout/utils.ts +14 -0
- package/Navigation/Components.tsx +35 -10
- package/Navigation/ModalScreen.tsx +53 -38
- package/Navigation/Navigation.ts +3 -0
- package/Navigation/NavigationButton.tsx +5 -2
- package/Navigation/NavigationContainer.tsx +8 -46
- package/Navigation/StackScreen.tsx +2 -2
- package/Navigation/types.ts +20 -3
- package/Navigation/utils.tsx +30 -9
- package/Playground/index.tsx +132 -0
- package/Playground/styles.ts +16 -0
- package/Playground/types.ts +15 -0
- package/Popup/PopupNotify.tsx +210 -0
- package/Popup/PopupPromotion.tsx +66 -0
- package/Popup/index.tsx +4 -0
- package/Popup/types.ts +23 -0
- package/Radio/index.tsx +13 -5
- package/Radio/styles.ts +1 -0
- package/Radio/types.ts +3 -3
- package/Switch/index.tsx +2 -4
- package/Switch/types.ts +2 -2
- package/Text/index.tsx +9 -7
- package/Text/styles.ts +3 -3
- package/Text/types.ts +5 -14
- package/index.ts +6 -6
- package/package.json +3 -4
- package/publish.sh +6 -8
- package/ActivityIndicator.tsx +0 -244
- package/Button/types.ts +0 -27
- package/IconButton/types.ts +0 -16
- package/Input/types.ts +0 -23
package/Popup/types.ts
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export type PopupNotifyProps = {
|
|
2
|
+
image?: string;
|
|
3
|
+
title: string;
|
|
4
|
+
description: string;
|
|
5
|
+
information?: string;
|
|
6
|
+
secondary?: PopupAction;
|
|
7
|
+
primary: PopupAction;
|
|
8
|
+
buttonDirection: PopupActionDirection;
|
|
9
|
+
onIconClose?: () => void;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export type PopupPromotionProps = {
|
|
13
|
+
image: string;
|
|
14
|
+
primary: PopupAction;
|
|
15
|
+
onIconClose?: () => void;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
type PopupAction = {
|
|
19
|
+
title: string;
|
|
20
|
+
onPress: () => void;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
type PopupActionDirection = 'row' | 'column' | 'auto';
|
package/Radio/index.tsx
CHANGED
|
@@ -1,14 +1,20 @@
|
|
|
1
1
|
import React, {FC, useContext} from 'react';
|
|
2
2
|
import {TouchableOpacity, View} from 'react-native';
|
|
3
|
-
|
|
3
|
+
|
|
4
4
|
import {RadioProps} from './types';
|
|
5
5
|
import {Text} from '../Text';
|
|
6
6
|
import styles from './styles';
|
|
7
|
+
import {ApplicationContext} from '../Navigation';
|
|
8
|
+
import {Spacing} from '../Consts';
|
|
7
9
|
|
|
8
|
-
const Radio: FC<RadioProps> =
|
|
10
|
+
const Radio: FC<RadioProps> = ({
|
|
11
|
+
value,
|
|
12
|
+
groupValue,
|
|
13
|
+
disabled,
|
|
14
|
+
onChange,
|
|
15
|
+
label,
|
|
16
|
+
}) => {
|
|
9
17
|
const {theme} = useContext(ApplicationContext);
|
|
10
|
-
const {value, groupValue, disabled, onChange, label} = props;
|
|
11
|
-
|
|
12
18
|
const selected = value === groupValue;
|
|
13
19
|
const borderWidth = selected ? 6 : 2;
|
|
14
20
|
let borderColor = selected ? theme.colors.primary : theme.colors.text.default;
|
|
@@ -20,10 +26,12 @@ const Radio: FC<RadioProps> = props => {
|
|
|
20
26
|
|
|
21
27
|
return (
|
|
22
28
|
<TouchableOpacity
|
|
23
|
-
onPress={onChange}
|
|
29
|
+
onPress={() => onChange?.(value)}
|
|
24
30
|
disabled={disabled}
|
|
25
31
|
style={{
|
|
26
32
|
flexDirection: 'row',
|
|
33
|
+
alignItems: 'center',
|
|
34
|
+
marginRight: Spacing.S,
|
|
27
35
|
}}>
|
|
28
36
|
<View style={[styles.radio, {borderWidth, borderColor}]} />
|
|
29
37
|
<Text typography={'description_default'}>{label}</Text>
|
package/Radio/styles.ts
CHANGED
package/Radio/types.ts
CHANGED
package/Switch/index.tsx
CHANGED
|
@@ -8,16 +8,14 @@ import {Colors} from '../Consts';
|
|
|
8
8
|
const Switch: FC<SwitchProps> = props => {
|
|
9
9
|
const {theme} = useContext(ApplicationContext);
|
|
10
10
|
const {value, onChange, disabled} = props;
|
|
11
|
+
const circleBackgroundColor = value ? Colors.black_01 : Colors.black_03;
|
|
12
|
+
const circleAlign = value ? 'flex-end' : 'flex-start';
|
|
11
13
|
|
|
12
14
|
let backgroundColor = value ? theme.colors.primary : Colors.black_07;
|
|
13
|
-
|
|
14
|
-
const circleBackgroundColor = value ? Colors.black_01 : Colors.black_03;
|
|
15
15
|
if (disabled) {
|
|
16
16
|
backgroundColor = value ? theme.colors.background.tonal : Colors.black_05;
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
-
const circleAlign = value ? 'flex-end' : 'flex-start';
|
|
20
|
-
|
|
21
19
|
return (
|
|
22
20
|
<TouchableOpacity
|
|
23
21
|
disabled={disabled}
|
package/Switch/types.ts
CHANGED
package/Text/index.tsx
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, {useContext} from 'react';
|
|
2
|
-
import {Text as RNText} from 'react-native';
|
|
2
|
+
import {Text as RNText, TextProps as RNTextProps} from 'react-native';
|
|
3
3
|
import styles from './styles';
|
|
4
|
-
import {
|
|
4
|
+
import {Typography, TypographyWeight} from './types';
|
|
5
5
|
import {ApplicationContext} from '../Navigation';
|
|
6
6
|
|
|
7
7
|
const SFProText: TypographyWeight = {
|
|
@@ -23,11 +23,16 @@ const FontStyle: {[key: string]: string} = {
|
|
|
23
23
|
normal: '',
|
|
24
24
|
};
|
|
25
25
|
|
|
26
|
+
export interface TextProps extends RNTextProps {
|
|
27
|
+
typography: Typography;
|
|
28
|
+
color?: string;
|
|
29
|
+
}
|
|
30
|
+
|
|
26
31
|
const Text: React.FC<TextProps> = ({
|
|
27
32
|
typography,
|
|
28
33
|
color,
|
|
29
34
|
children,
|
|
30
|
-
|
|
35
|
+
style,
|
|
31
36
|
...rest
|
|
32
37
|
}) => {
|
|
33
38
|
const {theme} = useContext(ApplicationContext);
|
|
@@ -64,10 +69,7 @@ const Text: React.FC<TextProps> = ({
|
|
|
64
69
|
return (
|
|
65
70
|
<RNText
|
|
66
71
|
{...rest}
|
|
67
|
-
style={[
|
|
68
|
-
textStyle,
|
|
69
|
-
{color: color ?? theme.colors.text.default, textAlign},
|
|
70
|
-
]}>
|
|
72
|
+
style={[style, textStyle, {color: color ?? theme.colors.text.default}]}>
|
|
71
73
|
{children ?? ''}
|
|
72
74
|
</RNText>
|
|
73
75
|
);
|
package/Text/styles.ts
CHANGED
|
@@ -10,9 +10,9 @@ export default {
|
|
|
10
10
|
title_default: {fontSize: 20, lineHeight: 28, fontWeight: '700'},
|
|
11
11
|
title_xs: {fontSize: 16, lineHeight: 22, fontWeight: '700'},
|
|
12
12
|
title_s: {fontSize: 18, lineHeight: 28, fontWeight: '700'},
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
header_default: {fontSize: 15, lineHeight: 22, fontWeight: '600'},
|
|
14
|
+
header_xs: {fontSize: 12, lineHeight: 16, fontWeight: '600'},
|
|
15
|
+
header_s: {fontSize: 14, lineHeight: 20, fontWeight: '600'},
|
|
16
16
|
paragraph_default: {fontSize: 15, lineHeight: 22, fontWeight: '400'},
|
|
17
17
|
paragraph_bold: {fontSize: 15, lineHeight: 22, fontWeight: '700'},
|
|
18
18
|
paragraph_italic: {
|
package/Text/types.ts
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export interface TypographyWeight {
|
|
1
|
+
export type TypographyWeight = {
|
|
4
2
|
[key: string]: string;
|
|
5
3
|
100: string;
|
|
6
4
|
200: string;
|
|
@@ -13,7 +11,7 @@ export interface TypographyWeight {
|
|
|
13
11
|
900: string;
|
|
14
12
|
normal: string;
|
|
15
13
|
bold: string;
|
|
16
|
-
}
|
|
14
|
+
};
|
|
17
15
|
|
|
18
16
|
export type Typography =
|
|
19
17
|
| 'headline_default'
|
|
@@ -23,9 +21,9 @@ export type Typography =
|
|
|
23
21
|
| 'title_default'
|
|
24
22
|
| 'title_xs'
|
|
25
23
|
| 'title_s'
|
|
26
|
-
| '
|
|
27
|
-
| '
|
|
28
|
-
| '
|
|
24
|
+
| 'header_default'
|
|
25
|
+
| 'header_xs'
|
|
26
|
+
| 'header_s'
|
|
29
27
|
| 'paragraph_default'
|
|
30
28
|
| 'paragraph_bold'
|
|
31
29
|
| 'paragraph_italic'
|
|
@@ -40,10 +38,3 @@ export type Typography =
|
|
|
40
38
|
| 'action_xxs'
|
|
41
39
|
| 'action_xs'
|
|
42
40
|
| 'action_s';
|
|
43
|
-
|
|
44
|
-
export type TextAlign = 'left' | 'right' | 'center' | 'auto';
|
|
45
|
-
export interface TextProps extends RNTextProps {
|
|
46
|
-
typography: Typography;
|
|
47
|
-
color?: string;
|
|
48
|
-
textAlign?: TextAlign;
|
|
49
|
-
}
|
package/index.ts
CHANGED
|
@@ -4,32 +4,32 @@ import {
|
|
|
4
4
|
SafeAreaProvider,
|
|
5
5
|
} from 'react-native-safe-area-context';
|
|
6
6
|
import LinearGradient from 'react-native-linear-gradient';
|
|
7
|
-
import
|
|
8
|
-
|
|
9
|
-
export {Button};
|
|
7
|
+
import Playground from './Playground';
|
|
8
|
+
export {Playground};
|
|
10
9
|
|
|
11
10
|
export {SafeAreaView, useSafeAreaInsets, SafeAreaProvider, LinearGradient};
|
|
12
11
|
|
|
13
12
|
export * from './Consts';
|
|
14
13
|
export * from './Layout';
|
|
15
14
|
export * from './Layout/types';
|
|
15
|
+
export * from './Popup';
|
|
16
|
+
export * from './Popup/types';
|
|
16
17
|
export * from './Text';
|
|
17
18
|
export * from './Text/types';
|
|
19
|
+
export * from './Button';
|
|
18
20
|
export * from './Navigation';
|
|
19
21
|
export * from './Navigation/types';
|
|
20
22
|
export * from './Icon';
|
|
21
23
|
export * from './Icon/types';
|
|
22
24
|
export * from './IconButton';
|
|
23
|
-
export * from './IconButton/types';
|
|
24
25
|
export * from './Image';
|
|
25
26
|
export * from './Image/types';
|
|
26
27
|
export * from './ContentLoader';
|
|
27
28
|
export * from './ContentLoader/types';
|
|
28
|
-
export * from './Input';
|
|
29
|
-
export * from './Input/types';
|
|
30
29
|
export * from './CheckBox';
|
|
31
30
|
export * from './CheckBox/types';
|
|
32
31
|
export * from './Radio';
|
|
33
32
|
export * from './Radio/types';
|
|
34
33
|
export * from './Switch';
|
|
35
34
|
export * from './Switch/types';
|
|
35
|
+
export * from './Input';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@momo-kits/foundation",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
4
4
|
"description": "React Native Component Kits",
|
|
5
5
|
"main": "index.ts",
|
|
6
6
|
"scripts": {
|
|
@@ -15,9 +15,8 @@
|
|
|
15
15
|
"@react-navigation/core": "5.16.1",
|
|
16
16
|
"@react-navigation/native": "5.9.8",
|
|
17
17
|
"@react-navigation/routers": "5.7.4",
|
|
18
|
-
"@react-navigation/stack": "
|
|
19
|
-
"@gorhom/bottom-sheet": "2.4.1"
|
|
20
|
-
"react-native-screens": "git+https://gitlab.com/dung.huynh1/react-native-screens.git#main"
|
|
18
|
+
"@react-navigation/stack": "git+https://gitlab.com/dung.huynh1/react-navigation-stack.git#main",
|
|
19
|
+
"@gorhom/bottom-sheet": "2.4.1"
|
|
21
20
|
},
|
|
22
21
|
"peerDependencies": {
|
|
23
22
|
"react-native": "*"
|
package/publish.sh
CHANGED
|
@@ -4,6 +4,7 @@ mkdir dist
|
|
|
4
4
|
|
|
5
5
|
cp . ./dist
|
|
6
6
|
|
|
7
|
+
|
|
7
8
|
# GET VERSION from mck_package.json
|
|
8
9
|
VERSIONSTRING=( v$(jq .version package.json) )
|
|
9
10
|
VERSION=(${VERSIONSTRING//[\"]/})
|
|
@@ -11,18 +12,15 @@ echo VERSION: $VERSION
|
|
|
11
12
|
|
|
12
13
|
rsync -r --verbose --exclude '*.mdx' --exclude '*Demo.js' --exclude 'props-type.js' --exclude 'prop-types.js' ./* dist
|
|
13
14
|
|
|
14
|
-
#
|
|
15
|
+
#babel component to dist
|
|
15
16
|
#babel ./dist -d dist --copy-files
|
|
16
17
|
|
|
17
|
-
#copy option
|
|
18
|
-
#cp -r ./src/ dist
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
#npm login
|
|
22
|
-
#publish dist to npm
|
|
23
18
|
cd dist
|
|
24
19
|
npm publish --tag beta --access=public
|
|
20
|
+
|
|
21
|
+
#clear dist and package json
|
|
25
22
|
cd ..
|
|
26
23
|
rm -rf dist
|
|
27
24
|
|
|
28
|
-
|
|
25
|
+
|
|
26
|
+
#curl -X POST -H 'Content-Type: application/json' 'https://chat.googleapis.com/v1/spaces/AAAAbP8987c/messages?key=AIzaSyDdI0hCZtE6vySjMm-WEfRq3CPzqKqqsHI&token=UGSFRvk_oYb9uGsAgs31bVvMm6jDkmD8zihGm3eyaQA%3D&threadKey=JoaXTEYaNNkl' -d '{"text": "@momo-kits/core new version release: '*"$VERSION"*' https://www.npmjs.com/package/@momo-kits/core"}'
|
package/ActivityIndicator.tsx
DELETED
|
@@ -1,244 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
Animated,
|
|
4
|
-
Easing,
|
|
5
|
-
Platform,
|
|
6
|
-
StyleProp,
|
|
7
|
-
StyleSheet,
|
|
8
|
-
View,
|
|
9
|
-
ViewStyle,
|
|
10
|
-
} from 'react-native';
|
|
11
|
-
|
|
12
|
-
export type Props = React.ComponentPropsWithRef<typeof View> & {
|
|
13
|
-
/**
|
|
14
|
-
* Whether to show the indicator or hide it.
|
|
15
|
-
*/
|
|
16
|
-
animating?: boolean;
|
|
17
|
-
/**
|
|
18
|
-
* The color of the spinner.
|
|
19
|
-
*/
|
|
20
|
-
color?: string;
|
|
21
|
-
/**
|
|
22
|
-
* Size of the indicator.
|
|
23
|
-
*/
|
|
24
|
-
size?: 'small' | 'large' | number;
|
|
25
|
-
/**
|
|
26
|
-
* Whether the indicator should hide when not animating.
|
|
27
|
-
*/
|
|
28
|
-
hidesWhenStopped?: boolean;
|
|
29
|
-
/**
|
|
30
|
-
* Style for position indicator.
|
|
31
|
-
*/
|
|
32
|
-
style?: StyleProp<ViewStyle>;
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
const DURATION = 2400;
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* Activity indicator is used to present progress of some activity in the app.
|
|
39
|
-
* It can be used as a drop-in for the ActivityIndicator shipped with React Native.
|
|
40
|
-
*
|
|
41
|
-
* ## Usage
|
|
42
|
-
* ```js
|
|
43
|
-
* import * as React from 'react';
|
|
44
|
-
* import { ActivityIndicator, MD2Colors } from 'react-native-paper';
|
|
45
|
-
*
|
|
46
|
-
* const MyComponent = () => (
|
|
47
|
-
* <ActivityIndicator animating={true} color={MD2Colors.red800} />
|
|
48
|
-
* );
|
|
49
|
-
*
|
|
50
|
-
* export default MyComponent;
|
|
51
|
-
* ```
|
|
52
|
-
*/
|
|
53
|
-
const ActivityIndicator = ({
|
|
54
|
-
animating = true,
|
|
55
|
-
color: indicatorColor,
|
|
56
|
-
hidesWhenStopped = true,
|
|
57
|
-
size: indicatorSize = 'small',
|
|
58
|
-
style,
|
|
59
|
-
...rest
|
|
60
|
-
}: Props) => {
|
|
61
|
-
const { current: timer } = React.useRef<Animated.Value>(
|
|
62
|
-
new Animated.Value(0)
|
|
63
|
-
);
|
|
64
|
-
const { current: fade } = React.useRef<Animated.Value>(
|
|
65
|
-
new Animated.Value(!animating && hidesWhenStopped ? 0 : 1)
|
|
66
|
-
);
|
|
67
|
-
|
|
68
|
-
const rotation = React.useRef<Animated.CompositeAnimation | undefined>(
|
|
69
|
-
undefined
|
|
70
|
-
);
|
|
71
|
-
|
|
72
|
-
const startRotation = React.useCallback(() => {
|
|
73
|
-
// Show indicator
|
|
74
|
-
Animated.timing(fade, {
|
|
75
|
-
duration: 200,
|
|
76
|
-
toValue: 1,
|
|
77
|
-
isInteraction: false,
|
|
78
|
-
useNativeDriver: true,
|
|
79
|
-
}).start();
|
|
80
|
-
|
|
81
|
-
// Circular animation in loop
|
|
82
|
-
if (rotation.current) {
|
|
83
|
-
timer.setValue(0);
|
|
84
|
-
// $FlowFixMe
|
|
85
|
-
Animated.loop(rotation.current).start();
|
|
86
|
-
}
|
|
87
|
-
}, [fade, timer]);
|
|
88
|
-
|
|
89
|
-
const stopRotation = () => {
|
|
90
|
-
if (rotation.current) {
|
|
91
|
-
rotation.current.stop();
|
|
92
|
-
}
|
|
93
|
-
};
|
|
94
|
-
|
|
95
|
-
React.useEffect(() => {
|
|
96
|
-
if (rotation.current === undefined) {
|
|
97
|
-
// Circular animation in loop
|
|
98
|
-
rotation.current = Animated.timing(timer, {
|
|
99
|
-
duration: DURATION,
|
|
100
|
-
easing: Easing.linear,
|
|
101
|
-
// Animated.loop does not work if useNativeDriver is true on web
|
|
102
|
-
useNativeDriver: Platform.OS !== 'web',
|
|
103
|
-
toValue: 1,
|
|
104
|
-
isInteraction: false,
|
|
105
|
-
});
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
if (animating) {
|
|
109
|
-
startRotation();
|
|
110
|
-
} else if (hidesWhenStopped) {
|
|
111
|
-
// Hide indicator first and then stop rotation
|
|
112
|
-
Animated.timing(fade, {
|
|
113
|
-
duration: 200,
|
|
114
|
-
toValue: 0,
|
|
115
|
-
useNativeDriver: true,
|
|
116
|
-
isInteraction: false,
|
|
117
|
-
}).start(stopRotation);
|
|
118
|
-
} else {
|
|
119
|
-
stopRotation();
|
|
120
|
-
}
|
|
121
|
-
}, [animating, fade, hidesWhenStopped, startRotation, timer]);
|
|
122
|
-
|
|
123
|
-
const color = indicatorColor || 'red';
|
|
124
|
-
const size =
|
|
125
|
-
typeof indicatorSize === 'string'
|
|
126
|
-
? indicatorSize === 'small'
|
|
127
|
-
? 24
|
|
128
|
-
: 48
|
|
129
|
-
: indicatorSize
|
|
130
|
-
? indicatorSize
|
|
131
|
-
: 24;
|
|
132
|
-
|
|
133
|
-
const frames = (60 * DURATION) / 1000;
|
|
134
|
-
const easing = Easing.bezier(0.4, 0.0, 0.7, 1.0);
|
|
135
|
-
const containerStyle = {
|
|
136
|
-
width: size,
|
|
137
|
-
height: size / 2,
|
|
138
|
-
overflow: 'hidden' as const,
|
|
139
|
-
};
|
|
140
|
-
|
|
141
|
-
return (
|
|
142
|
-
<View
|
|
143
|
-
style={[styles.container, style]}
|
|
144
|
-
{...rest}
|
|
145
|
-
accessible
|
|
146
|
-
accessibilityRole="progressbar"
|
|
147
|
-
accessibilityState={{ busy: animating }}
|
|
148
|
-
>
|
|
149
|
-
<Animated.View
|
|
150
|
-
style={[{ width: size, height: size, opacity: fade }]}
|
|
151
|
-
collapsable={false}
|
|
152
|
-
>
|
|
153
|
-
{[0, 1].map((index) => {
|
|
154
|
-
// Thanks to https://github.com/n4kz/react-native-indicators for the great work
|
|
155
|
-
const inputRange = Array.from(
|
|
156
|
-
new Array(frames),
|
|
157
|
-
(_, frameIndex) => frameIndex / (frames - 1)
|
|
158
|
-
);
|
|
159
|
-
const outputRange = Array.from(new Array(frames), (_, frameIndex) => {
|
|
160
|
-
let progress = (2 * frameIndex) / (frames - 1);
|
|
161
|
-
const rotation = index ? +(360 - 15) : -(180 - 15);
|
|
162
|
-
|
|
163
|
-
if (progress > 1.0) {
|
|
164
|
-
progress = 2.0 - progress;
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
const direction = index ? -1 : +1;
|
|
168
|
-
|
|
169
|
-
return `${direction * (180 - 30) * easing(progress) + rotation}deg`;
|
|
170
|
-
});
|
|
171
|
-
|
|
172
|
-
const layerStyle = {
|
|
173
|
-
width: size,
|
|
174
|
-
height: size,
|
|
175
|
-
transform: [
|
|
176
|
-
{
|
|
177
|
-
rotate: timer.interpolate({
|
|
178
|
-
inputRange: [0, 1],
|
|
179
|
-
outputRange: [`${0 + 30 + 15}deg`, `${2 * 360 + 30 + 15}deg`],
|
|
180
|
-
}),
|
|
181
|
-
},
|
|
182
|
-
],
|
|
183
|
-
};
|
|
184
|
-
|
|
185
|
-
const viewportStyle = {
|
|
186
|
-
width: size,
|
|
187
|
-
height: size,
|
|
188
|
-
transform: [
|
|
189
|
-
{
|
|
190
|
-
translateY: index ? -size / 2 : 0,
|
|
191
|
-
},
|
|
192
|
-
{
|
|
193
|
-
rotate: timer.interpolate({ inputRange, outputRange }),
|
|
194
|
-
},
|
|
195
|
-
],
|
|
196
|
-
};
|
|
197
|
-
|
|
198
|
-
const offsetStyle = index ? { top: size / 2 } : null;
|
|
199
|
-
|
|
200
|
-
const lineStyle = {
|
|
201
|
-
width: size,
|
|
202
|
-
height: size,
|
|
203
|
-
borderColor: color,
|
|
204
|
-
borderWidth: size / 10,
|
|
205
|
-
borderRadius: size / 2,
|
|
206
|
-
};
|
|
207
|
-
|
|
208
|
-
return (
|
|
209
|
-
<Animated.View key={index} style={[styles.layer]}>
|
|
210
|
-
<Animated.View style={layerStyle}>
|
|
211
|
-
<Animated.View
|
|
212
|
-
style={[containerStyle, offsetStyle]}
|
|
213
|
-
collapsable={false}
|
|
214
|
-
>
|
|
215
|
-
<Animated.View style={viewportStyle}>
|
|
216
|
-
<Animated.View style={containerStyle} collapsable={false}>
|
|
217
|
-
<Animated.View style={lineStyle} />
|
|
218
|
-
</Animated.View>
|
|
219
|
-
</Animated.View>
|
|
220
|
-
</Animated.View>
|
|
221
|
-
</Animated.View>
|
|
222
|
-
</Animated.View>
|
|
223
|
-
);
|
|
224
|
-
})}
|
|
225
|
-
</Animated.View>
|
|
226
|
-
</View>
|
|
227
|
-
);
|
|
228
|
-
};
|
|
229
|
-
|
|
230
|
-
const styles = StyleSheet.create({
|
|
231
|
-
container: {
|
|
232
|
-
justifyContent: 'center',
|
|
233
|
-
alignItems: 'center',
|
|
234
|
-
},
|
|
235
|
-
|
|
236
|
-
layer: {
|
|
237
|
-
...StyleSheet.absoluteFillObject,
|
|
238
|
-
|
|
239
|
-
justifyContent: 'center',
|
|
240
|
-
alignItems: 'center',
|
|
241
|
-
},
|
|
242
|
-
});
|
|
243
|
-
|
|
244
|
-
export default ActivityIndicator;
|
package/Button/types.ts
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
TouchableNativeFeedbackProps,
|
|
3
|
-
TouchableOpacityProps,
|
|
4
|
-
} from 'react-native';
|
|
5
|
-
|
|
6
|
-
export type ButtonType =
|
|
7
|
-
| 'primary'
|
|
8
|
-
| 'secondary'
|
|
9
|
-
| 'tonal'
|
|
10
|
-
| 'outline'
|
|
11
|
-
| 'danger'
|
|
12
|
-
| 'text'
|
|
13
|
-
| 'disabled';
|
|
14
|
-
|
|
15
|
-
export type ButtonSize = 'large' | 'medium' | 'small';
|
|
16
|
-
|
|
17
|
-
export interface ButtonProps
|
|
18
|
-
extends TouchableOpacityProps,
|
|
19
|
-
TouchableNativeFeedbackProps {
|
|
20
|
-
type?: ButtonType;
|
|
21
|
-
size?: ButtonSize;
|
|
22
|
-
full?: boolean;
|
|
23
|
-
iconRight?: string;
|
|
24
|
-
iconLeft?: string;
|
|
25
|
-
title: string;
|
|
26
|
-
useTintColor?: boolean;
|
|
27
|
-
}
|
package/IconButton/types.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import {TouchableOpacityProps} from 'react-native';
|
|
2
|
-
|
|
3
|
-
export type IconButtonType =
|
|
4
|
-
| 'primary'
|
|
5
|
-
| 'tonal'
|
|
6
|
-
| 'secondary'
|
|
7
|
-
| 'danger'
|
|
8
|
-
| 'outline'
|
|
9
|
-
| 'disabled';
|
|
10
|
-
export type IconButtonSize = 'large' | 'small';
|
|
11
|
-
|
|
12
|
-
export interface IconButtonProps extends TouchableOpacityProps {
|
|
13
|
-
icon: string;
|
|
14
|
-
type?: IconButtonType;
|
|
15
|
-
size?: IconButtonSize;
|
|
16
|
-
}
|
package/Input/types.ts
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import {TextInputProps} from 'react-native';
|
|
2
|
-
|
|
3
|
-
export type InputSize = 'small' | 'large';
|
|
4
|
-
export interface InputProps extends TextInputProps {
|
|
5
|
-
size: InputSize;
|
|
6
|
-
floatingValue: string;
|
|
7
|
-
floatingIcon: string;
|
|
8
|
-
errorMessage: string;
|
|
9
|
-
icon: string;
|
|
10
|
-
disabled: boolean;
|
|
11
|
-
floatingIconColor: string;
|
|
12
|
-
iconColor: string;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export interface TextAreaProps extends TextInputProps {
|
|
16
|
-
errorMessage: string;
|
|
17
|
-
floatingValue: string;
|
|
18
|
-
floatingIcon: string;
|
|
19
|
-
disabled: boolean;
|
|
20
|
-
floatingIconColor: string;
|
|
21
|
-
placeholder: string;
|
|
22
|
-
height: number;
|
|
23
|
-
}
|