@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,11 +1,12 @@
|
|
|
1
|
-
/* eslint-disable @bigbinary/neeto/no-dangling-constants */
|
|
2
1
|
import React, { useContext } from "react";
|
|
2
|
+
|
|
3
3
|
import propTypes from "@styled-system/prop-types";
|
|
4
4
|
import PropTypes from "prop-types";
|
|
5
5
|
import { ThemeContext } from "styled-components/native";
|
|
6
6
|
|
|
7
7
|
import { Typography, Touchable, Container, Loader } from "@components";
|
|
8
8
|
|
|
9
|
+
// eslint-disable-next-line @bigbinary/neeto/no-dangling-constants
|
|
9
10
|
export const BUTTON_VARIANTS = Object.freeze({
|
|
10
11
|
SOLID: "solid",
|
|
11
12
|
SECONDARY: "secondary",
|
|
@@ -144,25 +145,27 @@ export const Button = ({
|
|
|
144
145
|
variant
|
|
145
146
|
) &&
|
|
146
147
|
disabled
|
|
147
|
-
)
|
|
148
|
+
) {
|
|
148
149
|
return 0.5;
|
|
150
|
+
}
|
|
151
|
+
|
|
149
152
|
return 1;
|
|
150
153
|
};
|
|
151
154
|
|
|
152
155
|
return (
|
|
153
156
|
<Touchable
|
|
154
|
-
|
|
155
|
-
disabled={disabled || isLoading}
|
|
157
|
+
alignItems="center"
|
|
156
158
|
bg={getButtonColors().bg}
|
|
157
|
-
|
|
158
|
-
width={width}
|
|
159
|
+
borderColor={getButtonColors().border}
|
|
159
160
|
borderRadius={8}
|
|
161
|
+
borderWidth={1}
|
|
162
|
+
disabled={disabled || isLoading}
|
|
160
163
|
flexDirection="row"
|
|
161
|
-
|
|
164
|
+
height={48}
|
|
162
165
|
justifyContent="center"
|
|
163
|
-
borderColor={getButtonColors().border}
|
|
164
|
-
borderWidth={1}
|
|
165
166
|
opacity={renderOpacity()}
|
|
167
|
+
rippleColor={getButtonColors().ripple}
|
|
168
|
+
width={width}
|
|
166
169
|
{...rest}
|
|
167
170
|
>
|
|
168
171
|
{isLoading ? (
|
|
@@ -170,11 +173,11 @@ export const Button = ({
|
|
|
170
173
|
<Loader color={getButtonColors().color} />
|
|
171
174
|
{!!loadingText && (
|
|
172
175
|
<Typography
|
|
173
|
-
textAlign="center"
|
|
174
|
-
mx={2}
|
|
175
176
|
color={color || getButtonColors().color}
|
|
176
|
-
fontSize={fontSize}
|
|
177
177
|
fontFamily={fontFamily || theme.fonts.sf500}
|
|
178
|
+
fontSize={fontSize}
|
|
179
|
+
mx={2}
|
|
180
|
+
textAlign="center"
|
|
178
181
|
{...labelStyle}
|
|
179
182
|
>
|
|
180
183
|
{loadingText}
|
|
@@ -185,11 +188,11 @@ export const Button = ({
|
|
|
185
188
|
<>
|
|
186
189
|
{LeftIcon && <LeftIcon />}
|
|
187
190
|
<Typography
|
|
188
|
-
textAlign="center"
|
|
189
|
-
mx={2}
|
|
190
191
|
color={color || getButtonColors().color}
|
|
191
|
-
fontSize={fontSize}
|
|
192
192
|
fontFamily={fontFamily || theme.fonts.sf500}
|
|
193
|
+
fontSize={fontSize}
|
|
194
|
+
mx={2}
|
|
195
|
+
textAlign="center"
|
|
193
196
|
{...labelStyle}
|
|
194
197
|
>
|
|
195
198
|
{label}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
+
|
|
2
3
|
import PropTypes from "prop-types";
|
|
3
4
|
|
|
4
5
|
import { Container, Typography, Touchable } from "@components";
|
|
@@ -39,44 +40,40 @@ export const ButtonGroup = ({
|
|
|
39
40
|
wrapperStyle,
|
|
40
41
|
buttonStyle,
|
|
41
42
|
buttonTextStyle,
|
|
42
|
-
}) =>
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
onPress
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
})}
|
|
77
|
-
</Container>
|
|
78
|
-
);
|
|
79
|
-
};
|
|
43
|
+
}) => (
|
|
44
|
+
<Container
|
|
45
|
+
alignSelf="center"
|
|
46
|
+
border="1px solid"
|
|
47
|
+
borderColor={activeColor}
|
|
48
|
+
borderRadius={2}
|
|
49
|
+
flexDirection="row"
|
|
50
|
+
justifyContent="space-between"
|
|
51
|
+
my={3}
|
|
52
|
+
{...wrapperStyle}
|
|
53
|
+
>
|
|
54
|
+
{buttonItems.map(item => (
|
|
55
|
+
<Touchable
|
|
56
|
+
bg={item === currentActiveBtn ? activeColor : inActiveColor}
|
|
57
|
+
key={item}
|
|
58
|
+
p={2}
|
|
59
|
+
px={3}
|
|
60
|
+
onPress={() => {
|
|
61
|
+
if (item !== currentActiveBtn) {
|
|
62
|
+
onPress(item);
|
|
63
|
+
}
|
|
64
|
+
}}
|
|
65
|
+
{...buttonStyle}
|
|
66
|
+
>
|
|
67
|
+
<Typography
|
|
68
|
+
color={item === currentActiveBtn ? inActiveColor : activeColor}
|
|
69
|
+
{...buttonTextStyle}
|
|
70
|
+
>
|
|
71
|
+
{item}
|
|
72
|
+
</Typography>
|
|
73
|
+
</Touchable>
|
|
74
|
+
))}
|
|
75
|
+
</Container>
|
|
76
|
+
);
|
|
80
77
|
|
|
81
78
|
ButtonGroup.defaultProps = {
|
|
82
79
|
activeColor: "background.grey600",
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import React, { useContext } from "react";
|
|
2
|
+
|
|
2
3
|
import dayjs from "dayjs";
|
|
3
4
|
import PropTypes from "prop-types";
|
|
4
|
-
import { ThemeContext } from "styled-components/native";
|
|
5
5
|
import { Calendar as RNCalender } from "react-native-calendars";
|
|
6
|
+
import { ThemeContext } from "styled-components/native";
|
|
6
7
|
|
|
7
8
|
/**
|
|
8
9
|
*
|
|
@@ -39,9 +40,9 @@ export const Calendar = ({ selectedDate, ...rest }) => {
|
|
|
39
40
|
|
|
40
41
|
return (
|
|
41
42
|
<RNCalender
|
|
42
|
-
key={selectedDate}
|
|
43
43
|
current={selectedDate}
|
|
44
44
|
firstDay={1}
|
|
45
|
+
key={selectedDate}
|
|
45
46
|
markedDates={{
|
|
46
47
|
[dayjs(selectedDate).format("YYYY-MM-DD")]: {
|
|
47
48
|
selected: true,
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import PropTypes from "prop-types";
|
|
3
2
|
import { StyleSheet, TouchableOpacity } from "react-native";
|
|
3
|
+
|
|
4
|
+
import PropTypes from "prop-types";
|
|
4
5
|
import styled from "styled-components/native";
|
|
5
6
|
import { flexbox, space, border, color, layout } from "styled-system";
|
|
6
7
|
|
|
7
8
|
import { theme } from "@theme";
|
|
9
|
+
|
|
8
10
|
import { getShadowStyles } from "../utils/utils";
|
|
9
11
|
|
|
10
12
|
const StyledTouchableOpacity = styled(TouchableOpacity)`
|
|
@@ -52,10 +54,11 @@ export const Card = ({ children, elevation, ...rest }) => {
|
|
|
52
54
|
const shadowStyles = elevation ? getShadowStyles(elevation) : {};
|
|
53
55
|
|
|
54
56
|
const cardStyles = { ...styles.defaultShadows, ...shadowStyles };
|
|
57
|
+
|
|
55
58
|
return (
|
|
56
59
|
<StyledTouchableOpacity
|
|
57
|
-
style={cardStyles}
|
|
58
60
|
activeOpacity={rest.onPress ? 0.2 : 1}
|
|
61
|
+
style={cardStyles}
|
|
59
62
|
{...rest}
|
|
60
63
|
>
|
|
61
64
|
{children}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React, { useState } from "react";
|
|
2
2
|
import { StyleSheet, Dimensions, useWindowDimensions } from "react-native";
|
|
3
|
+
|
|
3
4
|
import PropTypes from "prop-types";
|
|
4
5
|
import CarouselParent, { Pagination } from "react-native-snap-carousel";
|
|
5
6
|
|
|
@@ -51,25 +52,24 @@ export const Carousel = ({
|
|
|
51
52
|
return (
|
|
52
53
|
<Container flex={1} {...containerStyle}>
|
|
53
54
|
<CarouselParent
|
|
54
|
-
ref={carouselRef}
|
|
55
55
|
data={itemArray}
|
|
56
|
+
itemWidth={width}
|
|
57
|
+
ref={carouselRef}
|
|
56
58
|
renderItem={renderItem}
|
|
57
59
|
sliderWidth={width}
|
|
58
|
-
itemWidth={width}
|
|
59
60
|
onSnapToItem={index => {
|
|
60
61
|
onSnapToItem(index);
|
|
61
62
|
setActiveIndex(index);
|
|
62
63
|
}}
|
|
63
64
|
/>
|
|
64
|
-
|
|
65
65
|
<Pagination
|
|
66
|
-
dotsLength={itemArray.length}
|
|
67
66
|
activeDotIndex={activeIndex}
|
|
67
|
+
dotContainerStyle={styles.dotContainerStyle}
|
|
68
68
|
dotStyle={styles.dotStyle}
|
|
69
|
-
|
|
69
|
+
dotsLength={itemArray.length}
|
|
70
70
|
inactiveDotOpacity={1}
|
|
71
71
|
inactiveDotScale={1}
|
|
72
|
-
|
|
72
|
+
inactiveDotStyle={styles.inactiveDotStyle}
|
|
73
73
|
/>
|
|
74
74
|
</Container>
|
|
75
75
|
);
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React, { useContext } from "react";
|
|
2
|
+
|
|
2
3
|
import Proptypes from "prop-types";
|
|
3
4
|
import Icon from "react-native-remix-icon";
|
|
4
5
|
import { ThemeContext } from "styled-components/native";
|
|
@@ -68,6 +69,7 @@ export const CheckBox = ({
|
|
|
68
69
|
color: theme.colors.font.grey400,
|
|
69
70
|
},
|
|
70
71
|
};
|
|
72
|
+
|
|
71
73
|
const checkedProps = {
|
|
72
74
|
bg: theme.colors.background.base,
|
|
73
75
|
labelProps: {
|
|
@@ -75,6 +77,7 @@ export const CheckBox = ({
|
|
|
75
77
|
color: theme.colors.font.primary,
|
|
76
78
|
},
|
|
77
79
|
};
|
|
80
|
+
|
|
78
81
|
const unCheckedProps = {
|
|
79
82
|
bg: theme.colors.background.white,
|
|
80
83
|
borderWidth: 1,
|
|
@@ -84,21 +87,22 @@ export const CheckBox = ({
|
|
|
84
87
|
color: theme.colors.font.secondary,
|
|
85
88
|
},
|
|
86
89
|
};
|
|
90
|
+
|
|
87
91
|
return (
|
|
88
92
|
<Touchable
|
|
93
|
+
alignItems="center"
|
|
89
94
|
disabled={disabled}
|
|
90
|
-
onPress={onSelect}
|
|
91
95
|
flexDirection="row"
|
|
92
|
-
alignItems="center"
|
|
93
96
|
flexShrink={1}
|
|
97
|
+
onPress={onSelect}
|
|
94
98
|
{...rest}
|
|
95
99
|
>
|
|
96
100
|
<Container
|
|
97
|
-
|
|
98
|
-
width={16}
|
|
101
|
+
alignItems="center"
|
|
99
102
|
borderRadius={3}
|
|
103
|
+
height={16}
|
|
100
104
|
justifyContent="center"
|
|
101
|
-
|
|
105
|
+
width={16}
|
|
102
106
|
{...(!checked && unCheckedProps)}
|
|
103
107
|
{...(checked && checkedProps)}
|
|
104
108
|
{...(disabled && disabledProps)}
|
|
@@ -106,17 +110,17 @@ export const CheckBox = ({
|
|
|
106
110
|
>
|
|
107
111
|
{checked && (
|
|
108
112
|
<Icon
|
|
113
|
+
color={theme.colors.font.white}
|
|
109
114
|
name="ri-check-line"
|
|
110
115
|
size={14}
|
|
111
|
-
color={theme.colors.font.white}
|
|
112
116
|
{...checkIconStyle}
|
|
113
117
|
/>
|
|
114
118
|
)}
|
|
115
119
|
</Container>
|
|
116
120
|
<Typography
|
|
117
|
-
ml={2}
|
|
118
|
-
fontSize="m"
|
|
119
121
|
flex={1}
|
|
122
|
+
fontSize="m"
|
|
123
|
+
ml={2}
|
|
120
124
|
{...(checked && checkedProps.labelProps)}
|
|
121
125
|
{...(!checked && unCheckedProps.labelProps)}
|
|
122
126
|
{...(disabled && disabledProps.labelProps)}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
+
|
|
2
3
|
import PropTypes from "prop-types";
|
|
3
4
|
import Icon from "react-native-remix-icon";
|
|
4
5
|
|
|
@@ -63,37 +64,35 @@ export const Chip = ({
|
|
|
63
64
|
closeIcon,
|
|
64
65
|
containerStyle,
|
|
65
66
|
closeIconContainerStyle,
|
|
66
|
-
}) =>
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
);
|
|
96
|
-
};
|
|
67
|
+
}) => (
|
|
68
|
+
<Touchable
|
|
69
|
+
alignItems="center"
|
|
70
|
+
borderRadius={20}
|
|
71
|
+
disabled={!onChipPress || isDisabled}
|
|
72
|
+
flexDirection="row"
|
|
73
|
+
p={2}
|
|
74
|
+
onPress={onChipPress}
|
|
75
|
+
{...(variant && variantStyleObj[variant])}
|
|
76
|
+
{...(isDisabled && { opacity: 0.5 })}
|
|
77
|
+
{...containerStyle}
|
|
78
|
+
>
|
|
79
|
+
{LeftIcon && <LeftIcon />}
|
|
80
|
+
<Typography color={labelColor} fontFamily="sf400" mx={2}>
|
|
81
|
+
{label}
|
|
82
|
+
</Typography>
|
|
83
|
+
{onClose && (
|
|
84
|
+
<Touchable
|
|
85
|
+
bg={closeIconBackground}
|
|
86
|
+
borderRadius={10}
|
|
87
|
+
disabled={isDisabled}
|
|
88
|
+
onPress={onClose}
|
|
89
|
+
{...closeIconContainerStyle}
|
|
90
|
+
>
|
|
91
|
+
<Icon color={closeIconColor} name={closeIcon} size={closeIconSize} />
|
|
92
|
+
</Touchable>
|
|
93
|
+
)}
|
|
94
|
+
</Touchable>
|
|
95
|
+
);
|
|
97
96
|
|
|
98
97
|
Chip.defaultProps = {
|
|
99
98
|
variant: "outlined",
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
|
|
3
|
-
import styled from "styled-components/native";
|
|
2
|
+
|
|
4
3
|
import propTypes from "@styled-system/prop-types";
|
|
5
4
|
import PropTypes from "prop-types";
|
|
5
|
+
import styled from "styled-components/native";
|
|
6
|
+
import { flexbox, space, border, color, layout } from "styled-system";
|
|
6
7
|
|
|
7
8
|
const View = styled.View`
|
|
8
9
|
${flexbox}
|
|
@@ -12,9 +13,9 @@ const View = styled.View`
|
|
|
12
13
|
${layout}
|
|
13
14
|
`;
|
|
14
15
|
|
|
15
|
-
export const Container = ({ children, ...rest }) =>
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
export const Container = ({ children, ...rest }) => (
|
|
17
|
+
<View {...rest}>{children}</View>
|
|
18
|
+
);
|
|
18
19
|
|
|
19
20
|
Container.defaultProps = {
|
|
20
21
|
color: "background.primary",
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
|
|
3
|
-
import styled from "styled-components/native";
|
|
2
|
+
|
|
4
3
|
import propTypes from "@styled-system/prop-types";
|
|
5
4
|
import PropTypes from "prop-types";
|
|
5
|
+
import styled from "styled-components/native";
|
|
6
|
+
import { flexbox, space, color, layout } from "styled-system";
|
|
6
7
|
|
|
7
8
|
/**
|
|
8
9
|
*
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/* eslint-disable @bigbinary/neeto/no-dangling-constants */
|
|
2
1
|
import * as React from "react";
|
|
2
|
+
|
|
3
3
|
import propTypes from "@styled-system/prop-types";
|
|
4
4
|
import PropTypes from "prop-types";
|
|
5
5
|
|
|
@@ -44,6 +44,7 @@ import { theme } from "@theme";
|
|
|
44
44
|
* @extends StyledSystems props /styled-system
|
|
45
45
|
*/
|
|
46
46
|
|
|
47
|
+
// eslint-disable-next-line @bigbinary/neeto/no-dangling-constants
|
|
47
48
|
export const FAB = ({ Icon, bg, disabled, variant, onPress, ...rest }) => {
|
|
48
49
|
const shadowStyle = {
|
|
49
50
|
shadowColor: theme.colors.background.grey800,
|
|
@@ -65,9 +66,9 @@ export const FAB = ({ Icon, bg, disabled, variant, onPress, ...rest }) => {
|
|
|
65
66
|
<Touchable
|
|
66
67
|
{...(variant !== "inverse" ? { bg } : {})}
|
|
67
68
|
disabled={disabled}
|
|
69
|
+
style={[style, shadowStyle]}
|
|
68
70
|
variant={variant}
|
|
69
71
|
onPress={onPress}
|
|
70
|
-
style={[style, shadowStyle]}
|
|
71
72
|
{...(variant !== "inverse" ? { borderColor: bg } : {})}
|
|
72
73
|
{...rest}
|
|
73
74
|
>
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
/* eslint-disable react/display-name */
|
|
2
|
-
/* eslint-disable react/prop-types */
|
|
3
1
|
import React, { useCallback, useContext, useEffect } from "react";
|
|
2
|
+
import { Dimensions, RefreshControl } from "react-native";
|
|
3
|
+
|
|
4
4
|
import { FlashList as ShopifyFlashList } from "@shopify/flash-list";
|
|
5
|
+
import PropTypes from "prop-types";
|
|
6
|
+
import ContentLoader, { Rect } from "react-content-loader/native";
|
|
5
7
|
import Animated, {
|
|
6
8
|
cancelAnimation,
|
|
7
9
|
Extrapolation,
|
|
@@ -11,26 +13,24 @@ import Animated, {
|
|
|
11
13
|
withSequence,
|
|
12
14
|
withTiming,
|
|
13
15
|
} from "react-native-reanimated";
|
|
14
|
-
import PropTypes from "prop-types";
|
|
15
|
-
import ContentLoader, { Rect } from "react-content-loader/native";
|
|
16
16
|
import { ThemeContext } from "styled-components/native";
|
|
17
|
-
import { Dimensions, RefreshControl } from "react-native";
|
|
18
17
|
|
|
19
18
|
import { useRefreshByUser } from "@hooks";
|
|
20
19
|
|
|
21
20
|
const { width } = Dimensions.get("screen");
|
|
22
21
|
const Placeholder = () => {
|
|
23
22
|
const theme = useContext(ThemeContext);
|
|
23
|
+
|
|
24
24
|
return (
|
|
25
25
|
<ContentLoader
|
|
26
|
-
marginHorizontal={15}
|
|
27
|
-
height="60"
|
|
28
|
-
width={400}
|
|
29
|
-
viewBox="0 0 400 50"
|
|
30
26
|
backgroundColor={theme.colors.lightgrey}
|
|
31
27
|
foregroundColor={theme.colors.grey300}
|
|
28
|
+
height="60"
|
|
29
|
+
marginHorizontal={15}
|
|
30
|
+
viewBox="0 0 400 50"
|
|
31
|
+
width={400}
|
|
32
32
|
>
|
|
33
|
-
<Rect
|
|
33
|
+
<Rect height="50" rx="5" ry="5" width={width - 30} x="0" />
|
|
34
34
|
</ContentLoader>
|
|
35
35
|
);
|
|
36
36
|
};
|
|
@@ -56,13 +56,19 @@ export const FlashList = React.forwardRef(
|
|
|
56
56
|
|
|
57
57
|
return (
|
|
58
58
|
<FadeInFlatList
|
|
59
|
-
ref={ref}
|
|
60
|
-
key={isLoading}
|
|
61
|
-
animationDuration={animationDuration}
|
|
62
59
|
SkeletonComponent={SkeletonComponent}
|
|
63
|
-
|
|
64
|
-
extraData={{ isLoading, placeHolderItemCount }}
|
|
60
|
+
animationDuration={animationDuration}
|
|
65
61
|
data={isLoading ? dummyData : data}
|
|
62
|
+
extraData={{ isLoading, placeHolderItemCount }}
|
|
63
|
+
isLoading={isLoading}
|
|
64
|
+
key={isLoading}
|
|
65
|
+
placeHolderItemCount={placeHolderItemCount}
|
|
66
|
+
ref={ref}
|
|
67
|
+
keyExtractor={(item, index) =>
|
|
68
|
+
isLoading || !keyExtractor
|
|
69
|
+
? index.toString()
|
|
70
|
+
: keyExtractor(item, index)
|
|
71
|
+
}
|
|
66
72
|
refreshControl={
|
|
67
73
|
onRefresh && (
|
|
68
74
|
<RefreshControl
|
|
@@ -71,12 +77,6 @@ export const FlashList = React.forwardRef(
|
|
|
71
77
|
/>
|
|
72
78
|
)
|
|
73
79
|
}
|
|
74
|
-
placeHolderItemCount={placeHolderItemCount}
|
|
75
|
-
keyExtractor={(item, index) => {
|
|
76
|
-
return isLoading || !keyExtractor
|
|
77
|
-
? index.toString()
|
|
78
|
-
: keyExtractor(item, index);
|
|
79
|
-
}}
|
|
80
80
|
{...rest}
|
|
81
81
|
onEndReached={isLoading ? undefined : onEndReached}
|
|
82
82
|
/>
|
|
@@ -84,7 +84,8 @@ export const FlashList = React.forwardRef(
|
|
|
84
84
|
}
|
|
85
85
|
);
|
|
86
86
|
|
|
87
|
-
|
|
87
|
+
FlashList.displayName = "FlashList";
|
|
88
|
+
|
|
88
89
|
const FadeInFlatList = React.forwardRef(
|
|
89
90
|
(
|
|
90
91
|
{
|
|
@@ -98,38 +99,33 @@ const FadeInFlatList = React.forwardRef(
|
|
|
98
99
|
) => {
|
|
99
100
|
const value = useSharedValue(0);
|
|
100
101
|
|
|
101
|
-
const FadeInComponent = useCallback(
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
102
|
+
const FadeInComponent = useCallback(({ index, children }) => {
|
|
103
|
+
const inputRange = [index - 1, index, index + 1, index + 2];
|
|
104
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
105
|
+
const animatedStyles = useAnimatedStyle(() => ({
|
|
106
|
+
opacity: interpolate(
|
|
107
|
+
value.value,
|
|
108
|
+
inputRange,
|
|
109
|
+
[0, 0.6, 1, 1],
|
|
110
|
+
Extrapolation.CLAMP
|
|
111
|
+
),
|
|
112
|
+
transform: [
|
|
113
|
+
{
|
|
114
|
+
translateX: interpolate(
|
|
107
115
|
value.value,
|
|
108
116
|
inputRange,
|
|
109
|
-
[
|
|
117
|
+
[25, 15, 10, 0],
|
|
110
118
|
Extrapolation.CLAMP
|
|
111
119
|
),
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
Extrapolation.CLAMP
|
|
119
|
-
),
|
|
120
|
-
},
|
|
121
|
-
],
|
|
122
|
-
};
|
|
123
|
-
});
|
|
124
|
-
|
|
125
|
-
return <Animated.View style={animatedStyles}>{children}</Animated.View>;
|
|
126
|
-
},
|
|
127
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
128
|
-
[]
|
|
129
|
-
);
|
|
120
|
+
},
|
|
121
|
+
],
|
|
122
|
+
}));
|
|
123
|
+
|
|
124
|
+
return <Animated.View style={animatedStyles}>{children}</Animated.View>;
|
|
125
|
+
}, []);
|
|
130
126
|
|
|
131
|
-
const Item = ({ item }) =>
|
|
132
|
-
|
|
127
|
+
const Item = ({ item }) =>
|
|
128
|
+
item?.extraData?.isLoading ? (
|
|
133
129
|
<FadeInComponent index={item.index}>
|
|
134
130
|
{SkeletonComponent || <Placeholder />}
|
|
135
131
|
</FadeInComponent>
|
|
@@ -138,15 +134,17 @@ const FadeInFlatList = React.forwardRef(
|
|
|
138
134
|
{originalRenderItem(item)}
|
|
139
135
|
</FadeInComponent>
|
|
140
136
|
);
|
|
137
|
+
|
|
138
|
+
Item.propTypes = {
|
|
139
|
+
item: PropTypes.object,
|
|
141
140
|
};
|
|
142
141
|
|
|
143
|
-
const renderItem = item =>
|
|
144
|
-
|
|
142
|
+
const renderItem = item =>
|
|
143
|
+
isLoading || item.index < props.placeHolderItemCount ? (
|
|
145
144
|
<Item item={item} />
|
|
146
145
|
) : (
|
|
147
146
|
originalRenderItem(item)
|
|
148
147
|
);
|
|
149
|
-
};
|
|
150
148
|
|
|
151
149
|
useEffect(() => {
|
|
152
150
|
value.value = 0;
|
|
@@ -162,13 +160,14 @@ const FadeInFlatList = React.forwardRef(
|
|
|
162
160
|
return () => {
|
|
163
161
|
cancelAnimation(value);
|
|
164
162
|
};
|
|
165
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
166
163
|
}, [animationDuration, value, isLoading]);
|
|
167
164
|
|
|
168
165
|
return <ShopifyFlashList ref={ref} {...props} renderItem={renderItem} />;
|
|
169
166
|
}
|
|
170
167
|
);
|
|
171
168
|
|
|
169
|
+
FadeInFlatList.displayName = "FadeInFlatList";
|
|
170
|
+
|
|
172
171
|
FlashList.propTypes = {
|
|
173
172
|
SkeletonComponent: PropTypes.element,
|
|
174
173
|
animationDuration: PropTypes.number,
|
|
@@ -179,3 +178,5 @@ FlashList.propTypes = {
|
|
|
179
178
|
onEndReached: PropTypes.func,
|
|
180
179
|
keyExtractor: PropTypes.func,
|
|
181
180
|
};
|
|
181
|
+
|
|
182
|
+
FadeInFlatList.propTypes = FlashList.propTypes;
|