@holper/react-native-holper-storybook 0.6.10 → 0.6.13

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,24 +1,24 @@
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
16
  const renderDots = () => (
17
- data.map((d,i) => <Entypo
17
+ data.map((d, i) => <Entypo
18
18
  name='dot-single'
19
19
  size={36}
20
20
  key={`dot-${i}`}
21
- style={style[index === i ? 'dotSelected': 'dot']}
21
+ style={style[index === i ? 'dotSelected' : 'dot']}
22
22
  />)
23
23
  );
24
24
 
@@ -28,7 +28,7 @@ const DeckSwiper = ({ data, inverted, nextText, onChange, onFinish }) => {
28
28
  ref={swiper}
29
29
  cards={data}
30
30
  renderCard={(card) => {
31
- if(!card) {
31
+ if (!card) {
32
32
  return null;
33
33
  }
34
34
  return (
@@ -42,23 +42,23 @@ const DeckSwiper = ({ data, inverted, nextText, onChange, onFinish }) => {
42
42
  />
43
43
  </View>
44
44
  <View style={style.textContainer}>
45
- <Text size='large' style={style.title}>{card.title}</Text>
46
- <Text align='center'>{card.description}</Text>
45
+ <Text size='extra-large' style={style.title}>{card.title}</Text>
46
+ <Text size='large' align='center'>{card.description}</Text>
47
47
  </View>
48
48
  </View>
49
- )
49
+ );
50
50
  }}
51
51
  onSwipedAll={() => {
52
52
  setFinished(true);
53
53
  onFinish();
54
54
  }}
55
55
  onSwipedRight={index => {
56
- setIndex(index-1);
57
- onChange(index-1);
56
+ setIndex(index - 1);
57
+ onChange(index - 1);
58
58
  }}
59
59
  onSwipedLeft={index => {
60
- setIndex(index+1);
61
- onChange(index+1);
60
+ setIndex(index + 1);
61
+ onChange(index + 1);
62
62
  }}
63
63
  cardIndex={index}
64
64
  backgroundColor={Colors.white}
@@ -69,18 +69,18 @@ const DeckSwiper = ({ data, inverted, nextText, onChange, onFinish }) => {
69
69
  goBackToPreviousCardOnSwipeRight={true}
70
70
  childrenOnTop
71
71
  >
72
- {!finished && (
73
- <>
74
- <View style={style.dotsContainer}>
75
- {renderDots()}
76
- </View>
77
- <View style={style.container}>
78
- <Button variant={inverted ? 'inverted' : 'primary'} onPress={() => swiper.current.swipeLeft()}>
79
- <Text color='white'>{nextText}</Text>
80
- </Button>
81
- </View>
82
- </>
83
- )}
72
+ {!finished && (
73
+ <>
74
+ <View style={style.dotsContainer}>
75
+ {renderDots()}
76
+ </View>
77
+ <View style={style.container}>
78
+ <Button variant={inverted ? 'inverted' : 'primary'} onPress={() => swiper.current.swipeLeft()}>
79
+ <Text color='white'>{nextText}</Text>
80
+ </Button>
81
+ </View>
82
+ </>
83
+ )}
84
84
  </Swiper>
85
85
  </>
86
86
  );
@@ -90,8 +90,10 @@ DeckSwiper.defaultProps = {
90
90
  data: [],
91
91
  inverted: false,
92
92
  nextText: ' ',
93
- onChange: () => {},
94
- onfinish: () => {}
93
+ onChange: () => {
94
+ },
95
+ onfinish: () => {
96
+ }
95
97
  };
96
98
 
97
99
  DeckSwiper.propTypes = {
@@ -104,6 +106,6 @@ DeckSwiper.propTypes = {
104
106
  nextText: PropTypes.string,
105
107
  onChange: PropTypes.func,
106
108
  onFinish: PropTypes.func
107
- }
109
+ };
108
110
 
109
111
  export default DeckSwiper;
@@ -1,7 +1,7 @@
1
- import { Dimensions } from 'react-native';
2
- import { Colors } from '../../configs/constants';
1
+ import {Dimensions} from 'react-native';
2
+ import {Colors} from '../../configs/constants';
3
3
 
4
- const { height, width } = Dimensions.get('window');
4
+ const {height, width} = Dimensions.get('window');
5
5
 
6
6
  export default {
7
7
  container: {
@@ -22,8 +22,8 @@ export default {
22
22
  alignItems: 'center',
23
23
  },
24
24
  imageContainer: {
25
- width: width - 100,
26
- height: height / 2.5,
25
+ width: width - 90,
26
+ height: height / 2.3,
27
27
  },
28
28
  imageResponsive: {
29
29
  height: undefined,
@@ -45,6 +45,7 @@ const SwipeablePanel = ({
45
45
  const LARGE_PANEL_HEIGHT = (screenHeight - offset) - calcMarginTop(); // This is the margin top
46
46
  const MEDIUM_PANEL_HEIGHT = 400; // Fixed height
47
47
 
48
+ const [closeButtonClicked, setCloseButtonClicked] = useState(false);
48
49
  const [status, setStatus] = useState(STATUS.LARGE);
49
50
  const [animatedValueY, setAnimatedValueY] = useState(LARGE_PANEL_HEIGHT);
50
51
  const pan = useRef(new Animated.ValueXY({x: 0, y: LARGE_PANEL_HEIGHT})).current;
@@ -152,7 +153,10 @@ const SwipeablePanel = ({
152
153
  </View>
153
154
 
154
155
  {closeButton && (
155
- <TouchableOpacity onPress={onClose} style={style.closeButton}>
156
+ <TouchableOpacity onPress={() => {
157
+ setCloseButtonClicked(true);
158
+ onClose();
159
+ }} style={style.closeButton}>
156
160
  <Ionicons name='close-outline' size={20} color={Colors.darkblue}/>
157
161
  </TouchableOpacity>
158
162
  )}
@@ -163,7 +167,11 @@ const SwipeablePanel = ({
163
167
  isPlaying={true}
164
168
  duration={closeAfterSeconds}
165
169
  colors={Colors.green}
166
- onComplete={onClose}
170
+ onComplete={() => {
171
+ if (!closeButtonClicked) {
172
+ onClose();
173
+ }
174
+ }}
167
175
  size={40}
168
176
  strokeWidth={4}
169
177
  >
@@ -74,7 +74,7 @@ export default {
74
74
  },
75
75
  autoClose: {
76
76
  position: 'absolute',
77
- right: 10,
77
+ left: 10,
78
78
  top: 10
79
79
  },
80
80
  };
@@ -1,11 +1,11 @@
1
1
  import * as Font from 'expo-font';
2
2
 
3
- export const loadFonts = [
4
- asyncLoadFont
5
- ];
6
-
7
3
  export const asyncLoadFont = Font.loadAsync({
8
4
  poppins_bold: require('../assets/fonts/Poppins-Bold.ttf'),
9
5
  poppins_regular: require('../assets/fonts/Poppins-Regular.ttf'),
10
6
  poppins_semiBold: require('../assets/fonts/Poppins-SemiBold.ttf')
11
7
  });
8
+
9
+ export const loadFonts = [
10
+ asyncLoadFont
11
+ ];
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "main": "lib/index.js",
3
3
  "name": "@holper/react-native-holper-storybook",
4
4
  "description": "A component library for Holper projects",
5
- "version": "0.6.10",
5
+ "version": "0.6.13",
6
6
  "license": "MIT",
7
7
  "files": [
8
8
  "lib",
@@ -31,7 +31,7 @@
31
31
  "expo-camera": "~12.1.0",
32
32
  "expo-font": "~10.0.4",
33
33
  "expo-image-manipulator": "~10.2.0",
34
- "expo-image-picker": "~12.0.1",
34
+ "expo-image-picker": "^13.1.1",
35
35
  "expo-media-library": "~14.0.0",
36
36
  "moment": "^2.29.1",
37
37
  "prop-types": "^15.7.2",