@holper/react-native-holper-storybook 0.7.0 → 0.7.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/README.md +1 -1
- package/package.json +5 -1
- package/.expo/README.md +0 -8
- package/.nvmrc +0 -1
- package/.prettierignore +0 -5
- package/.storybook/index.jsx +0 -11
- package/.storybook/main.js +0 -8
- package/.storybook/preview.jsx +0 -51
- package/.storybook/storybook.requires.js +0 -43
- package/.yarn/releases/yarn-4.5.0.cjs +0 -925
- package/.yarnrc.yml +0 -3
- package/App.jsx +0 -29
- package/app.config.js +0 -77
- package/assets/adaptive-icon.png +0 -0
- package/assets/favicon.png +0 -0
- package/assets/fonts/Poppins-Bold.ttf +0 -0
- package/assets/fonts/Poppins-Regular.ttf +0 -0
- package/assets/fonts/Poppins-SemiBold.ttf +0 -0
- package/assets/icon.png +0 -0
- package/assets/splash.png +0 -0
- package/babel.config.js +0 -7
- package/build.sh +0 -11
- package/components/Button/index.tsx +0 -66
- package/components/Button/style.ts +0 -111
- package/components/Card/index.tsx +0 -33
- package/components/Card/style.ts +0 -34
- package/components/ConfirmationModal/index.tsx +0 -104
- package/components/ConfirmationModal/style.tsx +0 -53
- package/components/Container/index.tsx +0 -33
- package/components/Container/style.ts +0 -13
- package/components/CustomChatView/index.tsx +0 -65
- package/components/CustomChatView/style.ts +0 -10
- package/components/DeckSwiper/index.tsx +0 -90
- package/components/DeckSwiper/style.ts +0 -59
- package/components/DonutCountdown/index.tsx +0 -86
- package/components/DonutCountdown/style.ts +0 -8
- package/components/FloatingContainer/index.tsx +0 -35
- package/components/FloatingContainer/style.ts +0 -25
- package/components/Footer/index.tsx +0 -35
- package/components/Footer/style.ts +0 -40
- package/components/Header/index.tsx +0 -21
- package/components/Header/style.ts +0 -34
- package/components/ImagePicker/index.tsx +0 -18
- package/components/ImageResponsive/index.tsx +0 -24
- package/components/ImageResponsive/style.ts +0 -9
- package/components/ImageViewer/index.tsx +0 -36
- package/components/ImageViewer/style.ts +0 -38
- package/components/Input/index.tsx +0 -62
- package/components/Input/style.ts +0 -91
- package/components/InputPin/index.tsx +0 -21
- package/components/InputPin/style.ts +0 -22
- package/components/MenuItem/index.tsx +0 -25
- package/components/MenuItem/style.ts +0 -44
- package/components/NavigationTitle/index.tsx +0 -53
- package/components/NavigationTitle/style.ts +0 -49
- package/components/Notification/index.tsx +0 -44
- package/components/Notification/style.ts +0 -50
- package/components/PreventDoubleClick/index.tsx +0 -28
- package/components/Select/index.tsx +0 -51
- package/components/Select/style.ts +0 -64
- package/components/SwipeablePanel/index.tsx +0 -208
- package/components/SwipeablePanel/style.ts +0 -81
- package/components/Switch/index.tsx +0 -30
- package/components/TakePicture/confirmPictureModal.tsx +0 -37
- package/components/TakePicture/index.tsx +0 -148
- package/components/TakePicture/style.ts +0 -95
- package/components/Text/index.tsx +0 -33
- package/components/Text/style.ts +0 -101
- package/components/Textarea/index.tsx +0 -26
- package/components/Textarea/style.ts +0 -38
- package/components/TimeOutButton/index.tsx +0 -67
- package/components/TimeOutButton/style.ts +0 -42
- package/components/Toast/index.tsx +0 -34
- package/components/Toast/style.ts +0 -12
- package/components/UploadDocument/index.tsx +0 -179
- package/components/UploadDocument/style.ts +0 -57
- package/components/VirtualKeyboard/index.tsx +0 -75
- package/components/VirtualKeyboard/style.ts +0 -25
- package/components/index.ts +0 -29
- package/configs/constants.ts +0 -273
- package/configs/types.ts +0 -326
- package/eas.json +0 -27
- package/eslint.config.mjs +0 -205
- package/hooks/index.ts +0 -2
- package/hooks/useDebounce.tsx +0 -24
- package/hooks/useLoadFonts.tsx +0 -13
- package/metro.config.js +0 -11
- package/prettier.config.mjs +0 -23
- package/stories/Button.stories.tsx +0 -181
- package/stories/Card.stories.tsx +0 -22
- package/stories/Colors.stories.tsx +0 -57
- package/stories/ConfirmationModal.stories.tsx +0 -142
- package/stories/Container.stories.tsx +0 -105
- package/stories/DeckSwiper.stories.tsx +0 -43
- package/stories/DonutCountdown.stories.tsx +0 -134
- package/stories/FloatingContainer.stories.tsx +0 -139
- package/stories/Footer.stories.tsx +0 -65
- package/stories/Header.stories.tsx +0 -37
- package/stories/ImagePicker.stories.tsx +0 -14
- package/stories/ImageResponsive.stories.tsx +0 -18
- package/stories/ImageViewer.stories.tsx +0 -24
- package/stories/Input.stories.tsx +0 -119
- package/stories/InputPin.stories.tsx +0 -40
- package/stories/Menu.stories.tsx +0 -53
- package/stories/MenuItem.stories.tsx +0 -30
- package/stories/NavigationTitle.stories.tsx +0 -51
- package/stories/Notification.stories.tsx +0 -58
- package/stories/Select.stories.tsx +0 -270
- package/stories/SwipeablePanel.stories.tsx +0 -360
- package/stories/Switch.stories.tsx +0 -36
- package/stories/TakePicture.stories.tsx +0 -59
- package/stories/Text.stories.tsx +0 -61
- package/stories/Textarea.stories.tsx +0 -48
- package/stories/TimeOutButton.stories.tsx +0 -55
- package/stories/Toast.stories.tsx +0 -37
- package/stories/UploadDocument.stories.tsx +0 -179
- package/stories/VirtualKeyboard.stories.tsx +0 -14
- package/tsconfig.json +0 -21
- package/utilities/ScrollView.tsx +0 -19
- package/utilities/index.ts +0 -2
- package/utilities/utils.ts +0 -29
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
import { Entypo } from '@expo/vector-icons';
|
|
2
|
-
import { useRef, useState } from 'react';
|
|
3
|
-
import { Image, View } from 'react-native';
|
|
4
|
-
import Swiper from 'react-native-deck-swiper';
|
|
5
|
-
|
|
6
|
-
import { Colors } from '../../configs/constants';
|
|
7
|
-
import Button from '../Button';
|
|
8
|
-
import Text from '../Text';
|
|
9
|
-
import style from './style';
|
|
10
|
-
|
|
11
|
-
import type { DeckSwiperProps } from '../../configs/types';
|
|
12
|
-
|
|
13
|
-
const DeckSwiper = ({ data = [], inverted, nextText, onChange, onFinish }: DeckSwiperProps) => {
|
|
14
|
-
const swiper = useRef<Swiper<(typeof data)[0]>>(null);
|
|
15
|
-
const [finished, setFinished] = useState(false);
|
|
16
|
-
const [index, setIndex] = useState(0);
|
|
17
|
-
|
|
18
|
-
const renderDots = () =>
|
|
19
|
-
data?.map((d, i) => (
|
|
20
|
-
<Entypo name="dot-single" size={36} key={`dot-${i}`} style={style[index === i ? 'dotSelected' : 'dot']} />
|
|
21
|
-
));
|
|
22
|
-
|
|
23
|
-
return (
|
|
24
|
-
<>
|
|
25
|
-
<Swiper
|
|
26
|
-
ref={swiper}
|
|
27
|
-
cards={data}
|
|
28
|
-
renderCard={(card) => {
|
|
29
|
-
if (!card) {
|
|
30
|
-
return null;
|
|
31
|
-
}
|
|
32
|
-
return (
|
|
33
|
-
<View style={style.card}>
|
|
34
|
-
<View style={style.imageContainer}>
|
|
35
|
-
<Image
|
|
36
|
-
style={style.imageResponsive}
|
|
37
|
-
source={card.image}
|
|
38
|
-
progressiveRenderingEnabled
|
|
39
|
-
resizeMode="contain"
|
|
40
|
-
/>
|
|
41
|
-
</View>
|
|
42
|
-
<View style={style.textContainer}>
|
|
43
|
-
<Text size="extra-large" style={style.title}>
|
|
44
|
-
{card.title}
|
|
45
|
-
</Text>
|
|
46
|
-
<Text size="large" align="center">
|
|
47
|
-
{card.description}
|
|
48
|
-
</Text>
|
|
49
|
-
</View>
|
|
50
|
-
</View>
|
|
51
|
-
);
|
|
52
|
-
}}
|
|
53
|
-
onSwipedAll={() => {
|
|
54
|
-
setFinished(true);
|
|
55
|
-
if (onFinish) {
|
|
56
|
-
onFinish();
|
|
57
|
-
}
|
|
58
|
-
}}
|
|
59
|
-
onSwipedRight={(i) => {
|
|
60
|
-
setIndex(i - 1);
|
|
61
|
-
onChange?.(i - 1);
|
|
62
|
-
}}
|
|
63
|
-
onSwipedLeft={(i) => {
|
|
64
|
-
setIndex(i + 1);
|
|
65
|
-
onChange?.(i + 1);
|
|
66
|
-
}}
|
|
67
|
-
cardIndex={index}
|
|
68
|
-
backgroundColor={Colors.white}
|
|
69
|
-
stackSize={2}
|
|
70
|
-
verticalSwipe={false}
|
|
71
|
-
showSecondCard
|
|
72
|
-
disableRightSwipe={index === 0}
|
|
73
|
-
goBackToPreviousCardOnSwipeRight
|
|
74
|
-
childrenOnTop
|
|
75
|
-
/>
|
|
76
|
-
{!finished && (
|
|
77
|
-
<>
|
|
78
|
-
<View style={style.dotsContainer}>{renderDots()}</View>
|
|
79
|
-
<View style={style.container}>
|
|
80
|
-
<Button variant={inverted ? 'inverted' : 'primary'} onPress={() => swiper.current?.swipeLeft()}>
|
|
81
|
-
<Text color="white">{nextText}</Text>
|
|
82
|
-
</Button>
|
|
83
|
-
</View>
|
|
84
|
-
</>
|
|
85
|
-
)}
|
|
86
|
-
</>
|
|
87
|
-
);
|
|
88
|
-
};
|
|
89
|
-
|
|
90
|
-
export default DeckSwiper;
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import { Dimensions, StyleSheet } from 'react-native';
|
|
2
|
-
|
|
3
|
-
import { Colors } from '../../configs/constants';
|
|
4
|
-
|
|
5
|
-
const { height, width } = Dimensions.get('window');
|
|
6
|
-
|
|
7
|
-
export default StyleSheet.create({
|
|
8
|
-
container: {
|
|
9
|
-
position: 'absolute',
|
|
10
|
-
bottom: 0,
|
|
11
|
-
flexDirection: 'column',
|
|
12
|
-
justifyContent: 'flex-end',
|
|
13
|
-
alignItems: 'center',
|
|
14
|
-
paddingVertical: 30,
|
|
15
|
-
paddingHorizontal: 15,
|
|
16
|
-
marginBottom: 10,
|
|
17
|
-
width,
|
|
18
|
-
},
|
|
19
|
-
card: {
|
|
20
|
-
flex: 1,
|
|
21
|
-
backgroundColor: Colors.white,
|
|
22
|
-
justifyContent: 'flex-start',
|
|
23
|
-
alignItems: 'center',
|
|
24
|
-
},
|
|
25
|
-
imageContainer: {
|
|
26
|
-
width: width - 90,
|
|
27
|
-
height: height / 2.3,
|
|
28
|
-
},
|
|
29
|
-
imageResponsive: {
|
|
30
|
-
height: undefined,
|
|
31
|
-
width: undefined,
|
|
32
|
-
flex: 1,
|
|
33
|
-
},
|
|
34
|
-
textContainer: {
|
|
35
|
-
display: 'flex',
|
|
36
|
-
flexDirection: 'column',
|
|
37
|
-
justifyContent: 'center',
|
|
38
|
-
alignItems: 'center',
|
|
39
|
-
width: width - 100,
|
|
40
|
-
},
|
|
41
|
-
title: {
|
|
42
|
-
marginVertical: 10,
|
|
43
|
-
},
|
|
44
|
-
dotsContainer: {
|
|
45
|
-
width,
|
|
46
|
-
flexDirection: 'row',
|
|
47
|
-
justifyContent: 'center',
|
|
48
|
-
alignItems: 'center',
|
|
49
|
-
marginTop: 15,
|
|
50
|
-
position: 'absolute',
|
|
51
|
-
bottom: 130,
|
|
52
|
-
},
|
|
53
|
-
dot: {
|
|
54
|
-
color: Colors.gray,
|
|
55
|
-
},
|
|
56
|
-
dotSelected: {
|
|
57
|
-
color: Colors.green,
|
|
58
|
-
},
|
|
59
|
-
});
|
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
import React, { useEffect, useRef, useState } from 'react';
|
|
2
|
-
import { Animated, StyleSheet, View } from 'react-native';
|
|
3
|
-
import Svg, { Circle } from 'react-native-svg';
|
|
4
|
-
|
|
5
|
-
import { Colors } from '../../configs/constants';
|
|
6
|
-
import Text from '../Text';
|
|
7
|
-
import styles from './style';
|
|
8
|
-
|
|
9
|
-
import type { DonutCountdownProps } from '../../configs/types';
|
|
10
|
-
|
|
11
|
-
const AnimatedCircle = Animated.createAnimatedComponent(Circle);
|
|
12
|
-
|
|
13
|
-
const DonutCountdown = ({
|
|
14
|
-
bgColor = Colors.dimgray,
|
|
15
|
-
color = Colors.green,
|
|
16
|
-
duration = 10,
|
|
17
|
-
onComplete = () => {},
|
|
18
|
-
radius = 60,
|
|
19
|
-
strokeWidth = 10,
|
|
20
|
-
textColor = Colors.darkgray,
|
|
21
|
-
textSize = 'medium',
|
|
22
|
-
}: DonutCountdownProps) => {
|
|
23
|
-
const circumference = 2 * Math.PI * radius;
|
|
24
|
-
const halfCircle = radius + strokeWidth;
|
|
25
|
-
const animatedValue = useRef(new Animated.Value(0)).current;
|
|
26
|
-
const [timeLeft, setTimeLeft] = useState(duration);
|
|
27
|
-
|
|
28
|
-
useEffect(() => {
|
|
29
|
-
// Animate from 0 to 1
|
|
30
|
-
Animated.timing(animatedValue, {
|
|
31
|
-
toValue: 1,
|
|
32
|
-
duration: duration * 1000,
|
|
33
|
-
useNativeDriver: true,
|
|
34
|
-
}).start(onComplete);
|
|
35
|
-
|
|
36
|
-
// Countdown timer
|
|
37
|
-
const interval = setInterval(() => {
|
|
38
|
-
setTimeLeft((prev) => {
|
|
39
|
-
if (prev <= 1) {
|
|
40
|
-
clearInterval(interval);
|
|
41
|
-
return 0;
|
|
42
|
-
}
|
|
43
|
-
return prev - 1;
|
|
44
|
-
});
|
|
45
|
-
}, 1000);
|
|
46
|
-
|
|
47
|
-
return () => clearInterval(interval);
|
|
48
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
49
|
-
}, []);
|
|
50
|
-
|
|
51
|
-
const strokeDashoffset = animatedValue.interpolate({
|
|
52
|
-
inputRange: [0, 1],
|
|
53
|
-
outputRange: [0, circumference],
|
|
54
|
-
});
|
|
55
|
-
|
|
56
|
-
return (
|
|
57
|
-
<View style={{ width: radius * 2, height: radius * 2 }}>
|
|
58
|
-
<Svg width={radius * 2} height={radius * 2} viewBox={`0 0 ${halfCircle * 2} ${halfCircle * 2}`}>
|
|
59
|
-
{/* Background circle */}
|
|
60
|
-
<Circle cx="50%" cy="50%" r={radius} stroke={bgColor} strokeWidth={strokeWidth} fill="none" />
|
|
61
|
-
{/* Animated circle */}
|
|
62
|
-
<AnimatedCircle
|
|
63
|
-
cx="50%"
|
|
64
|
-
cy="50%"
|
|
65
|
-
r={radius}
|
|
66
|
-
stroke={color}
|
|
67
|
-
strokeWidth={strokeWidth}
|
|
68
|
-
fill="none"
|
|
69
|
-
strokeDasharray={`${circumference}, ${circumference}`}
|
|
70
|
-
strokeDashoffset={strokeDashoffset}
|
|
71
|
-
strokeLinecap="round"
|
|
72
|
-
transform={`rotate(-90 ${halfCircle} ${halfCircle})`}
|
|
73
|
-
/>
|
|
74
|
-
</Svg>
|
|
75
|
-
|
|
76
|
-
{/* Centered countdown text */}
|
|
77
|
-
<View style={[StyleSheet.absoluteFillObject, styles.center]}>
|
|
78
|
-
<Text weight="semiBold" size={textSize} style={{ color: textColor }}>
|
|
79
|
-
{timeLeft}
|
|
80
|
-
</Text>
|
|
81
|
-
</View>
|
|
82
|
-
</View>
|
|
83
|
-
);
|
|
84
|
-
};
|
|
85
|
-
|
|
86
|
-
export default DonutCountdown;
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { KeyboardAvoidingView, Platform, RefreshControl, ScrollView, View } from 'react-native';
|
|
2
|
-
|
|
3
|
-
import style from './style';
|
|
4
|
-
|
|
5
|
-
import type { FloatingContainerProps } from '../../configs/types';
|
|
6
|
-
|
|
7
|
-
const FloatingContainer = ({
|
|
8
|
-
useRefreshControl,
|
|
9
|
-
onRefresh,
|
|
10
|
-
isRefreshing,
|
|
11
|
-
children,
|
|
12
|
-
floatingComponent,
|
|
13
|
-
centered,
|
|
14
|
-
floatingContainerStyle,
|
|
15
|
-
disableScroll,
|
|
16
|
-
}: FloatingContainerProps) => (
|
|
17
|
-
<KeyboardAvoidingView style={style.floatingContainer} behavior={Platform.OS === 'ios' ? 'padding' : 'height'}>
|
|
18
|
-
<ScrollView
|
|
19
|
-
contentContainerStyle={centered ? style.centered : {}}
|
|
20
|
-
fadingEdgeLength={150}
|
|
21
|
-
keyboardShouldPersistTaps="handled"
|
|
22
|
-
showsVerticalScrollIndicator={false}
|
|
23
|
-
scrollEnabled={!disableScroll}
|
|
24
|
-
keyboardDismissMode="on-drag"
|
|
25
|
-
refreshControl={
|
|
26
|
-
useRefreshControl ? <RefreshControl refreshing={!!isRefreshing} onRefresh={onRefresh} /> : undefined
|
|
27
|
-
}
|
|
28
|
-
>
|
|
29
|
-
{children}
|
|
30
|
-
</ScrollView>
|
|
31
|
-
<View style={[style.container, floatingContainerStyle]}>{floatingComponent}</View>
|
|
32
|
-
</KeyboardAvoidingView>
|
|
33
|
-
);
|
|
34
|
-
|
|
35
|
-
export default FloatingContainer;
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { Dimensions, StyleSheet } from 'react-native';
|
|
2
|
-
|
|
3
|
-
import { Colors } from '../../configs/constants';
|
|
4
|
-
|
|
5
|
-
const { width } = Dimensions.get('window');
|
|
6
|
-
|
|
7
|
-
export default StyleSheet.create({
|
|
8
|
-
floatingContainer: {
|
|
9
|
-
flex: 1,
|
|
10
|
-
},
|
|
11
|
-
container: {
|
|
12
|
-
minHeight: 50,
|
|
13
|
-
width,
|
|
14
|
-
backgroundColor: Colors.white,
|
|
15
|
-
paddingTop: 10,
|
|
16
|
-
paddingBottom: 30,
|
|
17
|
-
paddingHorizontal: 8,
|
|
18
|
-
justifyContent: 'center',
|
|
19
|
-
alignItems: 'center',
|
|
20
|
-
alignSelf: 'center',
|
|
21
|
-
},
|
|
22
|
-
centered: {
|
|
23
|
-
alignItems: 'center',
|
|
24
|
-
},
|
|
25
|
-
});
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { Ionicons } from '@expo/vector-icons';
|
|
2
|
-
import { TouchableOpacity, View } from 'react-native';
|
|
3
|
-
|
|
4
|
-
import { Colors } from '../../configs/constants';
|
|
5
|
-
import Text from '../Text';
|
|
6
|
-
import style from './style';
|
|
7
|
-
|
|
8
|
-
import type { FooterProps } from '../../configs/types';
|
|
9
|
-
|
|
10
|
-
const Footer = ({ inverted, tabs }: FooterProps) => {
|
|
11
|
-
const renderTab = () =>
|
|
12
|
-
tabs.map((tab, index) => (
|
|
13
|
-
<TouchableOpacity key={`tab-${index}`} style={style.tab} onPress={tab.onPress}>
|
|
14
|
-
<Ionicons
|
|
15
|
-
name={tab.icon as keyof typeof Ionicons.glyphMap}
|
|
16
|
-
size={20}
|
|
17
|
-
color={inverted ? Colors.white : Colors.darkblue}
|
|
18
|
-
/>
|
|
19
|
-
<Text color={inverted ? 'white' : 'dark'} size="small">
|
|
20
|
-
{tab.text}
|
|
21
|
-
</Text>
|
|
22
|
-
{tab.badge && tab.badge > 0 && (
|
|
23
|
-
<View style={style.badge}>
|
|
24
|
-
<Text color="white" size="tiny" weight="semiBold" align="center">
|
|
25
|
-
{tab.badge > 9 ? '+9' : tab.badge}
|
|
26
|
-
</Text>
|
|
27
|
-
</View>
|
|
28
|
-
)}
|
|
29
|
-
</TouchableOpacity>
|
|
30
|
-
));
|
|
31
|
-
|
|
32
|
-
return <View style={[style.footerContainer, style[inverted ? 'inverted' : 'default']]}>{renderTab()}</View>;
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
export default Footer;
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { Dimensions, StyleSheet } from 'react-native';
|
|
2
|
-
|
|
3
|
-
import { Colors } from '../../configs/constants';
|
|
4
|
-
|
|
5
|
-
const { width } = Dimensions.get('window');
|
|
6
|
-
|
|
7
|
-
export default StyleSheet.create({
|
|
8
|
-
footerContainer: {
|
|
9
|
-
width,
|
|
10
|
-
height: 70,
|
|
11
|
-
paddingVertical: 10,
|
|
12
|
-
paddingHorizontal: 15,
|
|
13
|
-
flexDirection: 'row',
|
|
14
|
-
justifyContent: 'space-around',
|
|
15
|
-
alignItems: 'center',
|
|
16
|
-
},
|
|
17
|
-
default: {
|
|
18
|
-
backgroundColor: Colors.white,
|
|
19
|
-
borderTopColor: Colors.lightblue,
|
|
20
|
-
borderTopWidth: 1,
|
|
21
|
-
},
|
|
22
|
-
inverted: {
|
|
23
|
-
backgroundColor: Colors.violet,
|
|
24
|
-
},
|
|
25
|
-
tab: {
|
|
26
|
-
flexDirection: 'column',
|
|
27
|
-
justifyContent: 'center',
|
|
28
|
-
alignItems: 'center',
|
|
29
|
-
},
|
|
30
|
-
badge: {
|
|
31
|
-
position: 'absolute',
|
|
32
|
-
top: -5,
|
|
33
|
-
left: '52%',
|
|
34
|
-
backgroundColor: Colors.red,
|
|
35
|
-
height: 18,
|
|
36
|
-
width: 18,
|
|
37
|
-
borderRadius: 9,
|
|
38
|
-
justifyContent: 'center',
|
|
39
|
-
},
|
|
40
|
-
});
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { Ionicons } from '@expo/vector-icons';
|
|
2
|
-
import { Image, TouchableOpacity, View } from 'react-native';
|
|
3
|
-
|
|
4
|
-
import { Colors } from '../../configs/constants';
|
|
5
|
-
import style from './style';
|
|
6
|
-
|
|
7
|
-
import type { HeaderProps } from '../../configs/types';
|
|
8
|
-
|
|
9
|
-
const Header = ({ inverted, logo, right, onMenuPress }: HeaderProps) => (
|
|
10
|
-
<View style={[style.headerContainer, style[inverted ? 'inverted' : 'default']]}>
|
|
11
|
-
<TouchableOpacity onPress={onMenuPress}>
|
|
12
|
-
<Ionicons name="menu-outline" size={30} color={inverted ? Colors.white : Colors.darkblue} />
|
|
13
|
-
</TouchableOpacity>
|
|
14
|
-
<View style={style.imageContainer}>
|
|
15
|
-
<Image style={style.imageResponsive} source={logo} progressiveRenderingEnabled resizeMode="contain" />
|
|
16
|
-
</View>
|
|
17
|
-
{right}
|
|
18
|
-
</View>
|
|
19
|
-
);
|
|
20
|
-
|
|
21
|
-
export default Header;
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { Dimensions, StyleSheet } from 'react-native';
|
|
2
|
-
|
|
3
|
-
import { Colors } from '../../configs/constants';
|
|
4
|
-
|
|
5
|
-
const { width } = Dimensions.get('window');
|
|
6
|
-
|
|
7
|
-
export default StyleSheet.create({
|
|
8
|
-
headerContainer: {
|
|
9
|
-
width,
|
|
10
|
-
height: 70,
|
|
11
|
-
paddingVertical: 10,
|
|
12
|
-
paddingHorizontal: 15,
|
|
13
|
-
flexDirection: 'row',
|
|
14
|
-
justifyContent: 'space-between',
|
|
15
|
-
alignItems: 'center',
|
|
16
|
-
},
|
|
17
|
-
default: {
|
|
18
|
-
backgroundColor: Colors.white,
|
|
19
|
-
borderBottomColor: Colors.lightblue,
|
|
20
|
-
borderBottomWidth: 1,
|
|
21
|
-
},
|
|
22
|
-
inverted: {
|
|
23
|
-
backgroundColor: Colors.violet,
|
|
24
|
-
},
|
|
25
|
-
imageContainer: {
|
|
26
|
-
height: 40,
|
|
27
|
-
flex: 1,
|
|
28
|
-
},
|
|
29
|
-
imageResponsive: {
|
|
30
|
-
height: undefined,
|
|
31
|
-
width: undefined,
|
|
32
|
-
flex: 1,
|
|
33
|
-
},
|
|
34
|
-
});
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import * as ExpoImagePicker from 'expo-image-picker';
|
|
2
|
-
|
|
3
|
-
const ImagePicker = async (avatar: boolean = false) => {
|
|
4
|
-
const image = await ExpoImagePicker.launchImageLibraryAsync({
|
|
5
|
-
mediaTypes: ['images'],
|
|
6
|
-
allowsEditing: avatar,
|
|
7
|
-
aspect: [4, 3],
|
|
8
|
-
quality: 1,
|
|
9
|
-
});
|
|
10
|
-
|
|
11
|
-
if (image.canceled) {
|
|
12
|
-
return undefined;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
return image.assets && image.assets.length > 0 ? image.assets[0].uri : undefined;
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
export default ImagePicker;
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { useState } from 'react';
|
|
2
|
-
import { Image, View } from 'react-native';
|
|
3
|
-
|
|
4
|
-
import style from './style';
|
|
5
|
-
|
|
6
|
-
import type { ImageResponsiveProps } from '../../configs/types';
|
|
7
|
-
|
|
8
|
-
const ImageResponsive = ({ source, style: customStyle, avatar, ...props }: ImageResponsiveProps) => {
|
|
9
|
-
const [width, setWidth] = useState<number>(100);
|
|
10
|
-
|
|
11
|
-
return (
|
|
12
|
-
<View style={[customStyle, avatar ? { borderRadius: width / 2, overflow: 'hidden' } : {}]}>
|
|
13
|
-
<Image
|
|
14
|
-
style={style.responsiveImage}
|
|
15
|
-
source={source}
|
|
16
|
-
resizeMode={avatar ? 'cover' : 'contain'}
|
|
17
|
-
onLayout={({ nativeEvent }) => setWidth(nativeEvent.layout.width)}
|
|
18
|
-
{...props}
|
|
19
|
-
/>
|
|
20
|
-
</View>
|
|
21
|
-
);
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
export default ImageResponsive;
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { Ionicons } from '@expo/vector-icons';
|
|
2
|
-
import { useState } from 'react';
|
|
3
|
-
import { ActivityIndicator, Modal, TouchableOpacity, View } from 'react-native';
|
|
4
|
-
|
|
5
|
-
import { Colors } from '../../configs/constants';
|
|
6
|
-
import ImageResponsive from '../ImageResponsive';
|
|
7
|
-
import style from './style';
|
|
8
|
-
|
|
9
|
-
import type { ImageViewerProps } from '../../configs/types';
|
|
10
|
-
|
|
11
|
-
const ImageViewer = ({ source, style: imageStyle, ...props }: ImageViewerProps) => {
|
|
12
|
-
const [loading, setLoading] = useState<boolean>(true);
|
|
13
|
-
const [visible, setVisible] = useState<boolean>(false);
|
|
14
|
-
|
|
15
|
-
return (
|
|
16
|
-
<>
|
|
17
|
-
<TouchableOpacity onPress={() => setVisible(true)}>
|
|
18
|
-
<ImageResponsive source={source} style={imageStyle} {...props} />
|
|
19
|
-
</TouchableOpacity>
|
|
20
|
-
|
|
21
|
-
<Modal animationType="slide" transparent visible={visible} onRequestClose={() => {}}>
|
|
22
|
-
<View style={style.container}>
|
|
23
|
-
<TouchableOpacity onPress={() => setVisible(false)} style={style.closeIcon}>
|
|
24
|
-
<Ionicons name="close-outline" size={24} color={Colors.darkblue} />
|
|
25
|
-
</TouchableOpacity>
|
|
26
|
-
|
|
27
|
-
<ImageResponsive source={source} style={style.body} onLoadEnd={() => setLoading(false)} />
|
|
28
|
-
|
|
29
|
-
{loading && <ActivityIndicator style={style.activityIndicator} />}
|
|
30
|
-
</View>
|
|
31
|
-
</Modal>
|
|
32
|
-
</>
|
|
33
|
-
);
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
export default ImageViewer;
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { Dimensions, StyleSheet } from 'react-native';
|
|
2
|
-
|
|
3
|
-
import { Colors } from '../../configs/constants';
|
|
4
|
-
|
|
5
|
-
const { width, height } = Dimensions.get('window');
|
|
6
|
-
|
|
7
|
-
export default StyleSheet.create({
|
|
8
|
-
container: {
|
|
9
|
-
backgroundColor: 'rgba(0,0,0,0.9)',
|
|
10
|
-
flex: 1,
|
|
11
|
-
justifyContent: 'center',
|
|
12
|
-
alignItems: 'center',
|
|
13
|
-
position: 'relative',
|
|
14
|
-
},
|
|
15
|
-
closeIcon: {
|
|
16
|
-
position: 'absolute',
|
|
17
|
-
right: 35,
|
|
18
|
-
top: 70,
|
|
19
|
-
zIndex: 9999,
|
|
20
|
-
height: 30,
|
|
21
|
-
width: 30,
|
|
22
|
-
borderRadius: 15,
|
|
23
|
-
backgroundColor: Colors.lightblue,
|
|
24
|
-
alignItems: 'center',
|
|
25
|
-
justifyContent: 'center',
|
|
26
|
-
},
|
|
27
|
-
body: {
|
|
28
|
-
width,
|
|
29
|
-
height,
|
|
30
|
-
alignSelf: 'center',
|
|
31
|
-
position: 'relative',
|
|
32
|
-
},
|
|
33
|
-
activityIndicator: {
|
|
34
|
-
top: height / 2 - 100,
|
|
35
|
-
left: width / 2 - 20,
|
|
36
|
-
position: 'absolute',
|
|
37
|
-
},
|
|
38
|
-
});
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
import { Text, TextInput, View } from 'react-native';
|
|
2
|
-
|
|
3
|
-
import { Colors } from '../../configs/constants';
|
|
4
|
-
import style from './style';
|
|
5
|
-
|
|
6
|
-
import type { InputProps } from '../../configs/types';
|
|
7
|
-
|
|
8
|
-
const Input = ({
|
|
9
|
-
variant = 'default',
|
|
10
|
-
size = 'fixed',
|
|
11
|
-
disabled,
|
|
12
|
-
leftIcon,
|
|
13
|
-
leftIconWide,
|
|
14
|
-
showLabel,
|
|
15
|
-
label,
|
|
16
|
-
count,
|
|
17
|
-
rightIcon,
|
|
18
|
-
value,
|
|
19
|
-
maxLength = 100,
|
|
20
|
-
...props
|
|
21
|
-
}: InputProps) => (
|
|
22
|
-
<View style={style.container}>
|
|
23
|
-
{showLabel && <Text style={style.label}>{label}</Text>}
|
|
24
|
-
<View style={style.inputWrapper}>
|
|
25
|
-
<TextInput
|
|
26
|
-
style={[
|
|
27
|
-
style.input,
|
|
28
|
-
style[variant],
|
|
29
|
-
style[`${size}Size`],
|
|
30
|
-
leftIcon ? style.leftIcon : {},
|
|
31
|
-
leftIconWide ? style.leftIconWide : {},
|
|
32
|
-
disabled ? style.disabled : {},
|
|
33
|
-
]}
|
|
34
|
-
editable={!disabled}
|
|
35
|
-
allowFontScaling={false}
|
|
36
|
-
placeholderTextColor={Colors.midblue}
|
|
37
|
-
value={value}
|
|
38
|
-
maxLength={maxLength}
|
|
39
|
-
{...props}
|
|
40
|
-
/>
|
|
41
|
-
{leftIcon && (
|
|
42
|
-
<View
|
|
43
|
-
style={[
|
|
44
|
-
style.leftIconContainer,
|
|
45
|
-
leftIconWide ? style.leftWideIconContainer : {},
|
|
46
|
-
disabled ? style.disabled : {},
|
|
47
|
-
]}
|
|
48
|
-
>
|
|
49
|
-
{leftIcon}
|
|
50
|
-
</View>
|
|
51
|
-
)}
|
|
52
|
-
{rightIcon && <View style={style.rightIconContainer}>{rightIcon}</View>}
|
|
53
|
-
</View>
|
|
54
|
-
{count && (
|
|
55
|
-
<Text style={style.count}>
|
|
56
|
-
{value?.length || 0}/{maxLength}
|
|
57
|
-
</Text>
|
|
58
|
-
)}
|
|
59
|
-
</View>
|
|
60
|
-
);
|
|
61
|
-
|
|
62
|
-
export default Input;
|