@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
package/package.json CHANGED
@@ -1,91 +1,104 @@
1
1
  {
2
+ "version": "0.7.1",
2
3
  "main": "lib/index.js",
3
4
  "name": "@holper/react-native-holper-storybook",
4
5
  "description": "A component library for Holper projects",
5
- "version": "0.6.102",
6
6
  "license": "MIT",
7
7
  "files": [
8
8
  "lib",
9
9
  "index.js"
10
10
  ],
11
- "homepage": "https://bitbucket.org/d4fitwearapps/holper-storybook",
11
+ "packageManager": "yarn@4.5.0",
12
+ "homepage": "https://github.com/holperapp/holper-storybook",
12
13
  "repository": {
13
14
  "type": "git",
14
- "url": "https://bitbucket.org/d4fitwearapps/holper-storybook.git"
15
+ "url": "https://github.com/holperapp/holper-storybook.git"
15
16
  },
16
17
  "bugs": {
17
- "url": "https://bitbucket.org/d4fitwearapps/holper-storybook/issues",
18
+ "url": "https://github.com/holperapp/holper-storybook/issues",
18
19
  "email": "d4fitwear@gmail.com"
19
20
  },
20
21
  "scripts": {
21
- "start": "npx expo start",
22
+ "start": "expo start",
22
23
  "build-dev": "eas build --profile development",
23
- "build-preview": "eas build --profile preview",
24
- "eject": "expo eject",
25
24
  "clear": "watchman watch-del-all",
26
- "storybook": "start-storybook -p 7007",
27
- "storybook-publish": "./build.sh"
25
+ "android": "expo start --android",
26
+ "ios": "expo start --ios",
27
+ "web": "expo start --web",
28
+ "lint:debug": "TIMING=all eslint -c ./eslint.config.mjs --debug",
29
+ "lint:fix": "eslint -c ./eslint.config.mjs --fix",
30
+ "lint": "eslint -c ./eslint.config.mjs",
31
+ "format:check": "prettier . --check --config prettier.config.mjs",
32
+ "format": "prettier . --write --config prettier.config.mjs",
33
+ "storybook:android": "cross-env STORYBOOK_ENABLED='true' expo start --android",
34
+ "storybook:generate": "sb-rn-get-stories -js",
35
+ "storybook:ios": "cross-env STORYBOOK_ENABLED='true' expo start --ios",
36
+ "storybook:publish": "./build.sh",
37
+ "storybook:start": "cross-env STORYBOOK_ENABLED='true' expo start",
38
+ "type:check": "tsc --extendedDiagnostics",
39
+ "verify:fix": "yarn lint:fix && yarn format && yarn type:check",
40
+ "verify": "yarn lint && yarn format:check && yarn type:check"
28
41
  },
29
42
  "dependencies": {
30
- "@react-native-async-storage/async-storage": "2.1.2",
31
- "@react-native-community/datetimepicker": "8.3.0",
32
- "@react-native-community/slider": "4.5.6",
33
- "expo": "^53.0.10",
34
- "expo-asset": "~11.1.5",
35
- "expo-camera": "~16.1.7",
36
- "expo-font": "~13.3.1",
37
- "expo-image": "~2.2.0",
43
+ "@expo/metro-runtime": "~5.0.4",
44
+ "@expo/vector-icons": "^14.1.0",
45
+ "@react-native-picker/picker": "2.11.1",
46
+ "@types/react": "~19.0.10",
47
+ "dayjs": "^1.11.13",
48
+ "expo": "^53.0.19",
49
+ "expo-camera": "~16.1.10",
50
+ "expo-constants": "~17.1.7",
51
+ "expo-dev-client": "~5.2.4",
52
+ "expo-font": "~13.3.2",
38
53
  "expo-image-manipulator": "~13.1.7",
39
54
  "expo-image-picker": "~16.1.4",
40
55
  "expo-media-library": "~17.1.7",
41
- "expo-status-bar": "~2.2.3",
42
- "moment": "^2.30.1",
43
- "prop-types": "^15.8.1",
56
+ "expo-splash-screen": "~0.30.10",
57
+ "lodash": "^4.17.21",
44
58
  "react": "19.0.0",
45
59
  "react-dom": "19.0.0",
46
- "react-native": "0.79.3",
47
- "react-native-countdown-circle-timer": "^3.2.1",
48
- "react-native-deck-swiper": "^2.0.16",
49
- "react-native-dropdown-picker": "^5.4.6",
50
- "react-native-flash-message": "^0.4.2",
60
+ "react-native": "0.79.5",
61
+ "react-native-deck-swiper": "^2.0.18",
51
62
  "react-native-maps": "1.20.1",
52
- "react-native-maps-directions": "1.9.0",
53
- "react-native-safe-area-context": "5.4.0",
54
- "react-native-status-bar-height": "^2.6.0",
55
- "react-native-svg": "15.11.2",
56
- "react-native-vector-icons": "^10.0.3",
57
- "react-native-web": "^0.20.0"
63
+ "react-native-picker-select": "^9.3.1",
64
+ "react-native-screens": "~4.11.1",
65
+ "react-native-web": "^0.20.0",
66
+ "sonner-native": "^0.21.0"
58
67
  },
59
68
  "devDependencies": {
60
- "@babel/core": "^7.23.9",
61
- "@babel/traverse": "^7.26.9",
62
- "@storybook/addon-actions": "^7.6.11",
63
- "@storybook/addon-knobs": "^7.0.2",
64
- "@storybook/addon-links": "^7.6.11",
65
- "@storybook/addon-ondevice-actions": "^7.6.11",
66
- "@storybook/addon-ondevice-knobs": "^7.6.11",
67
- "@storybook/preview-api": "^7.6.11",
68
- "@storybook/react-native": "^6.5.7",
69
- "@storybook/react-native-server": "^6.5.8",
69
+ "@babel/core": "^7.26.0",
70
+ "@babel/plugin-transform-class-static-block": "^7.27.1",
71
+ "@eslint/js": "^9.31.0",
72
+ "@gorhom/bottom-sheet": "^4.6.4",
73
+ "@react-native-async-storage/async-storage": "2.1.2",
74
+ "@react-native-community/datetimepicker": "8.4.1",
75
+ "@react-native-community/slider": "4.5.6",
76
+ "@storybook/addon-ondevice-actions": "^8.3.5",
77
+ "@storybook/addon-ondevice-controls": "^8.3.5",
78
+ "@storybook/react-native": "^8.3.5",
79
+ "@types/lodash": "^4.17.20",
70
80
  "babel-loader": "^9.1.3",
71
- "expo-dev-client": "~5.2.0"
72
- },
73
- "peerDependencies": {
74
- "expo-camera": ">=13.0.0",
75
- "react": ">=18.0.0",
76
- "react-dom": ">=18.0.0",
77
- "react-native": ">=0.71.0"
81
+ "cross-env": "^7.0.3",
82
+ "eslint": "^9.30.1",
83
+ "eslint-plugin-import": "^2.32.0",
84
+ "eslint-plugin-perfectionist": "^4.15.0",
85
+ "eslint-plugin-react": "^7.37.5",
86
+ "eslint-plugin-react-hooks": "^5.2.0",
87
+ "eslint-plugin-unused-imports": "^4.1.4",
88
+ "globals": "^16.3.0",
89
+ "lint-staged": "^16.1.2",
90
+ "prettier": "^3.6.2",
91
+ "react-native-gesture-handler": "~2.24.0",
92
+ "react-native-reanimated": "~3.17.4",
93
+ "react-native-safe-area-context": "5.4.0",
94
+ "react-native-svg": "15.11.2",
95
+ "typescript": "~5.8.3",
96
+ "typescript-eslint": "^8.37.0"
78
97
  },
79
- "expo": {
80
- "doctor": {
81
- "reactNativeDirectoryCheck": {
82
- "exclude": [
83
- "react-native-maps",
84
- "react-native-maps-directions",
85
- "react-native-status-bar-height"
86
- ],
87
- "listUnknownPackages": false
88
- }
89
- }
98
+ "lint-staged": {
99
+ "*.{js,jsx,ts,tsx,json,css,md}": [
100
+ "eslint --fix",
101
+ "prettier --write"
102
+ ]
90
103
  }
91
104
  }
@@ -1,104 +0,0 @@
1
- import React, { useState, useEffect } from 'react';
2
- import PropTypes from 'prop-types';
3
- import { TouchableOpacity, ActivityIndicator } from 'react-native';
4
- import withPreventDoubleClick from './../PreventDoubleClick';
5
- import { Colors } from '../../configs/constants';
6
- import style from './style';
7
-
8
- const Button = ({
9
- onPress,
10
- disabled,
11
- isLoading,
12
- bordered,
13
- variant = 'primary',
14
- size = 'medium',
15
- noShadow,
16
- style: customStyle,
17
- debounceDelay = 0,
18
- children,
19
- }) => {
20
- const [isDisabled, setIsDisabled] = useState(disabled);
21
-
22
- useEffect(() => setIsDisabled(disabled), [disabled]);
23
-
24
- const getSpinnerColor = () => {
25
- switch (variant) {
26
- case 'primary':
27
- case 'inverted':
28
- case 'error':
29
- return Colors.white;
30
- default:
31
- return Colors.darkblue;
32
- }
33
- };
34
-
35
- const handleTap = () => {
36
- onPress();
37
- setIsDisabled(true);
38
- setTimeout(() => {
39
- setIsDisabled(false);
40
- }, debounceDelay);
41
- };
42
-
43
- return (
44
- <TouchableOpacity
45
- style={[
46
- style.button,
47
- style[variant],
48
- style[size],
49
- bordered ? style.bordered : {},
50
- isDisabled ? style.disabled : {},
51
- noShadow ? style.noShadow : {},
52
- customStyle,
53
- ]}
54
- disabled={isLoading || isDisabled}
55
- onPress={handleTap}
56
- >
57
- {isLoading ? (
58
- <ActivityIndicator color={getSpinnerColor()} size={28} />
59
- ) : (
60
- children
61
- )}
62
- </TouchableOpacity>
63
- );
64
- };
65
-
66
- Button.defaultProps = {
67
- children: null,
68
- disabled: false,
69
- isLoading: false,
70
- bordered: false,
71
- noShadow: false,
72
- variant: 'primary',
73
- size: 'medium',
74
- style: {},
75
- onPress: () => {},
76
- debounceDelay: 0,
77
- };
78
-
79
- Button.propTypes = {
80
- children: PropTypes.node,
81
- disabled: PropTypes.bool,
82
- isLoading: PropTypes.bool,
83
- bordered: PropTypes.bool,
84
- noShadow: PropTypes.bool,
85
- variant: PropTypes.oneOf([
86
- 'brightblue',
87
- 'brightviolet',
88
- 'darkyellow',
89
- 'dim',
90
- 'electricblue',
91
- 'error',
92
- 'inverted',
93
- 'light',
94
- 'lightgreen',
95
- 'primary',
96
- 'secondary',
97
- ]),
98
- size: PropTypes.oneOf(['tiny', 'small', 'medium', 'fit', 'icon']),
99
- style: PropTypes.any,
100
- onPress: PropTypes.func,
101
- debounceDelay: PropTypes.number,
102
- };
103
-
104
- export default withPreventDoubleClick(Button);
@@ -1,49 +0,0 @@
1
- import React from 'react';
2
- import PropTypes from 'prop-types';
3
- import { View, TouchableOpacity } from 'react-native';
4
- import withPreventDoubleClick from '../PreventDoubleClick';
5
- import style from './style';
6
-
7
- const TappedTouchableOpacity = withPreventDoubleClick(TouchableOpacity);
8
-
9
- const Card = (
10
- { children, isButton, onPress, noShadow, style: customStyle },
11
- ...props
12
- ) => (
13
- <>
14
- {isButton ? (
15
- <TappedTouchableOpacity
16
- onPress={onPress}
17
- style={[style.card, customStyle, noShadow ? style.noShadow : {}]}
18
- {...props}
19
- >
20
- {children}
21
- </TappedTouchableOpacity>
22
- ) : (
23
- <View
24
- style={[style.card, customStyle, noShadow ? style.noShadow : {}]}
25
- {...props}
26
- >
27
- {children}
28
- </View>
29
- )}
30
- </>
31
- );
32
-
33
- Card.defaultProps = {
34
- style: {},
35
- children: null,
36
- isButton: false,
37
- noShadow: false,
38
- onPress: () => {},
39
- };
40
-
41
- Card.propTypes = {
42
- style: PropTypes.any,
43
- children: PropTypes.node,
44
- isButton: PropTypes.bool,
45
- noShadow: PropTypes.bool,
46
- onPress: PropTypes.func,
47
- };
48
-
49
- export default Card;
@@ -1,118 +0,0 @@
1
- import React, { useRef, useState } from 'react';
2
- import PropTypes from 'prop-types';
3
- import { View, Image } from 'react-native';
4
- import Swiper from 'react-native-deck-swiper';
5
- import Entypo from 'react-native-vector-icons/Entypo';
6
- import Text from '../Text';
7
- import Button from '../Button';
8
- import { Colors } from '../../configs/constants';
9
- import style from './style';
10
-
11
- const DeckSwiper = ({ data, inverted, nextText, onChange, onFinish }) => {
12
- const swiper = useRef(null);
13
- const [finished, setFinished] = useState(false);
14
- const [index, setIndex] = useState(0);
15
-
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
- ));
25
-
26
- return (
27
- <>
28
- <Swiper
29
- ref={swiper}
30
- cards={data}
31
- renderCard={(card) => {
32
- if (!card) {
33
- return null;
34
- }
35
- return (
36
- <View style={style.card}>
37
- <View style={style.imageContainer}>
38
- <Image
39
- style={style.imageResponsive}
40
- source={card.image}
41
- progressiveRenderingEnabled
42
- resizeMode='contain'
43
- />
44
- </View>
45
- <View style={style.textContainer}>
46
- <Text size='extra-large' style={style.title}>
47
- {card.title}
48
- </Text>
49
- <Text size='large' align='center'>
50
- {card.description}
51
- </Text>
52
- </View>
53
- </View>
54
- );
55
- }}
56
- onSwipedAll={() => {
57
- setFinished(true);
58
- onFinish();
59
- }}
60
- onSwipedRight={(index) => {
61
- setIndex(index - 1);
62
- onChange(index - 1);
63
- }}
64
- onSwipedLeft={(index) => {
65
- setIndex(index + 1);
66
- onChange(index + 1);
67
- }}
68
- cardIndex={index}
69
- backgroundColor={Colors.white}
70
- stackSize={2}
71
- verticalSwipe={false}
72
- showSecondCard={true}
73
- disableRightSwipe={index === 0}
74
- goBackToPreviousCardOnSwipeRight={true}
75
- childrenOnTop
76
- >
77
- {!finished && (
78
- <>
79
- <View style={style.dotsContainer}>{renderDots()}</View>
80
- <View style={style.container}>
81
- <Button
82
- variant={inverted ? 'inverted' : 'primary'}
83
- onPress={() => swiper.current.swipeLeft()}
84
- >
85
- <Text color='white'>{nextText}</Text>
86
- </Button>
87
- </View>
88
- </>
89
- )}
90
- </Swiper>
91
- </>
92
- );
93
- };
94
-
95
- DeckSwiper.defaultProps = {
96
- data: [],
97
- inverted: false,
98
- nextText: ' ',
99
- useUri: false,
100
- onChange: () => {},
101
- onfinish: () => {},
102
- };
103
-
104
- DeckSwiper.propTypes = {
105
- data: PropTypes.arrayOf(
106
- PropTypes.shape({
107
- image: PropTypes.string,
108
- title: PropTypes.string,
109
- description: PropTypes.string,
110
- })
111
- ),
112
- inverted: PropTypes.bool,
113
- nextText: PropTypes.string,
114
- onChange: PropTypes.func,
115
- onFinish: PropTypes.func,
116
- };
117
-
118
- export default DeckSwiper;
@@ -1,81 +0,0 @@
1
- import React from 'react';
2
- import { Platform } from 'react-native';
3
- import PropTypes from 'prop-types';
4
- import Ionicons from 'react-native-vector-icons/Ionicons';
5
- import RNFlashMessage, {
6
- showMessage,
7
- renderFlashMessageIcon,
8
- } from 'react-native-flash-message';
9
- import { Colors } from '../../configs/constants';
10
-
11
- export const customRenderFlashMessageIcon = (
12
- icon = 'success',
13
- style = {},
14
- customProps = {}
15
- ) => {
16
- switch (icon) {
17
- case 'success':
18
- return (
19
- <Ionicons
20
- name='checkmark-circle-outline'
21
- color={Colors.darkblue}
22
- size={30}
23
- />
24
- );
25
- case 'error':
26
- return (
27
- <Ionicons
28
- name='alert-circle-outline'
29
- color={Colors.darkblue}
30
- size={30}
31
- />
32
- );
33
- }
34
-
35
- // it's good to inherit the original method...
36
- return renderFlashMessageIcon(icon, style, customProps);
37
- };
38
-
39
- const statusBarHeight = Platform.OS === 'android' ? { statusBarHeight: 5 } : {};
40
-
41
- export const sendMessage = ({ variant, message, description }) => {
42
- return showMessage({
43
- position: 'top',
44
- message,
45
- description,
46
- icon: variant,
47
- type: variant,
48
- backgroundColor: variant === 'success' ? Colors.green : Colors.lightred,
49
- color: Colors.darkblue,
50
- hideOnPress: true,
51
- ...statusBarHeight,
52
- });
53
- };
54
-
55
- sendMessage.defaultProps = {
56
- options: {
57
- variant: 'success',
58
- message: ' ',
59
- description: ' ',
60
- },
61
- };
62
-
63
- sendMessage.propTypes = {
64
- options: PropTypes.shape({
65
- variant: PropTypes.oneOf(['success', 'error']),
66
- message: PropTypes.string,
67
- description: PropTypes.string,
68
- }),
69
- };
70
-
71
- const FlashMessage = () => {
72
- return (
73
- <RNFlashMessage
74
- renderFlashMessageIcon={customRenderFlashMessageIcon}
75
- titleStyle={{ fontFamily: 'poppins_bold' }}
76
- textStyle={{ fontFamily: 'poppins_regular' }}
77
- />
78
- );
79
- };
80
-
81
- export default FlashMessage;
@@ -1,69 +0,0 @@
1
- import React from 'react';
2
- import PropTypes from 'prop-types';
3
- import {
4
- View,
5
- ScrollView,
6
- RefreshControl,
7
- KeyboardAvoidingView,
8
- Platform,
9
- } from 'react-native';
10
- import style from './style';
11
-
12
- const FloatingContainer = ({
13
- useRefreshControl,
14
- onRefresh,
15
- isRefreshing,
16
- children,
17
- floatingComponent,
18
- centered,
19
- floatingContainerStyle,
20
- disableScroll,
21
- }) => (
22
- <KeyboardAvoidingView
23
- style={style.floatingContainer}
24
- behavior={Platform.OS === 'ios' ? 'padding' : 'height'}
25
- >
26
- <ScrollView
27
- contentContainerStyle={centered ? style.centered : {}}
28
- fadingEdgeLength={150}
29
- keyboardShouldPersistTaps='handled'
30
- showsVerticalScrollIndicator={false}
31
- scrollEnabled={!disableScroll}
32
- keyboardDismissMode='on-drag'
33
- refreshControl={
34
- useRefreshControl ? (
35
- <RefreshControl refreshing={isRefreshing} onRefresh={onRefresh} />
36
- ) : null
37
- }
38
- >
39
- {children}
40
- </ScrollView>
41
- <View style={[style.container, floatingContainerStyle]}>
42
- {floatingComponent}
43
- </View>
44
- </KeyboardAvoidingView>
45
- );
46
-
47
- FloatingContainer.defaultProps = {
48
- useRefreshControl: false,
49
- isRefreshing: false,
50
- centered: false,
51
- onRefresh: () => {},
52
- children: null,
53
- floatingComponent: null,
54
- disableScroll: false,
55
- floatingContainerStyle: {},
56
- };
57
-
58
- FloatingContainer.propTypes = {
59
- useRefreshControl: PropTypes.bool,
60
- isRefreshing: PropTypes.bool,
61
- centered: PropTypes.bool,
62
- onRefresh: PropTypes.func,
63
- children: PropTypes.node,
64
- floatingComponent: PropTypes.node,
65
- disableScroll: PropTypes.bool,
66
- floatingContainerStyle: PropTypes.any,
67
- };
68
-
69
- export default FloatingContainer;
@@ -1,61 +0,0 @@
1
- import React from 'react';
2
- import PropTypes from 'prop-types';
3
- import { View, TouchableOpacity } from 'react-native';
4
- import Ionicons from 'react-native-vector-icons/Ionicons';
5
- import { Colors } from '../../configs/constants';
6
- import Text from '../Text';
7
- import style from './style';
8
-
9
- const Footer = ({ inverted, tabs }) => {
10
- const renderTab = () =>
11
- tabs.map((tab, index) => (
12
- <TouchableOpacity
13
- key={`tab-${index}`}
14
- style={style.tab}
15
- onPress={tab.onPress}
16
- >
17
- <Ionicons
18
- name={tab.icon}
19
- size={20}
20
- color={inverted ? Colors.white : Colors.darkblue}
21
- />
22
- <Text color={inverted ? 'white' : 'dark'} size='small'>
23
- {tab.text}
24
- </Text>
25
- {tab.badge && tab.badge > 0 && (
26
- <View style={style.badge}>
27
- <Text color='white' size='tiny' weight='semiBold' align='center'>
28
- {tab.badge > 9 ? '+9' : tab.badge}
29
- </Text>
30
- </View>
31
- )}
32
- </TouchableOpacity>
33
- ));
34
-
35
- return (
36
- <View
37
- style={[style.footerContainer, style[inverted ? 'inverted' : 'default']]}
38
- >
39
- {renderTab()}
40
- </View>
41
- );
42
- };
43
-
44
- Footer.defaultProps = {
45
- inverted: false,
46
- tabs: [],
47
- };
48
-
49
- Footer.propTypes = {
50
- inverted: PropTypes.bool,
51
- tabs: PropTypes.arrayOf(
52
- PropTypes.shape({
53
- onPress: PropTypes.func,
54
- text: PropTypes.string,
55
- icon: PropTypes.string,
56
- badge: PropTypes.number,
57
- })
58
- ),
59
- };
60
-
61
- export default Footer;