@bigbinary/neetoui-rn 0.0.269 → 0.0.271
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/ActionIcon.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/ChatInput/AttachmentsView.js +1 -1
- package/lib/components/ChatInput/Badge.js +1 -1
- package/lib/components/ChatInput/ChatInput.js +1 -1
- package/lib/components/ChatInput/EmailFields.js +1 -1
- package/lib/components/ChatInput/IconButton.js +1 -1
- package/lib/components/ChatInput/MentionsInputWrapper.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/InputEmailChip.js +1 -1
- package/lib/components/LineLoader.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/NotificationIcon.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/Ripple.js +1 -1
- package/lib/components/ScrollView.js +1 -1
- package/lib/components/SearchBar.js +1 -1
- package/lib/components/SegmentedTopBar/Indicator.js +1 -1
- package/lib/components/SegmentedTopBar/Tab.js +1 -1
- package/lib/components/SegmentedTopBar/index.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/TouchableWithoutFeedback.js +1 -1
- package/lib/components/Typography.js +1 -1
- package/lib/components/index.js +1 -1
- package/lib/config/toasterConfig.js +1 -1
- package/lib/contexts/index.js +1 -1
- package/lib/theme/index.js +1 -1
- package/lib/utils/utils.js +1 -1
- package/package.json +22 -15
- package/src/components/Accordion.jsx +0 -266
- package/src/components/ActionIcon.jsx +0 -76
- package/src/components/Alert.jsx +0 -262
- package/src/components/AnimatedImage.jsx +0 -140
- package/src/components/Avatar.jsx +0 -144
- package/src/components/Badge.jsx +0 -97
- package/src/components/BottomSheet.jsx +0 -487
- package/src/components/BottomTabBar.jsx +0 -232
- package/src/components/Button.jsx +0 -275
- package/src/components/ButtonGroup.jsx +0 -120
- package/src/components/Calendar.jsx +0 -128
- package/src/components/Card.jsx +0 -90
- package/src/components/Carousel.jsx +0 -116
- package/src/components/ChatInput/AttachmentsView.jsx +0 -51
- package/src/components/ChatInput/Badge.jsx +0 -24
- package/src/components/ChatInput/ChatInput.jsx +0 -564
- package/src/components/ChatInput/EmailFields.jsx +0 -122
- package/src/components/ChatInput/IconButton.jsx +0 -34
- package/src/components/ChatInput/MentionsInputWrapper.jsx +0 -155
- package/src/components/CheckBox.jsx +0 -150
- package/src/components/Chip.jsx +0 -180
- package/src/components/Container.jsx +0 -31
- package/src/components/Divider.jsx +0 -79
- package/src/components/FAB.jsx +0 -113
- package/src/components/FlashList.jsx +0 -189
- package/src/components/FlatList.js +0 -10
- package/src/components/Input.jsx +0 -357
- package/src/components/InputEmailChip.jsx +0 -246
- package/src/components/LineLoader.jsx +0 -46
- package/src/components/ListItem.jsx +0 -68
- package/src/components/Loader.jsx +0 -122
- package/src/components/MultiSelect.jsx +0 -631
- package/src/components/NotificationIcon.jsx +0 -38
- package/src/components/NotificationPreferenceList.jsx +0 -208
- package/src/components/OnBoarding.jsx +0 -134
- package/src/components/OrganizationItem.jsx +0 -110
- package/src/components/OtpInputs.jsx +0 -194
- package/src/components/ParentView.jsx +0 -139
- package/src/components/Popover.jsx +0 -221
- package/src/components/RadioButton.jsx +0 -155
- package/src/components/RichTextEditor.jsx +0 -163
- package/src/components/Ripple.jsx +0 -281
- package/src/components/ScrollView.js +0 -14
- package/src/components/SearchBar.jsx +0 -207
- package/src/components/SegmentedTopBar/Indicator.jsx +0 -77
- package/src/components/SegmentedTopBar/Tab.jsx +0 -37
- package/src/components/SegmentedTopBar/index.jsx +0 -128
- package/src/components/SocialButton.jsx +0 -106
- package/src/components/Toast.jsx +0 -195
- package/src/components/ToggleSwitch.jsx +0 -112
- package/src/components/TopBar.jsx +0 -147
- package/src/components/Touchable.jsx +0 -133
- package/src/components/TouchableWithoutFeedback.jsx +0 -51
- package/src/components/Typography.jsx +0 -93
- package/src/components/index.js +0 -45
- package/src/config/index.js +0 -1
- package/src/config/toasterConfig.jsx +0 -142
- package/src/contexts/index.js +0 -3
- package/src/hooks/index.js +0 -3
- package/src/hooks/useDebounce.js +0 -17
- package/src/hooks/useKeyboard.js +0 -33
- package/src/hooks/useRefreshByUser.js +0 -20
- package/src/index.js +0 -2
- package/src/theme/index.js +0 -181
- package/src/utils/utils.js +0 -56
package/src/components/Alert.jsx
DELETED
|
@@ -1,262 +0,0 @@
|
|
|
1
|
-
import React, { useState } from "react";
|
|
2
|
-
import { StyleSheet } from "react-native";
|
|
3
|
-
|
|
4
|
-
import Modal from "react-native-modal";
|
|
5
|
-
import { moderateScale } from "react-native-size-matters";
|
|
6
|
-
|
|
7
|
-
import { Typography, Container, Button } from "@components";
|
|
8
|
-
|
|
9
|
-
const useAlertHook = () => {
|
|
10
|
-
const [isVisible, setIsVisible] = React.useState(false);
|
|
11
|
-
const [params, setParams] = useState({});
|
|
12
|
-
|
|
13
|
-
const {
|
|
14
|
-
title = "",
|
|
15
|
-
description = "",
|
|
16
|
-
isCancelable = true,
|
|
17
|
-
onDismiss,
|
|
18
|
-
buttons = [],
|
|
19
|
-
} = params;
|
|
20
|
-
|
|
21
|
-
const show = React.useCallback(params => {
|
|
22
|
-
setParams(params);
|
|
23
|
-
setIsVisible(true);
|
|
24
|
-
}, []);
|
|
25
|
-
|
|
26
|
-
const hide = React.useCallback(() => {
|
|
27
|
-
setIsVisible(false);
|
|
28
|
-
}, []);
|
|
29
|
-
|
|
30
|
-
const hideOnBackPressDrop = React.useCallback(() => {
|
|
31
|
-
if (isCancelable) {
|
|
32
|
-
hide();
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
if (onDismiss && isCancelable) {
|
|
36
|
-
onDismiss();
|
|
37
|
-
}
|
|
38
|
-
}, [hide, isCancelable, onDismiss]);
|
|
39
|
-
|
|
40
|
-
return {
|
|
41
|
-
isVisible,
|
|
42
|
-
show,
|
|
43
|
-
hide,
|
|
44
|
-
hideOnBackPressDrop,
|
|
45
|
-
title,
|
|
46
|
-
description,
|
|
47
|
-
isCancelable,
|
|
48
|
-
buttons,
|
|
49
|
-
};
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
let rootLevelRef = null;
|
|
53
|
-
|
|
54
|
-
/**
|
|
55
|
-
* Launches an alert dialog with the specified title and message.
|
|
56
|
-
* Optionally provide a list of buttons.
|
|
57
|
-
* Tapping any button will fire the respective onPress callback and dismiss the alert.
|
|
58
|
-
* By default, the only button will be an 'OK' button.
|
|
59
|
-
* <div class="screenshots">
|
|
60
|
-
* <img src="screenshots/alert/alert-1.png" />
|
|
61
|
-
* <img src="screenshots/alert/alert-2.png" />
|
|
62
|
-
* <img src="screenshots/alert/alert-3.png" />
|
|
63
|
-
* <img src="screenshots/alert/alert-4.png" />
|
|
64
|
-
* <img src="screenshots/alert/alert-5.png" />
|
|
65
|
-
* <img src="screenshots/alert/alert-6.png" />
|
|
66
|
-
* </div>
|
|
67
|
-
*
|
|
68
|
-
*
|
|
69
|
-
* ## Usage
|
|
70
|
-
* ```js
|
|
71
|
-
*import * as React from "react";
|
|
72
|
-
*import { moderateScale } from "react-native-size-matters";
|
|
73
|
-
*import { Alert } from "@bigbinary/neetoui-rn";
|
|
74
|
-
*export function App(props) {
|
|
75
|
-
* return (
|
|
76
|
-
* <>
|
|
77
|
-
* // Render at root component.
|
|
78
|
-
* <Alert />
|
|
79
|
-
* </>
|
|
80
|
-
* );
|
|
81
|
-
*}
|
|
82
|
-
*
|
|
83
|
-
*import * as React from "react";
|
|
84
|
-
*import { moderateScale } from "react-native-size-matters";
|
|
85
|
-
*import { Alert, Button } from "@bigbinary/neetoui-rn";
|
|
86
|
-
*
|
|
87
|
-
*export default function Main() {
|
|
88
|
-
* return (
|
|
89
|
-
* <Button
|
|
90
|
-
* width={moderateScale(200)}
|
|
91
|
-
* my={moderateScale(10)}
|
|
92
|
-
* label="Three Buttons"
|
|
93
|
-
* onPress={() => {
|
|
94
|
-
* Alert.show({
|
|
95
|
-
* title: "Enjoying our app ?",
|
|
96
|
-
* description: "Do you wannna rate us on app store ?",
|
|
97
|
-
* buttons: [
|
|
98
|
-
* {
|
|
99
|
-
* label: "Yay!",
|
|
100
|
-
* onPress: () => {},
|
|
101
|
-
* },
|
|
102
|
-
* {
|
|
103
|
-
* label: "No",
|
|
104
|
-
* onPress: () => {},
|
|
105
|
-
* },
|
|
106
|
-
* {
|
|
107
|
-
* label: "Ask me later",
|
|
108
|
-
* onPress: () => {},
|
|
109
|
-
* },
|
|
110
|
-
* ],
|
|
111
|
-
* isCancelable: false,
|
|
112
|
-
* onDismiss: () => {},
|
|
113
|
-
* });
|
|
114
|
-
* }}
|
|
115
|
-
* />
|
|
116
|
-
* );
|
|
117
|
-
*}
|
|
118
|
-
*
|
|
119
|
-
* ```
|
|
120
|
-
*/
|
|
121
|
-
|
|
122
|
-
export const Alert = () => {
|
|
123
|
-
const {
|
|
124
|
-
isVisible,
|
|
125
|
-
show,
|
|
126
|
-
hide,
|
|
127
|
-
buttons,
|
|
128
|
-
hideOnBackPressDrop,
|
|
129
|
-
title,
|
|
130
|
-
description,
|
|
131
|
-
} = useAlertHook();
|
|
132
|
-
|
|
133
|
-
const [
|
|
134
|
-
button1 = {
|
|
135
|
-
label: "OK",
|
|
136
|
-
onPress: () => {},
|
|
137
|
-
variant: "solid",
|
|
138
|
-
},
|
|
139
|
-
button2,
|
|
140
|
-
button3,
|
|
141
|
-
] = buttons;
|
|
142
|
-
|
|
143
|
-
const ref = React.useRef(null);
|
|
144
|
-
|
|
145
|
-
React.useImperativeHandle(
|
|
146
|
-
ref,
|
|
147
|
-
React.useCallback(
|
|
148
|
-
() => ({
|
|
149
|
-
show,
|
|
150
|
-
}),
|
|
151
|
-
[show]
|
|
152
|
-
)
|
|
153
|
-
);
|
|
154
|
-
|
|
155
|
-
React.useEffect(() => {
|
|
156
|
-
rootLevelRef = ref.current;
|
|
157
|
-
}, [ref]);
|
|
158
|
-
|
|
159
|
-
return (
|
|
160
|
-
<Modal
|
|
161
|
-
hideModalContentWhileAnimating
|
|
162
|
-
useNativeDriver
|
|
163
|
-
isVisible={isVisible}
|
|
164
|
-
style={styles.modalStyle}
|
|
165
|
-
onBackdropPress={hideOnBackPressDrop}
|
|
166
|
-
>
|
|
167
|
-
<Container
|
|
168
|
-
alignItems="center"
|
|
169
|
-
bg="background.primary"
|
|
170
|
-
borderRadius={moderateScale(8)}
|
|
171
|
-
justifyContent="center"
|
|
172
|
-
padding={moderateScale(18)}
|
|
173
|
-
width="90%"
|
|
174
|
-
>
|
|
175
|
-
<Typography color="font.grey800" fontFamily="sf600" fontSize="3xl">
|
|
176
|
-
{title}
|
|
177
|
-
</Typography>
|
|
178
|
-
<Container alignItems="center" justifyContent="center">
|
|
179
|
-
<Typography
|
|
180
|
-
color="font.grey500"
|
|
181
|
-
fontFamily="sf400"
|
|
182
|
-
fontSize="s"
|
|
183
|
-
py={moderateScale(20)}
|
|
184
|
-
textAlign="center"
|
|
185
|
-
>
|
|
186
|
-
{description}
|
|
187
|
-
</Typography>
|
|
188
|
-
</Container>
|
|
189
|
-
<Container
|
|
190
|
-
flexDirection="row"
|
|
191
|
-
justifyContent="space-around"
|
|
192
|
-
width="100%"
|
|
193
|
-
>
|
|
194
|
-
{button2 && (
|
|
195
|
-
<Button
|
|
196
|
-
borderRadius={moderateScale(8)}
|
|
197
|
-
borderWidth={moderateScale(1)}
|
|
198
|
-
fontFamily="sf400"
|
|
199
|
-
fontSize="m"
|
|
200
|
-
height={moderateScale(35)}
|
|
201
|
-
label={button2.label}
|
|
202
|
-
minWidth={moderateScale(110)}
|
|
203
|
-
p={0}
|
|
204
|
-
variant={button2.variant || "text"}
|
|
205
|
-
width={undefined}
|
|
206
|
-
onPress={() => {
|
|
207
|
-
button2.onPress?.();
|
|
208
|
-
hide();
|
|
209
|
-
}}
|
|
210
|
-
/>
|
|
211
|
-
)}
|
|
212
|
-
{button1 && (
|
|
213
|
-
<Button
|
|
214
|
-
borderRadius={moderateScale(8)}
|
|
215
|
-
fontFamily="sf400"
|
|
216
|
-
fontSize="m"
|
|
217
|
-
height={moderateScale(35)}
|
|
218
|
-
label={button1.label}
|
|
219
|
-
minWidth={moderateScale(110)}
|
|
220
|
-
p={0}
|
|
221
|
-
variant={button1.variant}
|
|
222
|
-
width={undefined}
|
|
223
|
-
onPress={() => {
|
|
224
|
-
button1.onPress?.();
|
|
225
|
-
hide();
|
|
226
|
-
}}
|
|
227
|
-
/>
|
|
228
|
-
)}
|
|
229
|
-
</Container>
|
|
230
|
-
{button3 && (
|
|
231
|
-
<Button
|
|
232
|
-
borderRadius={moderateScale(8)}
|
|
233
|
-
borderWidth={moderateScale(1)}
|
|
234
|
-
fontFamily="sf400"
|
|
235
|
-
fontSize="m"
|
|
236
|
-
height={moderateScale(35)}
|
|
237
|
-
label={button3.label}
|
|
238
|
-
minWidth={moderateScale(110)}
|
|
239
|
-
mt={moderateScale(20)}
|
|
240
|
-
p={0}
|
|
241
|
-
variant={button3.variant}
|
|
242
|
-
onPress={() => {
|
|
243
|
-
button3.onPress?.();
|
|
244
|
-
hide();
|
|
245
|
-
}}
|
|
246
|
-
/>
|
|
247
|
-
)}
|
|
248
|
-
</Container>
|
|
249
|
-
</Modal>
|
|
250
|
-
);
|
|
251
|
-
};
|
|
252
|
-
|
|
253
|
-
const styles = StyleSheet.create({
|
|
254
|
-
modalStyle: {
|
|
255
|
-
alignItems: "center",
|
|
256
|
-
justifyContent: "center",
|
|
257
|
-
},
|
|
258
|
-
});
|
|
259
|
-
|
|
260
|
-
Alert.show = params => {
|
|
261
|
-
rootLevelRef.show(params);
|
|
262
|
-
};
|
|
@@ -1,140 +0,0 @@
|
|
|
1
|
-
import React, { useState } from "react";
|
|
2
|
-
|
|
3
|
-
import PropTypes from "prop-types";
|
|
4
|
-
import RNFImage from "react-native-fast-image";
|
|
5
|
-
import Animated, {
|
|
6
|
-
Easing,
|
|
7
|
-
useAnimatedStyle,
|
|
8
|
-
useSharedValue,
|
|
9
|
-
withTiming,
|
|
10
|
-
} from "react-native-reanimated";
|
|
11
|
-
import { moderateScale } from "react-native-size-matters";
|
|
12
|
-
import styled from "styled-components/native";
|
|
13
|
-
import { flexbox, space, border, color, layout } from "styled-system";
|
|
14
|
-
|
|
15
|
-
import ImagePlaceholder from "@assets/images/image-placeholder.svg";
|
|
16
|
-
import { Container, Loader } from "@components";
|
|
17
|
-
|
|
18
|
-
import { theme } from "../theme";
|
|
19
|
-
|
|
20
|
-
const StyledImage = styled(RNFImage)`
|
|
21
|
-
${flexbox}
|
|
22
|
-
${space}
|
|
23
|
-
${border}
|
|
24
|
-
${color}
|
|
25
|
-
${layout}
|
|
26
|
-
`;
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* AnimatedImage can be used to display a placeholder before image is loaded with animation.
|
|
30
|
-
*
|
|
31
|
-
* <div class="screenshots">
|
|
32
|
-
* <img src="screenshots/avatar/images.png" />
|
|
33
|
-
* <img src="screenshots/avatar/texts.png" />
|
|
34
|
-
* </div>
|
|
35
|
-
*
|
|
36
|
-
* ## Usage
|
|
37
|
-
* ```js
|
|
38
|
-
* import * as React from 'react';
|
|
39
|
-
* import { Typography, Avatar } from '@bigbinary/neetoui-rn';
|
|
40
|
-
*
|
|
41
|
-
* export default function Main() {
|
|
42
|
-
* return (
|
|
43
|
-
* <Container>
|
|
44
|
-
* <AnimatedImage
|
|
45
|
-
* imageHeight={moderateScale(139)}
|
|
46
|
-
* imageWidth={moderateScale(255)}
|
|
47
|
-
* imageUrl="https://picsum.photos/255/139"
|
|
48
|
-
* />
|
|
49
|
-
* </Container>
|
|
50
|
-
* );
|
|
51
|
-
* }
|
|
52
|
-
* ```
|
|
53
|
-
*/
|
|
54
|
-
|
|
55
|
-
const borderRadius = moderateScale(10);
|
|
56
|
-
export const AnimatedImage = ({
|
|
57
|
-
imageHeight = 139,
|
|
58
|
-
imageWidth = 255,
|
|
59
|
-
imageUrl,
|
|
60
|
-
...rest
|
|
61
|
-
}) => {
|
|
62
|
-
const opacity = useSharedValue(0);
|
|
63
|
-
const [isImageLoaded, setIsImageLoaded] = useState(false);
|
|
64
|
-
|
|
65
|
-
const profileImageStyle = useAnimatedStyle(() => ({
|
|
66
|
-
opacity: withTiming(opacity.value, {
|
|
67
|
-
duration: 300,
|
|
68
|
-
easing: Easing.bezier(0.25, 0.1, 0.25, 1),
|
|
69
|
-
}),
|
|
70
|
-
height: imageHeight,
|
|
71
|
-
width: imageWidth,
|
|
72
|
-
alignSelf: "center",
|
|
73
|
-
borderRadius,
|
|
74
|
-
}));
|
|
75
|
-
|
|
76
|
-
return (
|
|
77
|
-
<Container
|
|
78
|
-
alignItems="center"
|
|
79
|
-
borderRadius={moderateScale(10)}
|
|
80
|
-
justifyContent="center"
|
|
81
|
-
overflow="hidden"
|
|
82
|
-
>
|
|
83
|
-
<Animated.View style={profileImageStyle}>
|
|
84
|
-
<StyledImage
|
|
85
|
-
height={imageHeight}
|
|
86
|
-
width={imageWidth}
|
|
87
|
-
source={{
|
|
88
|
-
uri: imageUrl,
|
|
89
|
-
headers: {
|
|
90
|
-
Accept: "*/*",
|
|
91
|
-
"Content-Type": "application/json",
|
|
92
|
-
Pragma: "no-cache",
|
|
93
|
-
},
|
|
94
|
-
}}
|
|
95
|
-
onLoad={() => {
|
|
96
|
-
setIsImageLoaded(true);
|
|
97
|
-
opacity.value = 1;
|
|
98
|
-
}}
|
|
99
|
-
onLoadStart={() => {
|
|
100
|
-
setIsImageLoaded(false);
|
|
101
|
-
opacity.value = 0;
|
|
102
|
-
}}
|
|
103
|
-
{...rest}
|
|
104
|
-
/>
|
|
105
|
-
</Animated.View>
|
|
106
|
-
{!isImageLoaded && (
|
|
107
|
-
<Container position="absolute">
|
|
108
|
-
<ImagePlaceholder />
|
|
109
|
-
<Container
|
|
110
|
-
bottom={moderateScale(15)}
|
|
111
|
-
position="absolute"
|
|
112
|
-
right={moderateScale(15)}
|
|
113
|
-
>
|
|
114
|
-
<Loader color={theme.colors.font.grey600} />
|
|
115
|
-
</Container>
|
|
116
|
-
</Container>
|
|
117
|
-
)}
|
|
118
|
-
</Container>
|
|
119
|
-
);
|
|
120
|
-
};
|
|
121
|
-
|
|
122
|
-
AnimatedImage.defaultProps = {
|
|
123
|
-
alignItems: "center",
|
|
124
|
-
justifyContent: "center",
|
|
125
|
-
};
|
|
126
|
-
|
|
127
|
-
AnimatedImage.propTypes = {
|
|
128
|
-
/**
|
|
129
|
-
* Height for image.
|
|
130
|
-
*/
|
|
131
|
-
imageHeight: PropTypes.number | PropTypes.string,
|
|
132
|
-
/**
|
|
133
|
-
* Width for image.
|
|
134
|
-
*/
|
|
135
|
-
imageWidth: PropTypes.number,
|
|
136
|
-
/**
|
|
137
|
-
* Url to display the Image. It accepts a standard React Native Image source prop Or a function that returns an Image.
|
|
138
|
-
*/
|
|
139
|
-
imageUrl: PropTypes.string,
|
|
140
|
-
};
|
|
@@ -1,144 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { StyleSheet } from "react-native";
|
|
3
|
-
|
|
4
|
-
import PropTypes from "prop-types";
|
|
5
|
-
import Animated, {
|
|
6
|
-
Easing,
|
|
7
|
-
useAnimatedStyle,
|
|
8
|
-
useSharedValue,
|
|
9
|
-
withTiming,
|
|
10
|
-
} from "react-native-reanimated";
|
|
11
|
-
import { moderateScale } from "react-native-size-matters";
|
|
12
|
-
|
|
13
|
-
import { Typography, Container } from "@components";
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* Avatars can be used to represent people in a graphical way.
|
|
17
|
-
*
|
|
18
|
-
* <div class="screenshots">
|
|
19
|
-
* <img src="screenshots/avatar/images.png" />
|
|
20
|
-
* <img src="screenshots/avatar/texts.png" />
|
|
21
|
-
* </div>
|
|
22
|
-
*
|
|
23
|
-
* ## Usage
|
|
24
|
-
* ```js
|
|
25
|
-
* import * as React from 'react';
|
|
26
|
-
* import { Typography, Avatar } from '@bigbinary/neetoui-rn';
|
|
27
|
-
*
|
|
28
|
-
* export default function Main() {
|
|
29
|
-
* return (
|
|
30
|
-
* <Container>
|
|
31
|
-
* <Avatar
|
|
32
|
-
* variant={"medium"}
|
|
33
|
-
* name="Oliver Smith"
|
|
34
|
-
* imageUrl="https://www.himalmag.com/wp-content/uploads/2019/07/sample-profile-picture.png"
|
|
35
|
-
* />
|
|
36
|
-
* </Container>
|
|
37
|
-
* );
|
|
38
|
-
* }
|
|
39
|
-
* ```
|
|
40
|
-
*/
|
|
41
|
-
|
|
42
|
-
export const Avatar = ({
|
|
43
|
-
name,
|
|
44
|
-
variant = "medium",
|
|
45
|
-
bgColor = "background.lightBlue100",
|
|
46
|
-
fontColor = "font.darkBlue100",
|
|
47
|
-
imageUrl,
|
|
48
|
-
...rest
|
|
49
|
-
}) => {
|
|
50
|
-
const opacity = useSharedValue(0);
|
|
51
|
-
const acronym = name
|
|
52
|
-
?.split(/\s/)
|
|
53
|
-
.reduce((response, word) => (response += word.slice(0, 1)), "")
|
|
54
|
-
.slice(0, 2);
|
|
55
|
-
|
|
56
|
-
const getSizes = () => {
|
|
57
|
-
switch (variant) {
|
|
58
|
-
case "extra-small":
|
|
59
|
-
return [moderateScale(24), moderateScale(8)];
|
|
60
|
-
case "small":
|
|
61
|
-
return [moderateScale(36), moderateScale(12)];
|
|
62
|
-
case "medium":
|
|
63
|
-
return [moderateScale(48), moderateScale(14)];
|
|
64
|
-
default:
|
|
65
|
-
return [moderateScale(48), moderateScale(14)];
|
|
66
|
-
}
|
|
67
|
-
};
|
|
68
|
-
|
|
69
|
-
const [avatarSize, avatarFontSize] = getSizes();
|
|
70
|
-
|
|
71
|
-
const profileImageStyle = useAnimatedStyle(() => ({
|
|
72
|
-
opacity: withTiming(opacity.value, {
|
|
73
|
-
duration: 300,
|
|
74
|
-
easing: Easing.bezier(0.25, 0.1, 0.25, 1),
|
|
75
|
-
}),
|
|
76
|
-
height: avatarSize,
|
|
77
|
-
width: avatarSize,
|
|
78
|
-
alignSelf: "center",
|
|
79
|
-
borderRadius: avatarSize / 2,
|
|
80
|
-
}));
|
|
81
|
-
|
|
82
|
-
return (
|
|
83
|
-
<Container
|
|
84
|
-
bg={bgColor}
|
|
85
|
-
borderRadius={avatarSize / 2}
|
|
86
|
-
height={avatarSize}
|
|
87
|
-
width={avatarSize}
|
|
88
|
-
{...rest}
|
|
89
|
-
flexDirection="row"
|
|
90
|
-
>
|
|
91
|
-
<Container style={styles.acronym}>
|
|
92
|
-
<Typography
|
|
93
|
-
color={fontColor}
|
|
94
|
-
fontFamily="sf400"
|
|
95
|
-
fontSize={avatarFontSize}
|
|
96
|
-
>
|
|
97
|
-
{acronym.toUpperCase()}
|
|
98
|
-
</Typography>
|
|
99
|
-
</Container>
|
|
100
|
-
<Animated.Image
|
|
101
|
-
source={{ uri: imageUrl }}
|
|
102
|
-
style={profileImageStyle}
|
|
103
|
-
onLoad={() => (opacity.value = 1)}
|
|
104
|
-
{...rest}
|
|
105
|
-
/>
|
|
106
|
-
</Container>
|
|
107
|
-
);
|
|
108
|
-
};
|
|
109
|
-
|
|
110
|
-
const styles = StyleSheet.create({
|
|
111
|
-
acronym: {
|
|
112
|
-
position: "absolute",
|
|
113
|
-
justifyContent: "center",
|
|
114
|
-
alignItems: "center",
|
|
115
|
-
},
|
|
116
|
-
});
|
|
117
|
-
|
|
118
|
-
Avatar.defaultProps = {
|
|
119
|
-
alignItems: "center",
|
|
120
|
-
justifyContent: "center",
|
|
121
|
-
};
|
|
122
|
-
|
|
123
|
-
Avatar.propTypes = {
|
|
124
|
-
/**
|
|
125
|
-
* Name to obtain user initials to show as the text in the Avatar.
|
|
126
|
-
*/
|
|
127
|
-
name: PropTypes.string,
|
|
128
|
-
/**
|
|
129
|
-
* variant of the avatar: `medium` or `small`
|
|
130
|
-
*/
|
|
131
|
-
variant: PropTypes.oneOf(["medium", "small", "extra-small"]),
|
|
132
|
-
/**
|
|
133
|
-
* Custom color for the avatar.
|
|
134
|
-
*/
|
|
135
|
-
bgColor: PropTypes.string,
|
|
136
|
-
/**
|
|
137
|
-
* Custom color for the text.
|
|
138
|
-
*/
|
|
139
|
-
fontColor: PropTypes.string,
|
|
140
|
-
/**
|
|
141
|
-
* Image to display for the Avatar. It accepts a standard React Native Image source prop Or a function that returns an Image.
|
|
142
|
-
*/
|
|
143
|
-
imageUrl: PropTypes.string,
|
|
144
|
-
};
|
package/src/components/Badge.jsx
DELETED
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
|
|
3
|
-
import PropTypes from "prop-types";
|
|
4
|
-
import { moderateScale } from "react-native-size-matters";
|
|
5
|
-
|
|
6
|
-
import { Typography, Container } from "@components";
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
*
|
|
10
|
-
* This component supports below props categories from [styled-system ](/styled-system).
|
|
11
|
-
* <ul>
|
|
12
|
-
* <li>flexbox</li>
|
|
13
|
-
* <li>space</li>
|
|
14
|
-
* <li>border</li>
|
|
15
|
-
* <li>color</li>
|
|
16
|
-
* <li>layout</li>
|
|
17
|
-
* </ul>
|
|
18
|
-
*
|
|
19
|
-
* <div class="screenshots">
|
|
20
|
-
* <img src="screenshots/badge/badges.png" />
|
|
21
|
-
* </div>
|
|
22
|
-
*
|
|
23
|
-
* ## Usage
|
|
24
|
-
* ```js
|
|
25
|
-
* import * as React from 'react';
|
|
26
|
-
* import { Badge, Container } from '@bigbinary/neetoui-rn';
|
|
27
|
-
*
|
|
28
|
-
* export default function Main() {
|
|
29
|
-
* return (
|
|
30
|
-
* <Container>
|
|
31
|
-
* <Badge
|
|
32
|
-
* content="test"
|
|
33
|
-
* size={moderateScale(32)}
|
|
34
|
-
* fontSize="12px"
|
|
35
|
-
* badgeColor="background.secondary"
|
|
36
|
-
* color="font.secondary"
|
|
37
|
-
* />
|
|
38
|
-
* </Container>
|
|
39
|
-
* );
|
|
40
|
-
* }
|
|
41
|
-
* ```
|
|
42
|
-
*
|
|
43
|
-
*/
|
|
44
|
-
|
|
45
|
-
export const Badge = ({
|
|
46
|
-
badgeColor = "background.base",
|
|
47
|
-
content,
|
|
48
|
-
size = moderateScale(21),
|
|
49
|
-
fontSize = "xs",
|
|
50
|
-
fontFamily = "sf400",
|
|
51
|
-
color = "font.white",
|
|
52
|
-
...rest
|
|
53
|
-
}) =>
|
|
54
|
-
size > 0 && (
|
|
55
|
-
<Container
|
|
56
|
-
alignItems="center"
|
|
57
|
-
bg={badgeColor}
|
|
58
|
-
borderRadius={moderateScale(15)}
|
|
59
|
-
justifyContent="center"
|
|
60
|
-
px={moderateScale(6)}
|
|
61
|
-
py={moderateScale(1)}
|
|
62
|
-
{...rest}
|
|
63
|
-
>
|
|
64
|
-
{!!content && (
|
|
65
|
-
<Typography color={color} fontFamily={fontFamily} fontSize={fontSize}>
|
|
66
|
-
{content}
|
|
67
|
-
</Typography>
|
|
68
|
-
)}
|
|
69
|
-
</Container>
|
|
70
|
-
);
|
|
71
|
-
|
|
72
|
-
Badge.propTypes = {
|
|
73
|
-
/**
|
|
74
|
-
* Custom badge content color.
|
|
75
|
-
*/
|
|
76
|
-
color: PropTypes.string,
|
|
77
|
-
/**
|
|
78
|
-
* Custom badge background color.
|
|
79
|
-
*/
|
|
80
|
-
badgeColor: PropTypes.string,
|
|
81
|
-
/**
|
|
82
|
-
* To change content of the badge
|
|
83
|
-
*/
|
|
84
|
-
content: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
|
85
|
-
/**
|
|
86
|
-
* Custom badge size.
|
|
87
|
-
*/
|
|
88
|
-
size: PropTypes.number,
|
|
89
|
-
/**
|
|
90
|
-
* Custom font-size for badge content.
|
|
91
|
-
*/
|
|
92
|
-
fontSize: PropTypes.string,
|
|
93
|
-
/**
|
|
94
|
-
* Custom font-family for badge content.
|
|
95
|
-
*/
|
|
96
|
-
fontFamily: PropTypes.string,
|
|
97
|
-
};
|