@bigbinary/neetoui-rn 0.0.223 → 0.0.225

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 (92) hide show
  1. package/lib/components/Accordion.js +1 -1
  2. package/lib/components/Alert.js +1 -1
  3. package/lib/components/AnimatedImage.js +1 -1
  4. package/lib/components/Avatar.js +1 -1
  5. package/lib/components/Badge.js +1 -1
  6. package/lib/components/BottomSheet.js +1 -1
  7. package/lib/components/BottomTabBar.js +1 -1
  8. package/lib/components/Button.js +1 -1
  9. package/lib/components/ButtonGroup.js +1 -1
  10. package/lib/components/Calendar.js +1 -1
  11. package/lib/components/Card.js +1 -1
  12. package/lib/components/Carousel.js +1 -1
  13. package/lib/components/CheckBox.js +1 -1
  14. package/lib/components/Chip.js +1 -1
  15. package/lib/components/Container.js +1 -1
  16. package/lib/components/Divider.js +1 -1
  17. package/lib/components/FAB.js +1 -1
  18. package/lib/components/FlashList.js +1 -1
  19. package/lib/components/FlatList.js +1 -1
  20. package/lib/components/Input.js +1 -1
  21. package/lib/components/ListItem.js +1 -1
  22. package/lib/components/Loader.js +1 -1
  23. package/lib/components/MultiSelect.js +1 -1
  24. package/lib/components/NotificationPreferenceList.js +1 -1
  25. package/lib/components/OnBoarding.js +1 -1
  26. package/lib/components/OrganizationItem.js +1 -1
  27. package/lib/components/OtpInputs.js +1 -1
  28. package/lib/components/ParentView.js +1 -1
  29. package/lib/components/Popover.js +1 -1
  30. package/lib/components/RadioButton.js +1 -1
  31. package/lib/components/RichTextEditor.js +1 -1
  32. package/lib/components/ScrollView.js +1 -1
  33. package/lib/components/SearchBar.js +1 -1
  34. package/lib/components/SegmentedTopBar.js +1 -1
  35. package/lib/components/Select.js +1 -1
  36. package/lib/components/SocialButton.js +1 -1
  37. package/lib/components/Toast.js +1 -1
  38. package/lib/components/ToggleSwitch.js +1 -1
  39. package/lib/components/TopBar.js +1 -1
  40. package/lib/components/Touchable.js +1 -1
  41. package/lib/components/Typography.js +1 -1
  42. package/lib/config/toasterConfig.js +1 -1
  43. package/lib/index.js +1 -1
  44. package/package.json +10 -7
  45. package/src/components/{Accordion.js → Accordion.jsx} +11 -12
  46. package/src/components/{Alert.js → Alert.jsx} +30 -29
  47. package/src/components/{AnimatedImage.js → AnimatedImage.jsx} +52 -55
  48. package/src/components/{Avatar.js → Avatar.jsx} +36 -39
  49. package/src/components/{Badge.js → Badge.jsx} +19 -20
  50. package/src/components/{BottomSheet.js → BottomSheet.jsx} +81 -87
  51. package/src/components/{BottomTabBar.js → BottomTabBar.jsx} +71 -77
  52. package/src/components/{Button.js → Button.jsx} +18 -15
  53. package/src/components/{ButtonGroup.js → ButtonGroup.jsx} +35 -38
  54. package/src/components/{Calendar.js → Calendar.jsx} +3 -2
  55. package/src/components/{Card.js → Card.jsx} +5 -2
  56. package/src/components/{Carousel.js → Carousel.jsx} +6 -6
  57. package/src/components/{CheckBox.js → CheckBox.jsx} +12 -8
  58. package/src/components/{Chip.js → Chip.jsx} +30 -31
  59. package/src/components/{Container.js → Container.jsx} +6 -5
  60. package/src/components/{Divider.js → Divider.jsx} +3 -2
  61. package/src/components/{FAB.js → FAB.jsx} +3 -2
  62. package/src/components/{FlashList.js → FlashList.jsx} +54 -53
  63. package/src/components/FlatList.js +1 -1
  64. package/src/components/{Input.js → Input.jsx} +43 -43
  65. package/src/components/{ListItem.js → ListItem.jsx} +24 -25
  66. package/src/components/{Loader.js → Loader.jsx} +11 -9
  67. package/src/components/{MultiSelect.js → MultiSelect.jsx} +62 -68
  68. package/src/components/{NotificationPreferenceList.js → NotificationPreferenceList.jsx} +43 -43
  69. package/src/components/{OnBoarding.js → OnBoarding.jsx} +24 -27
  70. package/src/components/OrganizationItem.jsx +107 -0
  71. package/src/components/{OtpInputs.js → OtpInputs.jsx} +35 -34
  72. package/src/components/{ParentView.js → ParentView.jsx} +5 -3
  73. package/src/components/{Popover.js → Popover.jsx} +21 -22
  74. package/src/components/{RadioButton.js → RadioButton.jsx} +10 -6
  75. package/src/components/{RichTextEditor.js → RichTextEditor.jsx} +32 -34
  76. package/src/components/ScrollView.js +1 -1
  77. package/src/components/{SearchBar.js → SearchBar.jsx} +22 -22
  78. package/src/components/{SegmentedTopBar.js → SegmentedTopBar.jsx} +15 -17
  79. package/src/components/{Select.js → Select.jsx} +33 -30
  80. package/src/components/{SocialButton.js → SocialButton.jsx} +9 -8
  81. package/src/components/{Toast.js → Toast.jsx} +25 -22
  82. package/src/components/{ToggleSwitch.js → ToggleSwitch.jsx} +12 -11
  83. package/src/components/{TopBar.js → TopBar.jsx} +4 -4
  84. package/src/components/{Touchable.js → Touchable.jsx} +9 -4
  85. package/src/components/{Typography.js → Typography.jsx} +6 -5
  86. package/src/config/{toasterConfig.js → toasterConfig.jsx} +23 -24
  87. package/src/hooks/useDebounce.js +1 -0
  88. package/src/hooks/useKeyboard.js +1 -0
  89. package/src/index.js +2 -2
  90. package/src/theme/index.js +1 -1
  91. package/src/utils/utils.js +2 -1
  92. package/src/components/OrganizationItem.js +0 -116
