@bigbinary/neetoui-rn 0.0.219 → 0.0.221

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 (35) hide show
  1. package/README.md +2 -2
  2. package/index.d.ts +43 -5
  3. package/lib/components/Accordion.js +1 -1
  4. package/lib/components/Button.js +1 -1
  5. package/lib/components/ButtonGroup.js +1 -1
  6. package/lib/components/Calendar.js +1 -1
  7. package/lib/components/Chip.js +1 -1
  8. package/lib/components/FAB.js +1 -1
  9. package/lib/components/FlashList.js +1 -1
  10. package/lib/components/Input.js +1 -1
  11. package/lib/components/MultiSelect.js +1 -1
  12. package/lib/components/NotificationPreferenceList.js +1 -1
  13. package/lib/components/OrganizationItem.js +1 -1
  14. package/lib/components/RichTextEditor.js +1 -1
  15. package/lib/components/SearchBar.js +1 -1
  16. package/lib/components/SegmentedTopBar.js +1 -1
  17. package/lib/components/SocialButton.js +1 -1
  18. package/lib/components/Touchable.js +1 -1
  19. package/package.json +1 -1
  20. package/src/components/Accordion.js +98 -93
  21. package/src/components/Button.js +17 -15
  22. package/src/components/ButtonGroup.js +6 -4
  23. package/src/components/Calendar.js +1 -2
  24. package/src/components/Chip.js +6 -3
  25. package/src/components/FAB.js +9 -0
  26. package/src/components/FlashList.js +123 -110
  27. package/src/components/Input.js +17 -18
  28. package/src/components/MultiSelect.js +2 -67
  29. package/src/components/NotificationPreferenceList.js +8 -10
  30. package/src/components/OrganizationItem.js +10 -11
  31. package/src/components/RichTextEditor.js +2 -0
  32. package/src/components/SearchBar.js +13 -11
  33. package/src/components/SegmentedTopBar.js +5 -10
  34. package/src/components/SocialButton.js +11 -2
  35. package/src/components/Touchable.js +1 -0
@@ -1,3 +1,4 @@
1
+ /* eslint-disable react/display-name */
1
2
  /* eslint-disable react/prop-types */
2
3
  import React, { useCallback, useContext, useEffect } from "react";
3
4
  import { FlashList as ShopifyFlashList } from "@shopify/flash-list";
@@ -34,127 +35,139 @@ const Placeholder = () => {
34
35
  );
35
36
  };
36
37
 
