@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.
Files changed (121) hide show
  1. package/README.md +1 -1
  2. package/package.json +5 -1
  3. package/.expo/README.md +0 -8
  4. package/.nvmrc +0 -1
  5. package/.prettierignore +0 -5
  6. package/.storybook/index.jsx +0 -11
  7. package/.storybook/main.js +0 -8
  8. package/.storybook/preview.jsx +0 -51
  9. package/.storybook/storybook.requires.js +0 -43
  10. package/.yarn/releases/yarn-4.5.0.cjs +0 -925
  11. package/.yarnrc.yml +0 -3
  12. package/App.jsx +0 -29
  13. package/app.config.js +0 -77
  14. package/assets/adaptive-icon.png +0 -0
  15. package/assets/favicon.png +0 -0
  16. package/assets/fonts/Poppins-Bold.ttf +0 -0
  17. package/assets/fonts/Poppins-Regular.ttf +0 -0
  18. package/assets/fonts/Poppins-SemiBold.ttf +0 -0
  19. package/assets/icon.png +0 -0
  20. package/assets/splash.png +0 -0
  21. package/babel.config.js +0 -7
  22. package/build.sh +0 -11
  23. package/components/Button/index.tsx +0 -66
  24. package/components/Button/style.ts +0 -111
  25. package/components/Card/index.tsx +0 -33
  26. package/components/Card/style.ts +0 -34
  27. package/components/ConfirmationModal/index.tsx +0 -104
  28. package/components/ConfirmationModal/style.tsx +0 -53
  29. package/components/Container/index.tsx +0 -33
  30. package/components/Container/style.ts +0 -13
  31. package/components/CustomChatView/index.tsx +0 -65
  32. package/components/CustomChatView/style.ts +0 -10
  33. package/components/DeckSwiper/index.tsx +0 -90
  34. package/components/DeckSwiper/style.ts +0 -59
  35. package/components/DonutCountdown/index.tsx +0 -86
  36. package/components/DonutCountdown/style.ts +0 -8
  37. package/components/FloatingContainer/index.tsx +0 -35
  38. package/components/FloatingContainer/style.ts +0 -25
  39. package/components/Footer/index.tsx +0 -35
  40. package/components/Footer/style.ts +0 -40
  41. package/components/Header/index.tsx +0 -21
  42. package/components/Header/style.ts +0 -34
  43. package/components/ImagePicker/index.tsx +0 -18
  44. package/components/ImageResponsive/index.tsx +0 -24
  45. package/components/ImageResponsive/style.ts +0 -9
  46. package/components/ImageViewer/index.tsx +0 -36
  47. package/components/ImageViewer/style.ts +0 -38
  48. package/components/Input/index.tsx +0 -62
  49. package/components/Input/style.ts +0 -91
  50. package/components/InputPin/index.tsx +0 -21
  51. package/components/InputPin/style.ts +0 -22
  52. package/components/MenuItem/index.tsx +0 -25
  53. package/components/MenuItem/style.ts +0 -44
  54. package/components/NavigationTitle/index.tsx +0 -53
  55. package/components/NavigationTitle/style.ts +0 -49
  56. package/components/Notification/index.tsx +0 -44
  57. package/components/Notification/style.ts +0 -50
  58. package/components/PreventDoubleClick/index.tsx +0 -28
  59. package/components/Select/index.tsx +0 -51
  60. package/components/Select/style.ts +0 -64
  61. package/components/SwipeablePanel/index.tsx +0 -208
  62. package/components/SwipeablePanel/style.ts +0 -81
  63. package/components/Switch/index.tsx +0 -30
  64. package/components/TakePicture/confirmPictureModal.tsx +0 -37
  65. package/components/TakePicture/index.tsx +0 -148
  66. package/components/TakePicture/style.ts +0 -95
  67. package/components/Text/index.tsx +0 -33
  68. package/components/Text/style.ts +0 -101
  69. package/components/Textarea/index.tsx +0 -26
  70. package/components/Textarea/style.ts +0 -38
  71. package/components/TimeOutButton/index.tsx +0 -67
  72. package/components/TimeOutButton/style.ts +0 -42
  73. package/components/Toast/index.tsx +0 -34
  74. package/components/Toast/style.ts +0 -12
  75. package/components/UploadDocument/index.tsx +0 -179
  76. package/components/UploadDocument/style.ts +0 -57
  77. package/components/VirtualKeyboard/index.tsx +0 -75
  78. package/components/VirtualKeyboard/style.ts +0 -25
  79. package/components/index.ts +0 -29
  80. package/configs/constants.ts +0 -273
  81. package/configs/types.ts +0 -326
  82. package/eas.json +0 -27
  83. package/eslint.config.mjs +0 -205
  84. package/hooks/index.ts +0 -2
  85. package/hooks/useDebounce.tsx +0 -24
  86. package/hooks/useLoadFonts.tsx +0 -13
  87. package/metro.config.js +0 -11
  88. package/prettier.config.mjs +0 -23
  89. package/stories/Button.stories.tsx +0 -181
  90. package/stories/Card.stories.tsx +0 -22
  91. package/stories/Colors.stories.tsx +0 -57
  92. package/stories/ConfirmationModal.stories.tsx +0 -142
  93. package/stories/Container.stories.tsx +0 -105
  94. package/stories/DeckSwiper.stories.tsx +0 -43
  95. package/stories/DonutCountdown.stories.tsx +0 -134
  96. package/stories/FloatingContainer.stories.tsx +0 -139
  97. package/stories/Footer.stories.tsx +0 -65
  98. package/stories/Header.stories.tsx +0 -37
  99. package/stories/ImagePicker.stories.tsx +0 -14
  100. package/stories/ImageResponsive.stories.tsx +0 -18
  101. package/stories/ImageViewer.stories.tsx +0 -24
  102. package/stories/Input.stories.tsx +0 -119
  103. package/stories/InputPin.stories.tsx +0 -40
  104. package/stories/Menu.stories.tsx +0 -53
  105. package/stories/MenuItem.stories.tsx +0 -30
  106. package/stories/NavigationTitle.stories.tsx +0 -51
  107. package/stories/Notification.stories.tsx +0 -58
  108. package/stories/Select.stories.tsx +0 -270
  109. package/stories/SwipeablePanel.stories.tsx +0 -360
  110. package/stories/Switch.stories.tsx +0 -36
  111. package/stories/TakePicture.stories.tsx +0 -59
  112. package/stories/Text.stories.tsx +0 -61
  113. package/stories/Textarea.stories.tsx +0 -48
  114. package/stories/TimeOutButton.stories.tsx +0 -55
  115. package/stories/Toast.stories.tsx +0 -37
  116. package/stories/UploadDocument.stories.tsx +0 -179
  117. package/stories/VirtualKeyboard.stories.tsx +0 -14
  118. package/tsconfig.json +0 -21
  119. package/utilities/ScrollView.tsx +0 -19
  120. package/utilities/index.ts +0 -2
  121. package/utilities/utils.ts +0 -29