@@ -1,8 +1,7 @@
1
1
  import React from "react";
2
- import PropTypes from "prop-types";
3
2
  import { StyleSheet } from "react-native";
4
3
 
5
- import { Typography, Container } from "@components";
4
+ import PropTypes from "prop-types";
6
5
  import Animated, {
7
6
  Easing,
8
7
  useAnimatedStyle,
@@ -10,6 +9,8 @@ import Animated, {
10
9
  withTiming,
11
10
  } from "react-native-reanimated";
12
11
 
12
+ import { Typography, Container } from "@components";
13
+
13
14
  /**
14
15
  * Avatars can be used to represent people in a graphical way.
15
16
  *
@@ -66,46 +67,42 @@ export const Avatar = ({
66
67
 
67
68
  const [avatarSize, avatarFontSize] = getSizes();
68
69
 
69
- const profileImageStyle = useAnimatedStyle(() => {
70
- return {
71
- opacity: withTiming(opacity.value, {
72
- duration: 300,
73
- easing: Easing.bezier(0.25, 0.1, 0.25, 1),
74
- }),
75
- height: avatarSize,
76
- width: avatarSize,
77
- alignSelf: "center",
78
- borderRadius: avatarSize / 2,
79
- };
80
- });
70
+ const profileImageStyle = useAnimatedStyle(() => ({
71
+ opacity: withTiming(opacity.value, {
72
+ duration: 300,
73
+ easing: Easing.bezier(0.25, 0.1, 0.25, 1),
74
+ }),
75
+ height: avatarSize,
76
+ width: avatarSize,
77
+ alignSelf: "center",
78
+ borderRadius: avatarSize / 2,
79
+ }));
81
80
 
82
81
  return (
83
- <>
84
- <Container
85
- bg={bgColor}
86
- width={avatarSize}
87
- height={avatarSize}
88
- borderRadius={avatarSize / 2}
89
- {...rest}
90
- flexDirection="row"
91
- >
92
- <Container style={styles.acronym}>
93
- <Typography
94
- fontFamily="sf400"
95
- fontSize={avatarFontSize}
96
- color={fontColor}
97
- >
98
- {acronym.toUpperCase()}
99
- </Typography>
100
- </Container>
101
- <Animated.Image
102
- onLoad={() => (opacity.value = 1)}
103
- style={profileImageStyle}
104
- source={{ uri: imageUrl }}
105
- {...rest}
106
- />
82
+ <Container
83
+ bg={bgColor}
84
+ borderRadius={avatarSize / 2}
85
+ height={avatarSize}
86
+ width={avatarSize}
87
+ {...rest}
88
+ flexDirection="row"
89
+ >
90
+ <Container style={styles.acronym}>
91
+ <Typography
92
+ color={fontColor}
93
+ fontFamily="sf400"
94
+ fontSize={avatarFontSize}
95
+ >
96
+ {acronym.toUpperCase()}
97
+ </Typography>
107
98
  </Container>
108
- </>
99
+ <Animated.Image
100
+ source={{ uri: imageUrl }}
101
+ style={profileImageStyle}
102
+ onLoad={() => (opacity.value = 1)}
103
+ {...rest}
104
+ />
105
+ </Container>
109
106
  );
110
107
  };
111
108
 
@@ -1,5 +1,7 @@
1
1
  import React from "react";
2
+
2
3
  import PropTypes from "prop-types";
4
+
3
5
  import { Typography, Container } from "@components";
4
6
 
5
7
  /**
@@ -47,27 +49,24 @@ export const Badge = ({
47
49
  fontFamily = "sf400",
48
50
  color = "font.white",
49
51
  ...rest
50
- }) => {
51
- return (
52
- size > 0 && (
53
- <Container
54
- px={3}
55
- py={1}
56
- bg={badgeColor}
57
- borderRadius={15}
58
- justifyContent="center"
59
- alignItems="center"
60
- {...rest}
61
- >
62
- {!!content && (
63
- <Typography fontSize={fontSize} fontFamily={fontFamily} color={color}>
64
- {content}
65
- </Typography>
66
- )}
67
- </Container>
68
- )
52
+ }) =>
53
+ size > 0 && (
54
+ <Container
55
+ alignItems="center"
56
+ bg={badgeColor}
57
+ borderRadius={15}
58
+ justifyContent="center"
59
+ px={3}
60
+ py={1}
61
+ {...rest}
62
+ >
63
+ {!!content && (
64
+ <Typography color={color} fontFamily={fontFamily} fontSize={fontSize}>
65
+ {content}
66
+ </Typography>
67
+ )}
68
+ </Container>
69
69
  );
70
- };
71
70
 
72
71
  Badge.propTypes = {
73
72
  /**
@@ -1,5 +1,6 @@
1
1
  import React, { useEffect, useState } from "react";
2
2
  import { StyleSheet, FlatList, Keyboard } from "react-native";
3
+
3
4
  import PropTypes from "prop-types";
4
5
  import Modal from "react-native-modal";
5
6
  import { SafeAreaView } from "react-native-safe-area-context";
@@ -11,6 +12,7 @@ import {
11
12
  SearchBar,
12
13
  Loader,
13
14
  } from "@components";
15
+
14
16
  import { theme } from "../theme";
15
17
 
16
18
  const Title = ({
@@ -33,51 +35,49 @@ const Title = ({
33
35
  }, [isVisible, setSearchText]);
34
36
 
35
37
  return (
36
- <>
37
- <Container
38
- bg={bg}
39
- onTouchStart={e => (touchY = e.nativeEvent.pageY)}
40
- onTouchEnd={e => {
41
- // Swipe Down Detection
42
- if (e.nativeEvent.pageY - touchY > 20) hide();
43
- }}
44
- pb={12}
45
- borderRadius={20}
46
- {...titleContainerStyle}
47
- >
48
- <Container mb={16} flexDirection="row" justifyContent="space-between">
49
- {title && (
50
- <Typography textStyle="modalHeader" {...titleTextStyle}>
51
- {title}
52
- </Typography>
53
- )}
54
- {contentType && (
55
- <Touchable
56
- onPress={() => {
57
- hide();
58
- onDonePress();
59
- }}
60
- >
61
- <Typography textStyle="modalHeader" color="font.purple500">
62
- Done
63
- </Typography>
64
- </Touchable>
65
- )}
66
- </Container>
67
- {canSearch && (
68
- <SearchBar
69
- debounceDelay={200}
70
- placeholder="Search"
71
- onChangeText={setSearchText}
72
- onCancel={() => {
73
- setSearchText("");
38
+ <Container
39
+ bg={bg}
40
+ borderRadius={20}
41
+ pb={12}
42
+ onTouchStart={e => (touchY = e.nativeEvent.pageY)}
43
+ onTouchEnd={e => {
44
+ // Swipe Down Detection
45
+ if (e.nativeEvent.pageY - touchY > 20) hide();
46
+ }}
47
+ {...titleContainerStyle}
48
+ >
49
+ <Container flexDirection="row" justifyContent="space-between" mb={16}>
50
+ {title && (
51
+ <Typography textStyle="modalHeader" {...titleTextStyle}>
52
+ {title}
53
+ </Typography>
54
+ )}
55
+ {contentType && (
56
+ <Touchable
57
+ onPress={() => {
58
+ hide();
59
+ onDonePress();
74
60
  }}
75
- showCancelButton={false}
76
- {...searchBarProps}
77
- />
61
+ >
62
+ <Typography color="font.purple500" textStyle="modalHeader">
63
+ Done
64
+ </Typography>
65
+ </Touchable>
78
66
  )}
79
67
  </Container>
80
- </>
68
+ {canSearch && (
69
+ <SearchBar
70
+ debounceDelay={200}
71
+ placeholder="Search"
72
+ showCancelButton={false}
73
+ onChangeText={setSearchText}
74
+ onCancel={() => {
75
+ setSearchText("");
76
+ }}
77
+ {...searchBarProps}
78
+ />
79
+ )}
80
+ </Container>
81
81
  );
82
82
  };
83
83
 
@@ -173,18 +173,17 @@ export const BottomSheet = ({
173
173
  }) => {
174
174
  const [searchText, setSearchText] = useState("");
175
175
 
176
- const getLabel = (item, index) => {
177
- return item?.label || labelExtractor(item, index) || item;
178
- };
176
+ const getLabel = (item, index) =>
177
+ item?.label || labelExtractor(item, index) || item;
179
178
 
180
179
  const generateData = () => {
181
180
  if (searchText.length) {
182
181
  return data.filter(item =>
183
182
  getLabel(item).toLowerCase().includes(searchText.toLowerCase())
184
183
  );
185
- } else {
186
- return data;
187
184
  }
185
+
186
+ return data;
188
187
  };
189
188
 
190
189
  const hideCreateComponent = () => {
@@ -200,52 +199,55 @@ export const BottomSheet = ({
200
199
  const itemValue = item?.value || valueExtractor(item) || item;
201
200
  const selectedItemValue =
202
201
  selectedItem?.value || valueExtractor(selectedItem) || selectedItem;
202
+
203
203
  return itemValue === selectedItemValue;
204
204
  };
205
205
 
206
206
  return (
207
207
  <Modal
208
- style={styles.modalStyle}
208
+ avoidKeyboard
209
+ hideModalContentWhileAnimating
210
+ useNativeDriver
209
211
  isVisible={isVisible}
212
+ style={styles.modalStyle}
213
+ onRequestClose={hide}
210
214
  onBackdropPress={() => {
211
215
  onBackdropPress();
212
216
  hide();
213
217
  }}
214
- useNativeDriver
215
- avoidKeyboard
216
- hideModalContentWhileAnimating
217
- onRequestClose={hide}
218
218
  {...modalParams}
219
219
  >
220
220
  <SafeAreaView style={styles.safeAreaView}>
221
221
  <Container
222
222
  bg={bg}
223
- borderTopRightRadius={20}
224
223
  borderTopLeftRadius={20}
225
- p={16}
224
+ borderTopRightRadius={20}
226
225
  flexShrink={1}
226
+ p={16}
227
227
  {...rest}
228
228
  >
229
229
  {title && (
230
230
  <Title
231
- bg={bg}
232
- title={title}
233
- isVisible={isVisible}
234
- hide={hide}
235
- titleContainerStyle={titleContainerStyle}
236
- titleTextStyle={titleTextStyle}
237
231
  HeaderComponent={HeaderComponent}
238
- contentType={contentType}
232
+ bg={bg}
239
233
  canSearch={canSearch}
234
+ contentType={contentType}
235
+ hide={hide}
236
+ isVisible={isVisible}
237
+ searchBarProps={searchBarProps}
240
238
  searchText={searchText}
241
239
  setSearchText={setSearchText}
240
+ title={title}
241
+ titleContainerStyle={titleContainerStyle}
242
+ titleTextStyle={titleTextStyle}
242
243
  onDonePress={onDonePress}
243
- searchBarProps={searchBarProps}
244
244
  />
245
245
  )}
246
-
247
246
  {data && (
248
247
  <FlatList
248
+ data={generateData()}
249
+ initialNumToRender={data.length}
250
+ keyExtractor={(_item, index) => index}
249
251
  ListFooterComponent={
250
252
  <Container>
251
253
  {children}
@@ -257,21 +259,20 @@ export const BottomSheet = ({
257
259
  ) : (
258
260
  <Container
259
261
  alignItems="center"
260
- py={2}
261
262
  mb={2}
263
+ py={2}
262
264
  {...noResultsLabelContainerStyle}
263
265
  >
264
266
  <Typography
267
+ color="font.grey"
265
268
  fontFamily="sf600"
266
269
  fontSize="s"
267
- color="font.grey"
268
270
  {...noResultsLabelStyle}
269
271
  >
270
272
  {noResultsLabel || "No options found"}
271
273
  </Typography>
272
274
  </Container>
273
275
  ))}
274
-
275
276
  {!disabled &&
276
277
  !hideCreateComponent() &&
277
278
  (showCreateOptionLoader ? (
@@ -284,16 +285,16 @@ export const BottomSheet = ({
284
285
  <CreateItemComponent searchText={searchText} />
285
286
  ) : (
286
287
  <Touchable
288
+ alignItems="center"
287
289
  height={40}
288
290
  justifyContent="center"
289
- alignItems="center"
290
291
  onPress={() => onPressCreateOption(searchText)}
291
292
  {...createSearchedOptionContainerStyle}
292
293
  >
293
294
  <Typography
295
+ color="font.grey"
294
296
  fontFamily="sf400"
295
297
  fontSize="s"
296
- color="font.grey"
297
298
  {...createSearchedOptionLabelStyle}
298
299
  >
299
300
  {createOptionLabel ||
@@ -306,26 +307,19 @@ export const BottomSheet = ({
306
307
  ))}
307
308
  </Container>
308
309
  }
309
- initialNumToRender={data.length}
310
+ renderItem={({ item, index }) => (
311
+ <ContentRow
312
+ index={index}
313
+ isSelected={checkIsSelected(item)}
314
+ item={item}
315
+ key={index}
316
+ onPress={() => {
317
+ !contentType && hide();
318
+ onItemPress({ index, item });
319
+ }}
320
+ />
321
+ )}
310
322
  onScrollBeginDrag={Keyboard.dismiss}
311
- data={generateData()}
312
- renderItem={({ item, index }) => {
313
- return (
314
- <ContentRow
315
- isSelected={checkIsSelected(item)}
316
- key={index}
317
- onPress={() => {
318
- !contentType && hide();
319
- onItemPress({ index, item });
320
- }}
321
- index={index}
322
- item={item}
323
- />
324
- );
325
- }}
326
- keyExtractor={(item, index) => {
327
- return index;
328
- }}
329
323
  />
330
324
  )}
331
325
  </Container>
@@ -1,7 +1,7 @@
1
1
  import React, { useContext, useEffect } from "react";
2
- import Icon from "react-native-remix-icon";
3
- import PropTypes from "prop-types";
4
2
  import { StyleSheet, Platform, TouchableWithoutFeedback } from "react-native";
3
+
4
+ import PropTypes from "prop-types";
5
5
  import Animated, {
6
6
  useSharedValue,
7
7
  useAnimatedStyle,
@@ -9,11 +9,12 @@ import Animated, {
9
9
  interpolate,
10
10
  Extrapolation,
11
11
  } from "react-native-reanimated";
12
+ import Icon from "react-native-remix-icon";
13
+ import { ThemeContext } from "styled-components/native";
12
14
 
13
15
  import { Container, Typography } from "@components";
14
- import { ThemeContext } from "styled-components/native";
15
16
 
16
- function TabElement({
17
+ const TabElement = ({
17
18
  isFocused,
18
19
  onPress,
19
20
  label,
@@ -21,7 +22,7 @@ function TabElement({
21
22
  tabBarInactiveTintColor,
22
23
  icon,
23
24
  size,
24
- }) {
25
+ }) => {
25
26
  const theme = useContext(ThemeContext);
26
27
  const offset = useSharedValue(isFocused ? 1 : 0);
27
28
 
@@ -31,46 +32,41 @@ function TabElement({
31
32
  } else {
32
33
  offset.value = withTiming(0, { duration: 0 });
33
34
  }
34
- // eslint-disable-next-line react-hooks/exhaustive-deps
35
35
  }, [isFocused]);
36
36
 
37
- const animatedStyles = useAnimatedStyle(() => {
38
- return {
39
- opacity: interpolate(offset.value, [0, 1], [1, 0], {
40
- extrapolateRight: Extrapolation.CLAMP,
41
- }),
42
- };
43
- });
37
+ const animatedStyles = useAnimatedStyle(() => ({
38
+ opacity: interpolate(offset.value, [0, 1], [1, 0], {
39
+ extrapolateRight: Extrapolation.CLAMP,
40
+ }),
41
+ }));
44
42
 
45
- const animatedStyles2 = useAnimatedStyle(() => {
46
- return {
47
- opacity: interpolate(offset.value, [0, 0.9, 1], [0, 0.5, 1], {
48
- extrapolateRight: Extrapolation.CLAMP,
49
- }),
50
- transform: [
51
- {
52
- scale: interpolate(offset.value, [0, 0.8, 1], [1, 1.2, 1], {
53
- extrapolateRight: Extrapolation.CLAMP,
54
- }),
55
- },
56
- ],
57
- };
58
- });
43
+ const animatedStyles2 = useAnimatedStyle(() => ({
44
+ opacity: interpolate(offset.value, [0, 0.9, 1], [0, 0.5, 1], {
45
+ extrapolateRight: Extrapolation.CLAMP,
46
+ }),
47
+ transform: [
48
+ {
49
+ scale: interpolate(offset.value, [0, 0.8, 1], [1, 1.2, 1], {
50
+ extrapolateRight: Extrapolation.CLAMP,
51
+ }),
52
+ },
53
+ ],
54
+ }));
59
55
 
60
56
  return (
61
57
  <TouchableWithoutFeedback onPress={onPress}>
62
58
  <Container
63
- flex={1}
64
59
  alignItems="center"
65
- borderTopWidth={1}
66
60
  borderColor="background.grey200"
61
+ borderTopWidth={1}
62
+ flex={1}
67
63
  >
68
- <Container height={35} width={48} alignItems="center" mb={1}>
64
+ <Container alignItems="center" height={35} mb={1} width={48}>
69
65
  <Animated.View style={[styles.iconContainer, animatedStyles]}>
70
- <Icon size={size} color={theme.colors.font.grey500} name={icon} />
66
+ <Icon color={theme.colors.font.grey500} name={icon} size={size} />
71
67
  </Animated.View>
72
68
  <Animated.View style={[styles.iconContainer, animatedStyles2]}>
73
- <Icon size={size} color={theme.colors.font.base} name={icon} />
69
+ <Icon color={theme.colors.font.base} name={icon} size={size} />
74
70
  </Animated.View>
75
71
  </Container>
76
72
  <Typography
@@ -83,7 +79,7 @@ function TabElement({
83
79
  </Container>
84
80
  </TouchableWithoutFeedback>
85
81
  );
86
- }
82
+ };
87
83
 
88
84
  const styles = StyleSheet.create({
89
85
  iconContainer: {
@@ -154,53 +150,51 @@ const styles = StyleSheet.create({
154
150
  *
155
151
  */
156
152
 
157
- export const BottomTabBar = ({ state, descriptors, navigation }) => {
158
- return (
159
- <Container
160
- flexDirection="row"
161
- height={Platform.OS === "android" ? 63 : 83}
162
- bg="background.white"
163
- >
164
- {state.routes.map(({ key, name }, index) => {
165
- const { options } = descriptors[key];
166
- const isFocused = state.index === index;
167
- const { icon, size } = options?.customTabBarProps;
168
- const { tabBarActiveTintColor, tabBarInactiveTintColor } = options;
169
- const onPress = () => {
170
- const event = navigation.emit({
171
- type: "tabPress",
172
- target: key,
173
- canPreventDefault: true,
174
- });
153
+ export const BottomTabBar = ({ state, descriptors, navigation }) => (
154
+ <Container
155
+ bg="background.white"
156
+ flexDirection="row"
157
+ height={Platform.OS === "android" ? 63 : 83}
158
+ >
159
+ {state.routes.map(({ key, name }, index) => {
160
+ const { options } = descriptors[key];
161
+ const isFocused = state.index === index;
162
+ const { icon, size } = options?.customTabBarProps || {};
163
+ const { tabBarActiveTintColor, tabBarInactiveTintColor } = options;
164
+ const onPress = () => {
165
+ const event = navigation.emit({
166
+ type: "tabPress",
167
+ target: key,
168
+ canPreventDefault: true,
169
+ });
175
170
 
176
- if (!isFocused && !event.defaultPrevented) {
177
- navigation.navigate({ name: name, merge: true });
178
- }
179
- };
171
+ if (!isFocused && !event.defaultPrevented) {
172
+ navigation.navigate({ name, merge: true });
173
+ }
174
+ };
180
175
 
181
- const label =
182
- options.tabBarLabel !== undefined
183
- ? options.tabBarLabel
184
- : options.title !== undefined
185
- ? options.title
186
- : name;
176
+ const label =
177
+ options.tabBarLabel !== undefined
178
+ ? options.tabBarLabel
179
+ : options.title !== undefined
180
+ ? options.title
181
+ : name;
187
182
 
188
- return (
189
- <TabElement
190
- key={index}
191
- onPress={onPress}
192
- isFocused={isFocused}
193
- label={label}
194
- tabBarActiveTintColor={tabBarActiveTintColor}
195
- tabBarInactiveTintColor={tabBarInactiveTintColor}
196
- icon={icon}
197
- size={size}
198
- />
199
- );
200
- })}
201
- </Container>
202
- );
203
- };
183
+ return (
184
+ <TabElement
185
+ icon={icon}
186
+ isFocused={isFocused}
187
+ key={index}
188
+ label={label}
189
+ size={size}
190
+ tabBarActiveTintColor={tabBarActiveTintColor}
191
+ tabBarInactiveTintColor={tabBarInactiveTintColor}
192
+ onPress={onPress}
193
+ />
194
+ );
195
+ })}
196
+ </Container>
197
+ );
204
198
 
205
199
  TabElement.propTypes = {
206
200
  isFocused: PropTypes.bool,