37
- export const FlashList = ({
38
- animationDuration = 2000,
39
- SkeletonComponent,
40
- placeHolderItemCount = 10,
41
- isLoading = false,
42
- data = [],
43
- onRefresh = () => {},
44
- onEndReached = () => {},
45
- keyExtractor,
46
- ...rest
47
- }) => {
48
- const dummyData = Array.apply(null, Array(placeHolderItemCount));
49
-
50
- const { isRefetchingByUser, refetchByUser } = useRefreshByUser(onRefresh);
51
-
52
- return (
53
- <FadeInFlatList
54
- key={isLoading}
55
- animationDuration={animationDuration}
56
- SkeletonComponent={SkeletonComponent}
57
- isLoading={isLoading}
58
- extraData={{ isLoading, placeHolderItemCount }}
59
- data={isLoading ? dummyData : data}
60
- refreshControl={
61
- onRefresh && (
62
- <RefreshControl
63
- refreshing={isRefetchingByUser}
64
- onRefresh={refetchByUser}
65
- />
66
- )
67
- }
68
- placeHolderItemCount={placeHolderItemCount}
69
- keyExtractor={(item, index) => {
70
- return isLoading || !keyExtractor
71
- ? index.toString()
72
- : keyExtractor(item, index);
73
- }}
74
- {...rest}
75
- onEndReached={isLoading ? undefined : onEndReached}
76
- />
77
- );
78
- };
38
+ export const FlashList = React.forwardRef(
39
+ (
40
+ {
41
+ animationDuration = 2000,
42
+ SkeletonComponent,
43
+ placeHolderItemCount = 10,
44
+ isLoading = false,
45
+ data = [],
46
+ onRefresh = () => {},
47
+ onEndReached = () => {},
48
+ keyExtractor,
49
+ ...rest
50
+ },
51
+ ref
52
+ ) => {
53
+ const dummyData = Array.apply(null, Array(placeHolderItemCount));
79
54
 
80
- const FadeInFlatList = ({
81
- renderItem: originalRenderItem,
82
- animationDuration,
83
- isLoading = false,
84
- SkeletonComponent,
85
- ...props
86
- }) => {
87
- const value = useSharedValue(0);
55
+ const { isRefetchingByUser, refetchByUser } = useRefreshByUser(onRefresh);
88
56
 
89
- const FadeInComponent = useCallback(
90
- ({ index, children }) => {
91
- const inputRange = [index - 1, index, index + 1, index + 2];
92
- const animatedStyles = useAnimatedStyle(() => {
93
- return {
94
- opacity: interpolate(
95
- value.value,
96
- inputRange,
97
- [0, 0.6, 1, 1],
98
- Extrapolation.CLAMP
99
- ),
100
- transform: [
101
- {
102
- translateX: interpolate(
103
- value.value,
104
- inputRange,
105
- [25, 15, 10, 0],
106
- Extrapolation.CLAMP
107
- ),
108
- },
109
- ],
110
- };
111
- });
57
+ return (
58
+ <FadeInFlatList
59
+ ref={ref}
60
+ key={isLoading}
61
+ animationDuration={animationDuration}
62
+ SkeletonComponent={SkeletonComponent}
63
+ isLoading={isLoading}
64
+ extraData={{ isLoading, placeHolderItemCount }}
65
+ data={isLoading ? dummyData : data}
66
+ refreshControl={
67
+ onRefresh && (
68
+ <RefreshControl
69
+ refreshing={isRefetchingByUser}
70
+ onRefresh={refetchByUser}
71
+ />
72
+ )
73
+ }
74
+ placeHolderItemCount={placeHolderItemCount}
75
+ keyExtractor={(item, index) => {
76
+ return isLoading || !keyExtractor
77
+ ? index.toString()
78
+ : keyExtractor(item, index);
79
+ }}
80
+ {...rest}
81
+ onEndReached={isLoading ? undefined : onEndReached}
82
+ />
83
+ );
84
+ }
85
+ );
112
86
 
113
- return <Animated.View style={animatedStyles}>{children}</Animated.View>;
87
+ // eslint-disable-next-line react/display-name
88
+ const FadeInFlatList = React.forwardRef(
89
+ (
90
+ {
91
+ renderItem: originalRenderItem,
92
+ animationDuration,
93
+ isLoading = false,
94
+ SkeletonComponent,
95
+ ...props
114
96
  },
115
- // eslint-disable-next-line react-hooks/exhaustive-deps
116
- []
117
- );
97
+ ref
98
+ ) => {
99
+ const value = useSharedValue(0);
118
100
 
119
- const Item = ({ item }) => {
120
- return item?.extraData?.isLoading ? (
121
- <FadeInComponent index={item.index}>
122
- {SkeletonComponent || <Placeholder />}
123
- </FadeInComponent>
124
- ) : (
125
- <FadeInComponent index={item.index}>
126
- {originalRenderItem(item)}
127
- </FadeInComponent>
128
- );
129
- };
101
+ const FadeInComponent = useCallback(
102
+ ({ index, children }) => {
103
+ const inputRange = [index - 1, index, index + 1, index + 2];
104
+ const animatedStyles = useAnimatedStyle(() => {
105
+ return {
106
+ opacity: interpolate(
107
+ value.value,
108
+ inputRange,
109
+ [0, 0.6, 1, 1],
110
+ Extrapolation.CLAMP
111
+ ),
112
+ transform: [
113
+ {
114
+ translateX: interpolate(
115
+ value.value,
116
+ inputRange,
117
+ [25, 15, 10, 0],
118
+ Extrapolation.CLAMP
119
+ ),
120
+ },
121
+ ],
122
+ };
123
+ });
130
124
 
131
- const renderItem = item => {
132
- return isLoading || item.index < props.placeHolderItemCount ? (
133
- <Item item={item} />
134
- ) : (
135
- originalRenderItem(item)
125
+ return <Animated.View style={animatedStyles}>{children}</Animated.View>;
126
+ },
127
+ // eslint-disable-next-line react-hooks/exhaustive-deps
128
+ []
136
129
  );
137
- };
138
130
 
139
- useEffect(() => {
140
- value.value = 0;
141
- value.value = withSequence(
142
- withTiming(20, {
143
- duration: animationDuration,
144
- }),
145
- withTiming(10000, {
146
- duration: 0,
147
- })
148
- );
131
+ const Item = ({ item }) => {
132
+ return item?.extraData?.isLoading ? (
133
+ <FadeInComponent index={item.index}>
134
+ {SkeletonComponent || <Placeholder />}
135
+ </FadeInComponent>
136
+ ) : (
137
+ <FadeInComponent index={item.index}>
138
+ {originalRenderItem(item)}
139
+ </FadeInComponent>
140
+ );
141
+ };
149
142
 
150
- return () => {
151
- cancelAnimation(value);
143
+ const renderItem = item => {
144
+ return isLoading || item.index < props.placeHolderItemCount ? (
145
+ <Item item={item} />
146
+ ) : (
147
+ originalRenderItem(item)
148
+ );
152
149
  };
153
- // eslint-disable-next-line react-hooks/exhaustive-deps
154
- }, [animationDuration, value, isLoading]);
155
150
 
156
- return <ShopifyFlashList {...props} renderItem={renderItem} />;
157
- };
151
+ useEffect(() => {
152
+ value.value = 0;
153
+ value.value = withSequence(
154
+ withTiming(20, {
155
+ duration: animationDuration,
156
+ }),
157
+ withTiming(10000, {
158
+ duration: 0,
159
+ })
160
+ );
161
+
162
+ return () => {
163
+ cancelAnimation(value);
164
+ };
165
+ // eslint-disable-next-line react-hooks/exhaustive-deps
166
+ }, [animationDuration, value, isLoading]);
167
+
168
+ return <ShopifyFlashList ref={ref} {...props} renderItem={renderItem} />;
169
+ }
170
+ );
158
171
 
159
172
  FlashList.propTypes = {
160
173
  SkeletonComponent: PropTypes.element,
@@ -94,23 +94,22 @@ const AnimatedLabel = Animated.createAnimatedComponent(Typography);
94
94
  *
95
95
  */
96
96
 
97
- export const Input = props => {
98
- const {
99
- label,
100
- value = "",
101
- onChangeText = () => {},
102
- onBlur = () => {},
103
- errorMessage = null,
104
- PrefixIcon,
105
- SuffixIcon,
106
- autoFocus = false,
107
- disabled = false,
108
- noBorder = false,
109
- showInputAccessoryView = true,
110
- textAlignVertical = "top",
111
- ...rest
112
- } = props;
113
-
97
+ export const Input = ({
98
+ label,
99
+ value = "",
100
+ onChangeText = () => {},
101
+ onBlur = () => {},
102
+ errorMessage = null,
103
+ PrefixIcon,
104
+ SuffixIcon,
105
+ autoFocus = false,
106
+ disabled = false,
107
+ noBorder = false,
108
+ showInputAccessoryView = true,
109
+ textAlignVertical = "top",
110
+ containerProps,
111
+ ...rest
112
+ }) => {
114
113
  const { width } = useWindowDimensions();
115
114
  const colors = useContext(ThemeContext).colors;
116
115
  const inputRef = useRef();
@@ -203,7 +202,7 @@ export const Input = props => {
203
202
  justifyContent="space-between"
204
203
  {...(!rest.inputProps?.multiline && { height: 58 })}
205
204
  overflow="hidden"
206
- {...rest.containerProps}
205
+ {...containerProps}
207
206
  >
208
207
  {!!PrefixIcon && (
209
208
  <View pl={2}>
@@ -1,3 +1,4 @@
1
+ /* eslint-disable react-native/no-inline-styles */
1
2
  import React, { useContext, useEffect, useState } from "react";
2
3
  import PropTypes from "prop-types";
3
4
  import {
@@ -24,13 +25,7 @@ import {
24
25
  position,
25
26
  } from "styled-system";
26
27
 
27
- import {
28
- BottomSheet,
29
- CheckBox,
30
- Container,
31
- Touchable,
32
- Alert,
33
- } from "@components";
28
+ import { BottomSheet, CheckBox, Container, Alert } from "@components";
34
29
 
35
30
  const Typography = styled.Text`
36
31
  ${textStyle}
@@ -133,41 +128,6 @@ MultiSelectItem.propTypes = {
133
128
  confirmationAlertObj: PropTypes.object,
134
129
  };
135
130
 
136
- const DropdownItem = ({
137
- label,
138
- onPress,
139
- defaultDropdownItemHeight,
140
- itemContainerStyle,
141
- itemLabelStyle,
142
- }) => {
143
- return (
144
- <Touchable bg="background.white" onPress={onPress}>
145
- <Container
146
- height={defaultDropdownItemHeight}
147
- p={2}
148
- {...itemContainerStyle}
149
- >
150
- <Typography
151
- fontFamily="sf400"
152
- fontSize="s"
153
- color="font.grey"
154
- {...itemLabelStyle}
155
- >
156
- {label}
157
- </Typography>
158
- </Container>
159
- </Touchable>
160
- );
161
- };
162
-
163
- DropdownItem.propTypes = {
164
- label: PropTypes.string,
165
- onPress: PropTypes.func,
166
- defaultDropdownItemHeight: PropTypes.number,
167
- itemContainerStyle: PropTypes.object,
168
- itemLabelStyle: PropTypes.object,
169
- };
170
-
171
131
  const AnimatedLabel = Animated.createAnimatedComponent(Typography);
172
132
 
173
133
  /**
@@ -564,10 +524,6 @@ MultiSelect.propTypes = {
564
524
  * Show loader while creating a searched option not present in the options list
565
525
  */
566
526
  showCreateOptionLoader: PropTypes.bool,
567
- /**
568
- * Custom label for creating searched option not present in the options list
569
- */
570
- createOptionLabel: PropTypes.string,
571
527
  /**
572
528
  * Callback when create searched option is pressed
573
529
  */
@@ -592,10 +548,6 @@ MultiSelect.propTypes = {
592
548
  * To customise dropdown item container styles.
593
549
  */
594
550
  itemContainerStyle: PropTypes.object,
595
- /**
596
- * To customise dropdown item text styles.
597
- */
598
- itemLabelStyle: PropTypes.object,
599
551
  /**
600
552
  * To customise item container styles for multi selected items.
601
553
  */
@@ -608,22 +560,6 @@ MultiSelect.propTypes = {
608
560
  * To customise confirmation alert popup.
609
561
  */
610
562
  confirmationAlertObj: PropTypes.object,
611
- /**
612
- * To customise search input container style.
613
- */
614
- searchInputContainerStyle: PropTypes.object,
615
- /**
616
- * To customise search input style.
617
- */
618
- searchInputStyle: PropTypes.object,
619
- /**
620
- * To customise empty options placeholder container style.
621
- */
622
- emptyOptionsContainerStyle: PropTypes.object,
623
- /**
624
- * To customise empty options placeholder text style.
625
- */
626
- emptyOptionsLabelStyle: PropTypes.object,
627
563
  /**
628
564
  * To customise empty options placeholder container style.
629
565
  */
@@ -694,7 +630,6 @@ MultiSelect.defaultProps = {
694
630
  isSearchable: false,
695
631
  showCreateOption: false,
696
632
  showCreateOptionLoader: false,
697
- createOptionLabel: null,
698
633
  onPressCreateOption: () => {},
699
634
  onDonePress: () => {},
700
635
  maxItemSize: 5,
@@ -74,16 +74,14 @@ import { Container, Typography, Divider, ToggleSwitch } from "@components";
74
74
  *
75
75
  */
76
76
 
77
- export const NotificationPreferenceList = props => {
78
- const {
79
- data,
80
- itemWrapperProps,
81
- itemContainerProps,
82
- labelContainerProps,
83
- labelProps,
84
- ...rest
85
- } = props;
86
-
77
+ export const NotificationPreferenceList = ({
78
+ data,
79
+ itemWrapperProps,
80
+ itemContainerProps,
81
+ labelContainerProps,
82
+ labelProps,
83
+ ...rest
84
+ }) => {
87
85
  return (
88
86
  <Container bg="background.secondary" borderRadius={8} {...rest}>
89
87
  {data?.map((item, index) => {
@@ -27,17 +27,16 @@ import { ThemeContext } from "styled-components/native";
27
27
  *
28
28
  */
29
29
 
30
- export const OrganizationItem = props => {
31
- const {
32
- label,
33
- labelContainerProps,
34
- iconContainerProps,
35
- iconProps,
36
- labelProps,
37
- name,
38
- nameProps,
39
- ...rest
40
- } = props;
30
+ export const OrganizationItem = ({
31
+ label,
32
+ labelContainerProps,
33
+ iconContainerProps,
34
+ iconProps,
35
+ labelProps,
36
+ name,
37
+ nameProps,
38
+ ...rest
39
+ }) => {
41
40
  const theme = useContext(ThemeContext);
42
41
  return (
43
42
  <Container
@@ -158,4 +158,6 @@ RichTextEditor.propTypes = {
158
158
  * Object which can be used to pass other supported props by the RichToolbar.
159
159
  */
160
160
  toolBarProps: PropTypes.object,
161
+ editorWrapperStyle: PropTypes.object,
162
+ toolbarWrapperStyle: PropTypes.object,
161
163
  };
@@ -1,3 +1,4 @@
1
+ /* eslint-disable react-native/no-inline-styles */
1
2
  import React, { useEffect, useRef, useState } from "react";
2
3
  import { Animated, TouchableWithoutFeedback } from "react-native";
3
4
  import {
@@ -47,15 +48,15 @@ const TextInput = styled.TextInput`
47
48
  * ```
48
49
  */
49
50
 
50
- export const SearchBar = props => {
51
- const {
52
- placeholder = "Search",
53
- onChangeText = () => {},
54
- onCancel = () => {},
55
- debounceDelay = 1000,
56
- showCancelButton = true,
57
- ...rest
58
- } = props;
51
+ export const SearchBar = ({
52
+ placeholder = "Search",
53
+ onChangeText = () => {},
54
+ onCancel = () => {},
55
+ debounceDelay = 1000,
56
+ showCancelButton = true,
57
+ containerProps,
58
+ searchbarProps,
59
+ }) => {
59
60
  const inputRef = useRef();
60
61
  const [searchText, setSearchText] = useState("");
61
62
  const debouncedSearchTextValue = useDebounce(
@@ -113,7 +114,7 @@ export const SearchBar = props => {
113
114
  borderRadius={8}
114
115
  flexDirection="row"
115
116
  alignItems="center"
116
- {...rest.containerProps}
117
+ {...containerProps}
117
118
  >
118
119
  <Container px={10}>
119
120
  <Icon
@@ -139,7 +140,7 @@ export const SearchBar = props => {
139
140
  color="font.primary"
140
141
  autoCapitalize="none"
141
142
  returnKeyType="search"
142
- {...rest.searchbarProps}
143
+ {...searchbarProps}
143
144
  />
144
145
  </Container>
145
146
  </TouchableWithoutFeedback>
@@ -190,4 +191,5 @@ SearchBar.propTypes = {
190
191
  * option to hide the cancel button. Default is true
191
192
  */
192
193
  showCancelButton: PropTypes.bool,
194
+ containerProps: PropTypes.object,
193
195
  };
@@ -18,7 +18,6 @@ const defaultShadowStyle = {
18
18
  },
19
19
  shadowOpacity: 0.23,
20
20
  shadowRadius: 2.62,
21
-
22
21
  elevation: 4,
23
22
  };
24
23
 
@@ -87,7 +86,6 @@ export const SegmentedTopBar = ({
87
86
  }) => {
88
87
  const translateValue = (width - 4) / routes?.length;
89
88
  const tabTranslateValue = useSharedValue(0);
90
-
91
89
  useEffect(() => {
92
90
  tabTranslateValue.value = withSpring(
93
91
  index * (translateValue * 1),
@@ -113,7 +111,7 @@ export const SegmentedTopBar = ({
113
111
  defaultShadowStyle,
114
112
  StyleSheet.absoluteFill,
115
113
  {
116
- width: width / routes?.length,
114
+ width: (width - 4) / routes?.length,
117
115
  },
118
116
  tabTranslateAnimatedStyles,
119
117
  ]}
@@ -184,14 +182,9 @@ const styles = StyleSheet.create({
184
182
 
185
183
  SegmentedTopBar.propTypes = {
186
184
  /**
187
- * Array of texts for the labels of each Segment/Tab.
185
+ * Navigation routes and additional data.
188
186
  */
189
- tabs: PropTypes.arrayOf(
190
- PropTypes.shape({
191
- name: PropTypes.string,
192
- Component: PropTypes.oneOfType([PropTypes.element, PropTypes.func]),
193
- })
194
- ).isRequired,
187
+ state: PropTypes.object,
195
188
  /**
196
189
  * To change the inactive segment container style.
197
190
  */
@@ -209,6 +202,8 @@ SegmentedTopBar.propTypes = {
209
202
  */
210
203
  activeTextStyle: PropTypes.object,
211
204
  height: PropTypes.number,
205
+ navigation: PropTypes.object,
206
+ descriptors: PropTypes.object,
212
207
  };
213
208
 
214
209
  SegmentedTopBar.defaultProps = {
@@ -33,8 +33,13 @@ import { Container, Typography, Touchable } from "@components";
33
33
  *
34
34
  */
35
35
 
36
- export const SocialButton = props => {
37
- const { variant, disabled, labelStyle, isLoading, ...rest } = props;
36
+ export const SocialButton = ({
37
+ variant,
38
+ disabled,
39
+ labelStyle,
40
+ isLoading,
41
+ ...rest
42
+ }) => {
38
43
  const theme = useContext(ThemeContext);
39
44
  const capitalize = str => `${str.charAt(0).toUpperCase()}${str.slice(1)}`;
40
45
 
@@ -93,4 +98,8 @@ SocialButton.propTypes = {
93
98
  * Customize label style of the button
94
99
  */
95
100
  labelStyle: PropTypes.object,
101
+ /**
102
+ * Button loading status
103
+ */
104
+ isLoading: PropTypes.bool,
96
105
  };
@@ -84,4 +84,5 @@ Touchable.propTypes = {
84
84
  ...propTypes.buttonStyle,
85
85
 
86
86
  children: PropTypes.node,
87
+ elevation: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
87
88
  };