@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.
- package/lib/components/Accordion.js +1 -1
- package/lib/components/Alert.js +1 -1
- package/lib/components/AnimatedImage.js +1 -1
- package/lib/components/Avatar.js +1 -1
- package/lib/components/Badge.js +1 -1
- package/lib/components/BottomSheet.js +1 -1
- package/lib/components/BottomTabBar.js +1 -1
- package/lib/components/Button.js +1 -1
- package/lib/components/ButtonGroup.js +1 -1
- package/lib/components/Calendar.js +1 -1
- package/lib/components/Card.js +1 -1
- package/lib/components/Carousel.js +1 -1
- package/lib/components/CheckBox.js +1 -1
- package/lib/components/Chip.js +1 -1
- package/lib/components/Container.js +1 -1
- package/lib/components/Divider.js +1 -1
- package/lib/components/FAB.js +1 -1
- package/lib/components/FlashList.js +1 -1
- package/lib/components/FlatList.js +1 -1
- package/lib/components/Input.js +1 -1
- package/lib/components/ListItem.js +1 -1
- package/lib/components/Loader.js +1 -1
- package/lib/components/MultiSelect.js +1 -1
- package/lib/components/NotificationPreferenceList.js +1 -1
- package/lib/components/OnBoarding.js +1 -1
- package/lib/components/OrganizationItem.js +1 -1
- package/lib/components/OtpInputs.js +1 -1
- package/lib/components/ParentView.js +1 -1
- package/lib/components/Popover.js +1 -1
- package/lib/components/RadioButton.js +1 -1
- package/lib/components/RichTextEditor.js +1 -1
- package/lib/components/ScrollView.js +1 -1
- package/lib/components/SearchBar.js +1 -1
- package/lib/components/SegmentedTopBar.js +1 -1
- package/lib/components/Select.js +1 -1
- package/lib/components/SocialButton.js +1 -1
- package/lib/components/Toast.js +1 -1
- package/lib/components/ToggleSwitch.js +1 -1
- package/lib/components/TopBar.js +1 -1
- package/lib/components/Touchable.js +1 -1
- package/lib/components/Typography.js +1 -1
- package/lib/config/toasterConfig.js +1 -1
- package/lib/index.js +1 -1
- package/package.json +10 -7
- package/src/components/{Accordion.js → Accordion.jsx} +11 -12
- package/src/components/{Alert.js → Alert.jsx} +30 -29
- package/src/components/{AnimatedImage.js → AnimatedImage.jsx} +52 -55
- package/src/components/{Avatar.js → Avatar.jsx} +36 -39
- package/src/components/{Badge.js → Badge.jsx} +19 -20
- package/src/components/{BottomSheet.js → BottomSheet.jsx} +81 -87
- package/src/components/{BottomTabBar.js → BottomTabBar.jsx} +71 -77
- package/src/components/{Button.js → Button.jsx} +18 -15
- package/src/components/{ButtonGroup.js → ButtonGroup.jsx} +35 -38
- package/src/components/{Calendar.js → Calendar.jsx} +3 -2
- package/src/components/{Card.js → Card.jsx} +5 -2
- package/src/components/{Carousel.js → Carousel.jsx} +6 -6
- package/src/components/{CheckBox.js → CheckBox.jsx} +12 -8
- package/src/components/{Chip.js → Chip.jsx} +30 -31
- package/src/components/{Container.js → Container.jsx} +6 -5
- package/src/components/{Divider.js → Divider.jsx} +3 -2
- package/src/components/{FAB.js → FAB.jsx} +3 -2
- package/src/components/{FlashList.js → FlashList.jsx} +54 -53
- package/src/components/FlatList.js +1 -1
- package/src/components/{Input.js → Input.jsx} +43 -43
- package/src/components/{ListItem.js → ListItem.jsx} +24 -25
- package/src/components/{Loader.js → Loader.jsx} +11 -9
- package/src/components/{MultiSelect.js → MultiSelect.jsx} +62 -68
- package/src/components/{NotificationPreferenceList.js → NotificationPreferenceList.jsx} +43 -43
- package/src/components/{OnBoarding.js → OnBoarding.jsx} +24 -27
- package/src/components/OrganizationItem.jsx +107 -0
- package/src/components/{OtpInputs.js → OtpInputs.jsx} +35 -34
- package/src/components/{ParentView.js → ParentView.jsx} +5 -3
- package/src/components/{Popover.js → Popover.jsx} +21 -22
- package/src/components/{RadioButton.js → RadioButton.jsx} +10 -6
- package/src/components/{RichTextEditor.js → RichTextEditor.jsx} +32 -34
- package/src/components/ScrollView.js +1 -1
- package/src/components/{SearchBar.js → SearchBar.jsx} +22 -22
- package/src/components/{SegmentedTopBar.js → SegmentedTopBar.jsx} +15 -17
- package/src/components/{Select.js → Select.jsx} +33 -30
- package/src/components/{SocialButton.js → SocialButton.jsx} +9 -8
- package/src/components/{Toast.js → Toast.jsx} +25 -22
- package/src/components/{ToggleSwitch.js → ToggleSwitch.jsx} +12 -11
- package/src/components/{TopBar.js → TopBar.jsx} +4 -4
- package/src/components/{Touchable.js → Touchable.jsx} +9 -4
- package/src/components/{Typography.js → Typography.jsx} +6 -5
- package/src/config/{toasterConfig.js → toasterConfig.jsx} +23 -24
- package/src/hooks/useDebounce.js +1 -0
- package/src/hooks/useKeyboard.js +1 -0
- package/src/index.js +2 -2
- package/src/theme/index.js +1 -1
- package/src/utils/utils.js +2 -1
- 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
|
|
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
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
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
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
>
|
|
92
|
-
<
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
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
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
{
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
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
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
>
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
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
|
-
|
|
76
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
39
|
-
|
|
40
|
-
|
|
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
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
{
|
|
52
|
-
|
|
53
|
-
|
|
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}
|
|
64
|
+
<Container alignItems="center" height={35} mb={1} width={48}>
|
|
69
65
|
<Animated.View style={[styles.iconContainer, animatedStyles]}>
|
|
70
|
-
<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
|
|
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
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
{
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
const
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
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
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
171
|
+
if (!isFocused && !event.defaultPrevented) {
|
|
172
|
+
navigation.navigate({ name, merge: true });
|
|
173
|
+
}
|
|
174
|
+
};
|
|
180
175
|
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
176
|
+
const label =
|
|
177
|
+
options.tabBarLabel !== undefined
|
|
178
|
+
? options.tabBarLabel
|
|
179
|
+
: options.title !== undefined
|
|
180
|
+
? options.title
|
|
181
|
+
: name;
|
|
187
182
|
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
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,
|