@holper/react-native-holper-storybook 0.6.85 → 0.6.87
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.
|
@@ -1,26 +1,27 @@
|
|
|
1
|
-
import React, {useRef, useState} from 'react';
|
|
1
|
+
import React, { useRef, useState } from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
|
-
import {View, Image} from 'react-native';
|
|
3
|
+
import { View, Image } from 'react-native';
|
|
4
4
|
import Swiper from 'react-native-deck-swiper';
|
|
5
5
|
import Entypo from 'react-native-vector-icons/Entypo';
|
|
6
6
|
import Text from '../Text';
|
|
7
7
|
import Button from '../Button';
|
|
8
|
-
import {Colors} from '../../configs/constants';
|
|
8
|
+
import { Colors } from '../../configs/constants';
|
|
9
9
|
import style from './style';
|
|
10
10
|
|
|
11
|
-
const DeckSwiper = ({data, inverted, nextText, onChange, onFinish}) => {
|
|
11
|
+
const DeckSwiper = ({ data, inverted, nextText, onChange, onFinish }) => {
|
|
12
12
|
const swiper = useRef(null);
|
|
13
13
|
const [finished, setFinished] = useState(false);
|
|
14
14
|
const [index, setIndex] = useState(0);
|
|
15
15
|
|
|
16
|
-
const renderDots = () =>
|
|
17
|
-
data.map((d, i) =>
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
16
|
+
const renderDots = () =>
|
|
17
|
+
data.map((d, i) => (
|
|
18
|
+
<Entypo
|
|
19
|
+
name='dot-single'
|
|
20
|
+
size={36}
|
|
21
|
+
key={`dot-${i}`}
|
|
22
|
+
style={style[index === i ? 'dotSelected' : 'dot']}
|
|
23
|
+
/>
|
|
24
|
+
));
|
|
24
25
|
|
|
25
26
|
return (
|
|
26
27
|
<>
|
|
@@ -36,14 +37,18 @@ const DeckSwiper = ({data, inverted, nextText, onChange, onFinish}) => {
|
|
|
36
37
|
<View style={style.imageContainer}>
|
|
37
38
|
<Image
|
|
38
39
|
style={style.imageResponsive}
|
|
39
|
-
source={
|
|
40
|
+
source={card.image}
|
|
40
41
|
progressiveRenderingEnabled
|
|
41
42
|
resizeMode='contain'
|
|
42
43
|
/>
|
|
43
44
|
</View>
|
|
44
45
|
<View style={style.textContainer}>
|
|
45
|
-
<Text size='extra-large' style={style.title}>
|
|
46
|
-
|
|
46
|
+
<Text size='extra-large' style={style.title}>
|
|
47
|
+
{card.title}
|
|
48
|
+
</Text>
|
|
49
|
+
<Text size='large' align='center'>
|
|
50
|
+
{card.description}
|
|
51
|
+
</Text>
|
|
47
52
|
</View>
|
|
48
53
|
</View>
|
|
49
54
|
);
|
|
@@ -52,11 +57,11 @@ const DeckSwiper = ({data, inverted, nextText, onChange, onFinish}) => {
|
|
|
52
57
|
setFinished(true);
|
|
53
58
|
onFinish();
|
|
54
59
|
}}
|
|
55
|
-
onSwipedRight={index => {
|
|
60
|
+
onSwipedRight={(index) => {
|
|
56
61
|
setIndex(index - 1);
|
|
57
62
|
onChange(index - 1);
|
|
58
63
|
}}
|
|
59
|
-
onSwipedLeft={index => {
|
|
64
|
+
onSwipedLeft={(index) => {
|
|
60
65
|
setIndex(index + 1);
|
|
61
66
|
onChange(index + 1);
|
|
62
67
|
}}
|
|
@@ -71,11 +76,12 @@ const DeckSwiper = ({data, inverted, nextText, onChange, onFinish}) => {
|
|
|
71
76
|
>
|
|
72
77
|
{!finished && (
|
|
73
78
|
<>
|
|
74
|
-
<View style={style.dotsContainer}>
|
|
75
|
-
{renderDots()}
|
|
76
|
-
</View>
|
|
79
|
+
<View style={style.dotsContainer}>{renderDots()}</View>
|
|
77
80
|
<View style={style.container}>
|
|
78
|
-
<Button
|
|
81
|
+
<Button
|
|
82
|
+
variant={inverted ? 'inverted' : 'primary'}
|
|
83
|
+
onPress={() => swiper.current.swipeLeft()}
|
|
84
|
+
>
|
|
79
85
|
<Text color='white'>{nextText}</Text>
|
|
80
86
|
</Button>
|
|
81
87
|
</View>
|
|
@@ -90,22 +96,23 @@ DeckSwiper.defaultProps = {
|
|
|
90
96
|
data: [],
|
|
91
97
|
inverted: false,
|
|
92
98
|
nextText: ' ',
|
|
93
|
-
|
|
94
|
-
},
|
|
95
|
-
onfinish: () => {
|
|
96
|
-
}
|
|
99
|
+
useUri: false,
|
|
100
|
+
onChange: () => {},
|
|
101
|
+
onfinish: () => {},
|
|
97
102
|
};
|
|
98
103
|
|
|
99
104
|
DeckSwiper.propTypes = {
|
|
100
|
-
data: PropTypes.arrayOf(
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
+
data: PropTypes.arrayOf(
|
|
106
|
+
PropTypes.shape({
|
|
107
|
+
image: PropTypes.string,
|
|
108
|
+
title: PropTypes.string,
|
|
109
|
+
description: PropTypes.string,
|
|
110
|
+
})
|
|
111
|
+
),
|
|
105
112
|
inverted: PropTypes.bool,
|
|
106
113
|
nextText: PropTypes.string,
|
|
107
114
|
onChange: PropTypes.func,
|
|
108
|
-
onFinish: PropTypes.func
|
|
115
|
+
onFinish: PropTypes.func,
|
|
109
116
|
};
|
|
110
117
|
|
|
111
118
|
export default DeckSwiper;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import PropTypes from
|
|
2
|
-
import React from
|
|
3
|
-
import { View, TextInput, Text } from
|
|
4
|
-
import style from
|
|
5
|
-
import { Colors } from
|
|
1
|
+
import PropTypes from 'prop-types';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { View, TextInput, Text } from 'react-native';
|
|
4
|
+
import style from './style';
|
|
5
|
+
import { Colors } from '../../configs/constants';
|
|
6
6
|
|
|
7
7
|
const Input = ({
|
|
8
8
|
variant,
|
|
@@ -59,22 +59,22 @@ const Input = ({
|
|
|
59
59
|
);
|
|
60
60
|
|
|
61
61
|
Input.defaultProps = {
|
|
62
|
-
variant:
|
|
62
|
+
variant: 'default',
|
|
63
63
|
disabled: false,
|
|
64
64
|
leftIcon: null,
|
|
65
65
|
leftIconWide: false,
|
|
66
66
|
showLabel: false,
|
|
67
|
-
label:
|
|
67
|
+
label: '',
|
|
68
68
|
count: false,
|
|
69
69
|
rightIcon: null,
|
|
70
|
-
value:
|
|
70
|
+
value: '',
|
|
71
71
|
maxLength: 100,
|
|
72
|
-
size:
|
|
72
|
+
size: 'fixed',
|
|
73
73
|
};
|
|
74
74
|
|
|
75
75
|
Input.propTypes = {
|
|
76
|
-
variant: PropTypes.oneOf([
|
|
77
|
-
size: PropTypes.oneOf([
|
|
76
|
+
variant: PropTypes.oneOf(['default', 'completed', 'error']),
|
|
77
|
+
size: PropTypes.oneOf(['fixed', 'fit']),
|
|
78
78
|
disabled: PropTypes.bool,
|
|
79
79
|
leftIcon: PropTypes.node,
|
|
80
80
|
leftIconWide: PropTypes.bool,
|
|
@@ -1,12 +1,6 @@
|
|
|
1
1
|
import React, { useState, useRef } from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
|
-
import {
|
|
4
|
-
Modal,
|
|
5
|
-
TouchableOpacity,
|
|
6
|
-
Platform,
|
|
7
|
-
View,
|
|
8
|
-
ActivityIndicator,
|
|
9
|
-
} from 'react-native';
|
|
3
|
+
import { Modal, TouchableOpacity, View, ActivityIndicator } from 'react-native';
|
|
10
4
|
import Ionicons from 'react-native-vector-icons/Ionicons';
|
|
11
5
|
import { CameraView, useCameraPermissions } from 'expo-camera';
|
|
12
6
|
import * as ImageManipulator from 'expo-image-manipulator';
|
|
@@ -19,8 +13,6 @@ import { ConfirmPictureModal } from './confirmPictureModal';
|
|
|
19
13
|
import style from './style';
|
|
20
14
|
|
|
21
15
|
const DESIRED_RATIO = '16:9';
|
|
22
|
-
const isAndroid = Platform.OS === 'android';
|
|
23
|
-
const isiOS = Platform.OS === 'ios';
|
|
24
16
|
|
|
25
17
|
const SvgCircle = () => {
|
|
26
18
|
return (
|
|
@@ -131,7 +123,7 @@ const TakePicture = ({
|
|
|
131
123
|
facing={type}
|
|
132
124
|
ratio={DESIRED_RATIO}
|
|
133
125
|
>
|
|
134
|
-
{avatar &&
|
|
126
|
+
{avatar && <SvgCircle />}
|
|
135
127
|
|
|
136
128
|
<View style={style.cameraFlipContainer}>
|
|
137
129
|
<TouchableOpacity onPress={closeModal} style={style.closeIcon}>
|
|
@@ -160,8 +152,6 @@ const TakePicture = ({
|
|
|
160
152
|
/>
|
|
161
153
|
</TouchableOpacity>
|
|
162
154
|
</View>
|
|
163
|
-
|
|
164
|
-
{avatar && isAndroid && <SvgCircle />}
|
|
165
155
|
</CameraView>
|
|
166
156
|
|
|
167
157
|
{takingPicture && (
|