@holper/react-native-holper-storybook 0.6.102 → 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.
Files changed (90) hide show
  1. package/LICENSE +21 -0
  2. package/{readme.md → README.md} +19 -20
  3. package/index.js +3 -2
  4. package/lib/components/Button/index.tsx +66 -0
  5. package/lib/components/Button/{style.js → style.ts} +8 -7
  6. package/lib/components/Card/index.tsx +33 -0
  7. package/lib/components/Card/{style.js → style.ts} +5 -4
  8. package/lib/components/ConfirmationModal/{index.js → index.tsx} +25 -79
  9. package/lib/components/ConfirmationModal/{style.js → style.tsx} +14 -13
  10. package/lib/components/Container/{index.js → index.tsx} +7 -28
  11. package/lib/components/Container/{style.js → style.ts} +6 -5
  12. package/lib/components/CustomChatView/{index.js → index.tsx} +22 -30
  13. package/lib/components/CustomChatView/{style.js → style.ts} +1 -1
  14. package/lib/components/DeckSwiper/index.tsx +90 -0
  15. package/lib/components/DeckSwiper/{style.js → style.ts} +13 -12
  16. package/lib/components/DonutCountdown/index.tsx +86 -0
  17. package/lib/components/DonutCountdown/style.ts +8 -0
  18. package/lib/components/FloatingContainer/index.tsx +35 -0
  19. package/lib/components/FloatingContainer/{style.js → style.ts} +7 -6
  20. package/lib/components/Footer/index.tsx +35 -0
  21. package/lib/components/Footer/{style.js → style.ts} +4 -3
  22. package/lib/components/Header/index.tsx +21 -0
  23. package/lib/components/Header/{style.js → style.ts} +4 -3
  24. package/lib/components/ImagePicker/{index.js → index.tsx} +3 -12
  25. package/lib/components/ImageResponsive/index.tsx +24 -0
  26. package/lib/components/ImageResponsive/style.ts +9 -0
  27. package/lib/components/ImageViewer/index.tsx +36 -0
  28. package/lib/components/ImageViewer/{style.js → style.ts} +4 -3
  29. package/lib/components/Input/{index.js → index.tsx} +6 -33
  30. package/lib/components/Input/{style.js → style.ts} +7 -18
  31. package/lib/components/InputPin/{index.js → index.tsx} +6 -13
  32. package/lib/components/InputPin/{style.js → style.ts} +7 -6
  33. package/lib/components/MenuItem/index.tsx +25 -0
  34. package/lib/components/MenuItem/{style.js → style.ts} +9 -7
  35. package/lib/components/NavigationTitle/{index.js → index.tsx} +9 -30
  36. package/lib/components/NavigationTitle/{style.js → style.ts} +12 -11
  37. package/lib/components/Notification/index.tsx +44 -0
  38. package/lib/components/Notification/{style.js → style.ts} +13 -11
  39. package/lib/components/PreventDoubleClick/index.tsx +28 -0
  40. package/lib/components/Select/index.tsx +51 -0
  41. package/lib/components/Select/style.ts +64 -0
  42. package/lib/components/SwipeablePanel/{index.js → index.tsx} +58 -85
  43. package/lib/components/SwipeablePanel/{style.js → style.ts} +15 -14
  44. package/lib/components/Switch/index.tsx +30 -0
  45. package/lib/components/TakePicture/{confirmPictureModal.js → confirmPictureModal.tsx} +9 -33
  46. package/lib/components/TakePicture/index.tsx +148 -0
  47. package/lib/components/TakePicture/{style.js → style.ts} +4 -4
  48. package/lib/components/Text/index.tsx +33 -0
  49. package/lib/components/Text/{style.js → style.ts} +4 -2
  50. package/lib/components/Textarea/{index.js → index.tsx} +5 -24
  51. package/lib/components/Textarea/{style.js → style.ts} +5 -4
  52. package/lib/components/TimeOutButton/index.tsx +67 -0
  53. package/lib/components/TimeOutButton/{style.js → style.ts} +4 -3
  54. package/lib/components/Toast/index.tsx +34 -0
  55. package/lib/components/Toast/style.ts +12 -0
  56. package/lib/components/UploadDocument/{index.js → index.tsx} +49 -105
  57. package/lib/components/UploadDocument/{style.js → style.ts} +16 -15
  58. package/lib/components/VirtualKeyboard/index.tsx +75 -0
  59. package/lib/components/VirtualKeyboard/{style.js → style.ts} +9 -8
  60. package/lib/components/index.ts +29 -0
  61. package/lib/configs/{constants.js → constants.ts} +50 -48
  62. package/lib/configs/types.ts +326 -0
  63. package/lib/hooks/index.ts +2 -0
  64. package/lib/hooks/{useDebounce.js → useDebounce.tsx} +6 -4
  65. package/lib/hooks/useLoadFonts.tsx +13 -0
  66. package/lib/index.js +3 -2
  67. package/package.json +72 -59
  68. package/lib/components/Button/index.js +0 -104
  69. package/lib/components/Card/index.js +0 -49
  70. package/lib/components/DeckSwiper/index.js +0 -118
  71. package/lib/components/FlashMessage/index.js +0 -81
  72. package/lib/components/FloatingContainer/index.js +0 -69
  73. package/lib/components/Footer/index.js +0 -61
  74. package/lib/components/Header/index.js +0 -45
  75. package/lib/components/ImageResponsive/index.js +0 -39
  76. package/lib/components/ImageResponsive/style.js +0 -7
  77. package/lib/components/ImageViewer/index.js +0 -62
  78. package/lib/components/MenuItem/index.js +0 -44
  79. package/lib/components/Notification/index.js +0 -80
  80. package/lib/components/PreventDoubleClick/index.js +0 -21
  81. package/lib/components/Select/index.js +0 -89
  82. package/lib/components/Select/style.js +0 -81
  83. package/lib/components/Switch/index.js +0 -57
  84. package/lib/components/TakePicture/index.js +0 -198
  85. package/lib/components/Text/index.js +0 -75
  86. package/lib/components/TimeOutButton/index.js +0 -104
  87. package/lib/components/VirtualKeyboard/index.js +0 -86
  88. package/lib/components/index.js +0 -28
  89. package/lib/configs/loadFonts.js +0 -11
  90. package/lib/hooks/index.js +0 -1