package/.yarnrc.yml DELETED
@@ -1,3 +0,0 @@
1
- yarnPath: .yarn/releases/yarn-4.5.0.cjs
2
-
3
- nodeLinker: node-modules
package/App.jsx DELETED
@@ -1,29 +0,0 @@
1
- import { LogBox, StyleSheet, View } from 'react-native';
2
- import Constants from 'expo-constants';
3
- import { Text } from './components';
4
- LogBox.ignoreAllLogs();
5
-
6
- function App() {
7
- return (
8
- <View style={styles.container}>
9
- <Text>Open up App.tsx to start working on your app!</Text>
10
- </View>
11
- );
12
- }
13
-
14
- let AppEntryPoint = App;
15
-
16
- if (Constants.expoConfig.extra.storybookEnabled === 'true') {
17
- AppEntryPoint = require('./.storybook').default;
18
- }
19
-
20
- const styles = StyleSheet.create({
21
- container: {
22
- flex: 1,
23
- backgroundColor: '#fff',
24
- alignItems: 'center',
25
- justifyContent: 'center',
26
- },
27
- });
28
-
29
- export default AppEntryPoint;
package/app.config.js DELETED
@@ -1,77 +0,0 @@
1
- export default ({ config }) => ({
2
- ...config,
3
- android: {
4
- adaptiveIcon: {
5
- backgroundColor: '#FFFFFF',
6
- foregroundImage: './assets/adaptive-icon.png',
7
- },
8
- package: 'com.psksx1.holperstorybook',
9
- },
10
- assetBundlePatterns: ['**/*'],
11
- extra: {
12
- eas: {
13
- projectId: 'e8ab23b4-2f23-4e60-86da-4be317b4600e',
14
- },
15
- storybookEnabled: process.env.STORYBOOK_ENABLED,
16
- },
17
- icon: './assets/icon.png',
18
- ios: {
19
- bundleIdentifier: 'holper.storybook.app',
20
- config: {
21
- googleMapsApiKey: 'AIzaSyC7J4gQm2F8i2EakaQluAY19uYhkQLWCDk',
22
- },
23
- infoPlist: {
24
- ITSAppUsesNonExemptEncryption: false,
25
- },
26
- privacyManifests: {
27
- NSPrivacyAccessedAPITypes: [
28
- {
29
- NSPrivacyAccessedAPIType: 'NSPrivacyAccessedAPICategoryUserDefaults',
30
- NSPrivacyAccessedAPITypeReasons: ['CA92.1'],
31
- },
32
- ],
33
- },
34
- },
35
- name: 'Holper Storybook',
36
- orientation: 'portrait',
37
- owner: 'holper',
38
- platforms: ['ios', 'android'],
39
- plugins: [
40
- 'expo-font',
41
- [
42
- 'expo-image-picker',
43
- {
44
- photosPermission: 'The app need access to your photos.',
45
- },
46
- ],
47
- [
48
- 'expo-camera',
49
- {
50
- cameraPermission: 'Allow $(PRODUCT_NAME) to access your camera',
51
- microphonePermission: 'Allow $(PRODUCT_NAME) to access your microphone',
52
- recordAudioAndroid: true,
53
- },
54
- ],
55
- [
56
- 'expo-media-library',
57
- {
58
- isAccessMediaLocationEnabled: true,
59
- photosPermission: 'Allow $(PRODUCT_NAME) to access your photos.',
60
- savePhotosPermission: 'Allow $(PRODUCT_NAME) to save photos.',
61
- },
62
- ],
63
- ],
64
- slug: 'holper-storybook',
65
- splash: {
66
- backgroundColor: '#ffffff',
67
- image: './assets/splash.png',
68
- resizeMode: 'contain',
69
- },
70
- updates: {
71
- fallbackToCacheTimeout: 0,
72
- },
73
- version: '1.0.0',
74
- web: {
75
- favicon: './assets/favicon.png',
76
- },
77
- });
Binary file
Binary file
Binary file
Binary file
Binary file
package/assets/icon.png DELETED
Binary file
package/assets/splash.png DELETED
Binary file
package/babel.config.js DELETED
@@ -1,7 +0,0 @@
1
- module.exports = (api) => {
2
- api.cache(true);
3
- return {
4
- plugins: ['@babel/plugin-transform-class-static-block'],
5
- presets: ['babel-preset-expo'],
6
- };
7
- };
package/build.sh DELETED
@@ -1,11 +0,0 @@
1
- #!/usr/bin/env bash
2
-
3
- rm -rf ./lib
4
- mkdir lib
5
- mkdir lib/assets
6
- cp -r ./components/. ./lib/components
7
- cp -r ./configs/. ./lib/configs/
8
- cp -r ./hooks/. ./lib/hooks/
9
- cp -r ./assets/fonts/. ./lib/assets/fonts
10
- cp ./index.js ./lib
11
- npm publish
@@ -1,66 +0,0 @@
1
- import { useEffect, useState } from 'react';
2
- import { ActivityIndicator, TouchableOpacity } from 'react-native';
3
-
4
- import { Colors } from '../../configs/constants';
5
- import withPreventDoubleClick from './../PreventDoubleClick';
6
- import style from './style';
7
-
8
- import type { ButtonProps } from '../../configs/types';
9
-
10
- const Button = ({
11
- onPress,
12
- disabled,
13
- isLoading,
14
- bordered,
15
- variant = 'primary',
16
- size = 'medium',
17
- noShadow,
18
- style: customStyle,
19
- debounceDelay = 0,
20
- children,
21
- }: ButtonProps) => {
22
- const [isDisabled, setIsDisabled] = useState<boolean>(disabled || false);
23
-
24
- useEffect(() => setIsDisabled(disabled || false), [disabled]);
25
-
26
- const getSpinnerColor = () => {
27
- switch (variant) {
28
- case 'primary':
29
- case 'inverted':
30
- case 'error':
31
- return Colors.white;
32
- default:
33
- return Colors.darkblue;
34
- }
35
- };
36
-
37
- const handleTap = () => {
38
- if (onPress) {
39
- onPress();
40
- }
41
- setIsDisabled(true);
42
- setTimeout(() => {
43
- setIsDisabled(false);
44
- }, debounceDelay);
45
- };
46
-
47
- return (
48
- <TouchableOpacity
49
- style={[
50
- style.button,
51
- style[variant],
52
- style[size],
53
- bordered ? style.bordered : {},
54
- isDisabled ? style.disabled : {},
55
- noShadow ? style.noShadow : {},
56
- customStyle,
57
- ]}
58
- disabled={isLoading || isDisabled}
59
- onPress={handleTap}
60
- >
61
- {isLoading ? <ActivityIndicator color={getSpinnerColor()} size={28} /> : children}
62
- </TouchableOpacity>
63
- );
64
- };
65
-
66
- export default withPreventDoubleClick(Button);
@@ -1,111 +0,0 @@
1
- import { Dimensions, StyleSheet } from 'react-native';
2
-
3
- import { borderRadius, Colors } from '../../configs/constants';
4
-
5
- const { width } = Dimensions.get('window');
6
-
7
- export default StyleSheet.create({
8
- // Default button shape
9
- button: {
10
- height: 50,
11
- marginVertical: 8,
12
- paddingVertical: 6,
13
- paddingHorizontal: 8,
14
- borderRadius,
15
- flexDirection: 'row',
16
- justifyContent: 'center',
17
- alignItems: 'center',
18
- borderWidth: 1,
19
- shadowOffset: { width: 0, height: 4 },
20
- shadowOpacity: 0.4,
21
- shadowRadius: 3,
22
- elevation: 5,
23
- },
24
- // Variants
25
- primary: {
26
- borderColor: Colors.darkgray,
27
- backgroundColor: Colors.darkgray,
28
- shadowColor: Colors.darkgray,
29
- },
30
- secondary: {
31
- borderColor: Colors.lightblue,
32
- backgroundColor: Colors.white,
33
- shadowColor: Colors.lightblue,
34
- },
35
- dim: {
36
- borderColor: Colors.dimgray,
37
- backgroundColor: Colors.dimgray,
38
- shadowColor: Colors.dimgray,
39
- },
40
- light: {
41
- borderColor: Colors.gray,
42
- backgroundColor: Colors.gray,
43
- shadowColor: Colors.gray,
44
- },
45
- brightblue: {
46
- borderColor: Colors.brightblue,
47
- backgroundColor: Colors.brightblue,
48
- shadowColor: Colors.brightblue,
49
- },
50
- lightgreen: {
51
- borderColor: Colors.lightgreen,
52
- backgroundColor: Colors.lightgreen,
53
- shadowColor: Colors.lightgreen,
54
- },
55
- inverted: {
56
- borderColor: Colors.violet,
57
- backgroundColor: Colors.violet,
58
- shadowColor: Colors.violet,
59
- },
60
- darkyellow: {
61
- borderColor: Colors.darkyellow,
62
- backgroundColor: Colors.darkyellow,
63
- shadowColor: Colors.darkyellow,
64
- },
65
- brightviolet: {
66
- borderColor: Colors.brightviolet,
67
- backgroundColor: Colors.brightviolet,
68
- shadowColor: Colors.brightviolet,
69
- },
70
- electricblue: {
71
- borderColor: Colors.electricblue,
72
- backgroundColor: Colors.electricblue,
73
- shadowColor: Colors.electricblue,
74
- },
75
- error: {
76
- borderColor: Colors.red,
77
- backgroundColor: Colors.red,
78
- shadowColor: Colors.red,
79
- },
80
- // Bordered
81
- bordered: {
82
- shadowColor: Colors.transparent,
83
- backgroundColor: Colors.white,
84
- elevation: 0,
85
- },
86
- // Sizes
87
- tiny: {
88
- width: width * 0.25,
89
- },
90
- small: {
91
- width: width * 0.35,
92
- },
93
- medium: {
94
- width: width * 0.6,
95
- },
96
- fit: {
97
- width: '100%',
98
- },
99
- icon: {
100
- width: 55,
101
- },
102
- // Disabled
103
- disabled: {
104
- opacity: 0.5,
105
- },
106
- // NoShadow
107
- noShadow: {
108
- shadowColor: Colors.transparent,
109
- elevation: 0,
110
- },
111
- });
@@ -1,33 +0,0 @@
1
- import type { TouchableOpacityProps, ViewProps } from 'react-native';
2
-
3
- import { TouchableOpacity, View } from 'react-native';
4
-
5
- import withPreventDoubleClick from '../PreventDoubleClick';
6
- import style from './style';
7
-
8
- import type { CardProps } from '../../configs/types';
9
-
10
- const TappedTouchableOpacity = withPreventDoubleClick(TouchableOpacity);
11
-
12
- const Card = (
13
- { children, isButton, onPress, noShadow, style: customStyle }: CardProps,
14
- ...props: (TouchableOpacityProps & ViewProps)[]
15
- ) => (
16
- <>
17
- {isButton ? (
18
- <TappedTouchableOpacity
19
- onPress={onPress}
20
- style={[style.card, customStyle, noShadow ? style.noShadow : {}]}
21
- {...props}
22
- >
23
- {children}
24
- </TappedTouchableOpacity>
25
- ) : (
26
- <View style={[style.card, customStyle, noShadow ? style.noShadow : {}]} {...props}>
27
- {children}
28
- </View>
29
- )}
30
- </>
31
- );
32
-
33
- export default Card;
@@ -1,34 +0,0 @@
1
- import { Dimensions, Platform, StyleSheet } from 'react-native';
2
-
3
- import { borderRadius, Colors } from '../../configs/constants';
4
-
5
- const { width } = Dimensions.get('window');
6
- const isAndroid = Platform.OS === 'android';
7
-
8
- export default StyleSheet.create({
9
- card: {
10
- margin: 8,
11
- minHeight: 50,
12
- width: width - 60,
13
- backgroundColor: Colors.white,
14
- minWidth: 220,
15
- paddingVertical: 6,
16
- paddingHorizontal: 8,
17
- borderRadius,
18
- justifyContent: 'center',
19
- alignItems: 'center',
20
- alignSelf: 'center',
21
- borderColor: isAndroid ? Colors.transparent : Colors.lightblue,
22
- borderWidth: 1,
23
- shadowOffset: { width: 2, height: 4 },
24
- shadowOpacity: 0.4,
25
- shadowRadius: 3,
26
- shadowColor: Colors.gray,
27
- elevation: 5,
28
- },
29
- noShadow: {
30
- shadowColor: Colors.transparent,
31
- elevation: 0,
32
- borderColor: Colors.lightblue,
33
- },
34
- });
@@ -1,104 +0,0 @@
1
- import { Ionicons } from '@expo/vector-icons';
2
- import {
3
- Keyboard,
4
- KeyboardAvoidingView,
5
- Modal,
6
- Platform,
7
- TouchableOpacity,
8
- TouchableWithoutFeedback,
9
- View,
10
- } from 'react-native';
11
-
12
- import { Colors } from '../../configs/constants';
13
- import Button from '../Button';
14
- import Text from '../Text';
15
- import style from './style';
16
-
17
- import type { ConfirmationModalProps } from '../../configs/types';
18
-
19
- const ConfirmationModal = ({
20
- visible,
21
- title,
22
- confirmText,
23
- cancelText,
24
- onConfirm,
25
- onCancel,
26
- closeButton,
27
- onClose,
28
- alertMode,
29
- infoMode,
30
- inverted,
31
- isPrime,
32
- children,
33
- }: ConfirmationModalProps) => (
34
- <Modal animationType="slide" transparent visible={visible} onRequestClose={() => {}}>
35
- <KeyboardAvoidingView behavior={Platform.OS === 'ios' ? 'padding' : 'height'}>
36
- <TouchableWithoutFeedback onPress={() => Keyboard.dismiss()}>
37
- <View style={style.container}>
38
- <View style={style.content}>
39
- <View style={alertMode && !closeButton ? {} : style.title}>
40
- <Text
41
- style={alertMode && !closeButton ? {} : style.titleText}
42
- size="large"
43
- align={alertMode && !closeButton ? 'center' : 'left'}
44
- weight="semiBold"
45
- numberOfLines={1}
46
- >
47
- {title}
48
- </Text>
49
- {(!alertMode || closeButton) && (
50
- <TouchableOpacity
51
- onPress={() => {
52
- if (onClose) {
53
- onClose();
54
- } else {
55
- if (onCancel) {
56
- onCancel();
57
- }
58
- }
59
- }}
60
- style={style.button}
61
- >
62
- <Ionicons name="close-outline" size={24} color={Colors.darkblue} />
63
- </TouchableOpacity>
64
- )}
65
- </View>
66
-
67
- <View style={infoMode ? style.bodyInfo : style.body}>{children}</View>
68
-
69
- {!infoMode && (
70
- <>
71
- {alertMode ? (
72
- <Button size="fit" variant={inverted ? 'inverted' : 'primary'} onPress={onConfirm}>
73
- <Text size="large" color={isPrime ? 'lightgold' : 'white'}>
74
- {confirmText}
75
- </Text>
76
- </Button>
77
- ) : (
78
- <View style={style.buttons}>
79
- {onCancel && (
80
- <Button size="small" bordered variant={inverted ? 'inverted' : 'primary'} onPress={onCancel}>
81
- <Text size="large">{cancelText}</Text>
82
- </Button>
83
- )}
84
- <Button
85
- variant={inverted ? 'inverted' : 'primary'}
86
- size={onCancel ? 'small' : 'fit'}
87
- onPress={onConfirm}
88
- >
89
- <Text size="large" color={isPrime ? 'lightgold' : 'white'}>
90
- {confirmText}
91
- </Text>
92
- </Button>
93
- </View>
94
- )}
95
- </>
96
- )}
97
- </View>
98
- </View>
99
- </TouchableWithoutFeedback>
100
- </KeyboardAvoidingView>
101
- </Modal>
102
- );
103
-
104
- export default ConfirmationModal;
@@ -1,53 +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.3)',
10
- height,
11
- justifyContent: 'center',
12
- alignItems: 'center',
13
- },
14
- content: {
15
- width: width - 60,
16
- backgroundColor: Colors.white,
17
- padding: 20,
18
- borderRadius: 20,
19
- shadowOffset: { width: 0, height: 4 },
20
- shadowOpacity: 0.4,
21
- shadowRadius: 3,
22
- elevation: 5,
23
- shadowColor: Colors.gray,
24
- },
25
- title: {
26
- flexDirection: 'row',
27
- justifyContent: 'space-between',
28
- alignItems: 'center',
29
- },
30
- titleText: {
31
- width: '90%',
32
- },
33
- body: {
34
- marginTop: 20,
35
- marginBottom: 35,
36
- },
37
- bodyInfo: {
38
- marginTop: 20,
39
- },
40
- buttons: {
41
- flexDirection: 'row',
42
- justifyContent: 'space-between',
43
- alignItems: 'center',
44
- },
45
- button: {
46
- height: 30,
47
- width: 30,
48
- borderRadius: 15,
49
- backgroundColor: Colors.lightblue,
50
- alignItems: 'center',
51
- justifyContent: 'center',
52
- },
53
- });
@@ -1,33 +0,0 @@
1
- import { Keyboard, ScrollView, TouchableWithoutFeedback, View } from 'react-native';
2
- import { SafeAreaView } from 'react-native-safe-area-context';
3
-
4
- import style from './style';
5
-
6
- import type { ContainerProps } from '../../configs/types';
7
-
8
- const Container = ({
9
- fullScreen = true,
10
- enableScroll,
11
- style: customStyle,
12
- scrollStyle,
13
- children,
14
- ...props
15
- }: ContainerProps) => (
16
- <SafeAreaView {...props} style={[fullScreen ? style.fullScreen : {}, customStyle]}>
17
- {enableScroll ? (
18
- <ScrollView
19
- contentContainerStyle={scrollStyle}
20
- showsVerticalScrollIndicator={false}
21
- keyboardDismissMode="on-drag"
22
- >
23
- {children}
24
- </ScrollView>
25
- ) : (
26
- <TouchableWithoutFeedback onPress={Keyboard.dismiss} accessible={false}>
27
- <View style={customStyle}>{children}</View>
28
- </TouchableWithoutFeedback>
29
- )}
30
- </SafeAreaView>
31
- );
32
-
33
- export default Container;
@@ -1,13 +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
- fullScreen: {
9
- flex: 1,
10
- width,
11
- backgroundColor: Colors.white,
12
- },
13
- });
@@ -1,65 +0,0 @@
1
- import { Alert, Linking, Platform, TouchableOpacity } from 'react-native';
2
- import MapView, { PROVIDER_GOOGLE } from 'react-native-maps';
3
-
4
- import { MapStyle } from '../../configs/constants';
5
- import styles from './style';
6
-
7
- import type { CustomChatViewProps } from '../../configs/types';
8
-
9
- const CustomChatView = ({ currentMessage, containerStyle, mapViewStyle }: CustomChatViewProps) => {
10
- const openMapAsync = async () => {
11
- const { location } = currentMessage || {};
12
-
13
- if (!location) {
14
- Alert.alert('Location data is missing.');
15
- return null;
16
- }
17
-
18
- const mapScheme = Platform.select({
19
- ios: 'maps:0,0?q=',
20
- android: 'geo:0,0?q=',
21
- });
22
- const latLng = `${location.latitude},${location.longitude}`;
23
- const label = `${currentMessage?.user?.name ?? ''}`;
24
-
25
- const url = Platform.select({
26
- ios: `${mapScheme}${label}@${latLng}`,
27
- android: `${mapScheme}${latLng}(${label})`,
28
- }) as string;
29
-
30
- try {
31
- const supported = await Linking.canOpenURL(url);
32
- if (supported) {
33
- return Linking.openURL(url);
34
- }
35
- Alert.alert('Opening the map is not supported.');
36
- } catch ({ message }) {
37
- Alert.alert(message);
38
- }
39
- return null;
40
- };
41
-
42
- if (currentMessage?.location) {
43
- return (
44
- <TouchableOpacity style={[styles.container, containerStyle]} onPress={openMapAsync}>
45
- <MapView
46
- style={[styles.mapView, mapViewStyle]}
47
- region={{
48
- latitude: currentMessage.location.latitude,
49
- longitude: currentMessage.location.longitude,
50
- latitudeDelta: currentMessage.location.latitudeDelta || 0.0922,
51
- longitudeDelta: currentMessage.location.longitudeDelta || 0.0421,
52
- }}
53
- customMapStyle={MapStyle}
54
- provider={PROVIDER_GOOGLE}
55
- scrollEnabled={false}
56
- zoomEnabled={false}
57
- />
58
- </TouchableOpacity>
59
- );
60
- }
61
-
62
- return null;
63
- };
64
-
65
- export default CustomChatView;
@@ -1,10 +0,0 @@
1
- export default {
2
- container: {},
3
- mapView: {
4
- flexDirection: 'column-reverse',
5
- width: 250,
6
- height: 150,
7
- borderRadius: 13,
8
- margin: 3,
9
- },
10
- };