@@ -0,0 +1,90 @@
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,9 +1,10 @@
1
- import {Dimensions} from 'react-native';
2
- import {Colors} from '../../configs/constants';
1
+ import { Dimensions, StyleSheet } from 'react-native';
3
2
 
4
- const {height, width} = Dimensions.get('window');
3
+ import { Colors } from '../../configs/constants';
5
4
 
6
- export default {
5
+ const { height, width } = Dimensions.get('window');
6
+
7
+ export default StyleSheet.create({
7
8
  container: {
8
9
  position: 'absolute',
9
10
  bottom: 0,
@@ -13,7 +14,7 @@ export default {
13
14
  paddingVertical: 30,
14
15
  paddingHorizontal: 15,
15
16
  marginBottom: 10,
16
- width
17
+ width,
17
18
  },
18
19
  card: {
19
20
  flex: 1,
@@ -28,17 +29,17 @@ export default {
28
29
  imageResponsive: {
29
30
  height: undefined,
30
31
  width: undefined,
31
- flex: 1
32
+ flex: 1,
32
33
  },
33
34
  textContainer: {
34
35
  display: 'flex',
35
36
  flexDirection: 'column',
36
37
  justifyContent: 'center',
37
38
  alignItems: 'center',
38
- width: width - 100
39
+ width: width - 100,
39
40
  },
40
41
  title: {
41
- marginVertical: 10
42
+ marginVertical: 10,
42
43
  },
43
44
  dotsContainer: {
44
45
  width,
@@ -50,9 +51,9 @@ export default {
50
51
  bottom: 130,
51
52
  },
52
53
  dot: {
53
- color: Colors.gray
54
+ color: Colors.gray,
54
55
  },
55
56
  dotSelected: {
56
- color: Colors.green
57
- }
58
- };
57
+ color: Colors.green,
58
+ },
59
+ });
@@ -0,0 +1,86 @@
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;
@@ -0,0 +1,8 @@
1
+ import { StyleSheet } from 'react-native';
2
+
3
+ export default StyleSheet.create({
4
+ center: {
5
+ justifyContent: 'center',
6
+ alignItems: 'center',
7
+ },
8
+ });
@@ -0,0 +1,35 @@
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,11 +1,12 @@
1
- import { Dimensions } from 'react-native';
1
+ import { Dimensions, StyleSheet } from 'react-native';
2
+
2
3
  import { Colors } from '../../configs/constants';
3
4
 
4
5
  const { width } = Dimensions.get('window');
5
6
 
6
- export default {
7
+ export default StyleSheet.create({
7
8
  floatingContainer: {
8
- flex: 1
9
+ flex: 1,
9
10
  },
10
11
  container: {
11
12
  minHeight: 50,
@@ -19,6 +20,6 @@ export default {
19
20
  alignSelf: 'center',
20
21
  },
21
22
  centered: {
22
- alignItems: 'center'
23
- }
24
- };
23
+ alignItems: 'center',
24
+ },
25
+ });
@@ -0,0 +1,35 @@
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,9 +1,10 @@
1
- import { Dimensions } from 'react-native';
1
+ import { Dimensions, StyleSheet } from 'react-native';
2
+
2
3
  import { Colors } from '../../configs/constants';
3
4
 
4
5
  const { width } = Dimensions.get('window');
5
6
 
6
- export default {
7
+ export default StyleSheet.create({
7
8
  footerContainer: {
8
9
  width,
9
10
  height: 70,
@@ -36,4 +37,4 @@ export default {
36
37
  borderRadius: 9,
37
38
  justifyContent: 'center',
38
39
  },
39
- };
40
+ });
@@ -0,0 +1,21 @@
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,9 +1,10 @@
1
- import { Dimensions } from 'react-native';
1
+ import { Dimensions, StyleSheet } from 'react-native';
2
+
2
3
  import { Colors } from '../../configs/constants';
3
4
 
4
5
  const { width } = Dimensions.get('window');
5
6
 
6
- export default {
7
+ export default StyleSheet.create({
7
8
  headerContainer: {
8
9
  width,
9
10
  height: 70,
@@ -30,4 +31,4 @@ export default {
30
31
  width: undefined,
31
32
  flex: 1,
32
33
  },
33
- };
34
+ });
@@ -1,7 +1,6 @@
1
- import PropTypes from 'prop-types';
2
1
  import * as ExpoImagePicker from 'expo-image-picker';
3
2
 
4
- const ImagePicker = async (avatar) => {
3
+ const ImagePicker = async (avatar: boolean = false) => {
5
4
  const image = await ExpoImagePicker.launchImageLibraryAsync({
6
5
  mediaTypes: ['images'],
7
6
  allowsEditing: avatar,
@@ -10,18 +9,10 @@ const ImagePicker = async (avatar) => {
10
9
  });
11
10
 
12
11
  if (image.canceled) {
13
- return;
12
+ return undefined;
14
13
  }
15
14
 
16
- return image.assets[0].uri;
17
- };
18
-
19
- ImagePicker.defaultProps = {
20
- avatar: false,
21
- };
22
-
23
- ImagePicker.propTypes = {
24
- avatar: PropTypes.bool,
15
+ return image.assets && image.assets.length > 0 ? image.assets[0].uri : undefined;
25
16
  };
26
17
 
27
18
  export default ImagePicker;
@@ -0,0 +1,24 @@
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;
@@ -0,0 +1,9 @@
1
+ import { StyleSheet } from 'react-native';
2
+
3
+ export default StyleSheet.create({
4
+ responsiveImage: {
5
+ height: undefined,
6
+ width: undefined,
7
+ flex: 1,
8
+ },
9
+ });
@@ -0,0 +1,36 @@
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,9 +1,10 @@
1
- import { Dimensions } from 'react-native';
1
+ import { Dimensions, StyleSheet } from 'react-native';
2
+
2
3
  import { Colors } from '../../configs/constants';
3
4
 
4
5
  const { width, height } = Dimensions.get('window');
5
6
 
6
- export default {
7
+ export default StyleSheet.create({
7
8
  container: {
8
9
  backgroundColor: 'rgba(0,0,0,0.9)',
9
10
  flex: 1,
@@ -34,4 +35,4 @@ export default {
34
35
  left: width / 2 - 20,
35
36
  position: 'absolute',
36
37
  },
37
- };
38
+ });
@@ -1,8 +1,9 @@
1
- import PropTypes from 'prop-types';
2
- import React from 'react';
3
- import { View, TextInput, Text } from 'react-native';
4
- import style from './style';
1
+ import { Text, TextInput, View } from 'react-native';
2
+
5
3
  import { Colors } from '../../configs/constants';
4
+ import style from './style';
5
+
6
+ import type { InputProps } from '../../configs/types';
6
7
 
7
8
  const Input = ({
8
9
  variant = 'default',
@@ -17,7 +18,7 @@ const Input = ({
17
18
  value,
18
19
  maxLength = 100,
19
20
  ...props
20
- }) => (
21
+ }: InputProps) => (
21
22
  <View style={style.container}>
22
23
  {showLabel && <Text style={style.label}>{label}</Text>}
23
24
  <View style={style.inputWrapper}>
@@ -58,32 +59,4 @@ const Input = ({
58
59
  </View>
59
60
  );
60
61
 
61
- Input.defaultProps = {
62
- variant: 'default',
63
- disabled: false,
64
- leftIcon: null,
65
- leftIconWide: false,
66
- showLabel: false,
67
- label: '',
68
- count: false,
69
- rightIcon: null,
70
- value: '',
71
- maxLength: 100,
72
- size: 'fixed',
73
- };
74
-
75
- Input.propTypes = {
76
- variant: PropTypes.oneOf(['default', 'completed', 'error']),
77
- size: PropTypes.oneOf(['fixed', 'fit']),
78
- disabled: PropTypes.bool,
79
- leftIcon: PropTypes.node,
80
- leftIconWide: PropTypes.bool,
81
- showLabel: PropTypes.bool,
82
- label: PropTypes.string,
83
- count: PropTypes.bool,
84
- rightIcon: PropTypes.node,
85
- value: PropTypes.string,
86
- maxLength: PropTypes.number,
87
- };
88
-
89
62
  export default Input;
@@ -1,9 +1,10 @@
1
- import { Dimensions } from 'react-native';
2
- import { Colors, borderRadius } from '../../configs/constants';
1
+ import { Dimensions, StyleSheet } from 'react-native';
2
+
3
+ import { borderRadius, Colors } from '../../configs/constants';
3
4
 
4
5
  const { width } = Dimensions.get('window');
5
6
 
6
- export default {
7
+ export default StyleSheet.create({
7
8
  container: {
8
9
  marginVertical: 8,
9
10
  },
@@ -80,23 +81,11 @@ export default {
80
81
  paddingRight: 2,
81
82
  borderRightWidth: 1,
82
83
  },
83
- rightIconContainer: {
84
- position: 'absolute',
85
- right: 10,
86
- top: 10,
87
- height: 42,
88
- justifyContent: 'center',
89
- },
90
84
  count: {
91
85
  textAlign: 'right',
92
86
  fontSize: 12,
93
87
  color: Colors.gray,
94
88
  fontFamily: 'poppins_regular',
95
- fixedSize: {
96
- width: width - 80,
97
- },
98
- fitSize: {
99
- width: '100%',
100
- },
101
- },
102
- };
89
+ width: '100%',
90
+ },
91
+ });
@@ -1,15 +1,16 @@
1
- import React from 'react';
2
- import PropTypes from 'prop-types';
3
- import { View } from 'react-native';
4
1
  import { times } from 'lodash';
2
+ import { View } from 'react-native';
3
+
5
4
  import Text from '../Text';
6
5
  import style from './style';
7
6
 
8
- const InputPin = ({ values = [] }) => (
7
+ import type { InputPinProps } from '../../configs/types';
8
+
9
+ const InputPin = ({ values = [] }: InputPinProps) => (
9
10
  <View style={style.container}>
10
11
  {times(4, (index) => (
11
12
  <View style={style.input} key={`value-${index}`}>
12
- <Text size='large' weight='semiBold'>
13
+ <Text size="large" weight="semiBold">
13
14
  {values[index]}
14
15
  </Text>
15
16
  </View>
@@ -17,12 +18,4 @@ const InputPin = ({ values = [] }) => (
17
18
  </View>
18
19
  );
19
20
 
20
- InputPin.defaultProps = {
21
- values: [],
22
- };
23
-
24
- InputPin.propTypes = {
25
- values: PropTypes.arrayOf(PropTypes.number),
26
- };
27
-
28
21
  export default InputPin;