@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.
Files changed (125) hide show
  1. package/lib/components/Accordion.js +1 -1
  2. package/lib/components/ActionIcon.js +1 -1
  3. package/lib/components/Alert.js +1 -1
  4. package/lib/components/AnimatedImage.js +1 -1
  5. package/lib/components/Avatar.js +1 -1
  6. package/lib/components/Badge.js +1 -1
  7. package/lib/components/BottomSheet.js +1 -1
  8. package/lib/components/BottomTabBar.js +1 -1
  9. package/lib/components/Button.js +1 -1
  10. package/lib/components/ButtonGroup.js +1 -1
  11. package/lib/components/Calendar.js +1 -1
  12. package/lib/components/Card.js +1 -1
  13. package/lib/components/Carousel.js +1 -1
  14. package/lib/components/ChatInput/AttachmentsView.js +1 -1
  15. package/lib/components/ChatInput/Badge.js +1 -1
  16. package/lib/components/ChatInput/ChatInput.js +1 -1
  17. package/lib/components/ChatInput/EmailFields.js +1 -1
  18. package/lib/components/ChatInput/IconButton.js +1 -1
  19. package/lib/components/ChatInput/MentionsInputWrapper.js +1 -1
  20. package/lib/components/CheckBox.js +1 -1
  21. package/lib/components/Chip.js +1 -1
  22. package/lib/components/Container.js +1 -1
  23. package/lib/components/Divider.js +1 -1
  24. package/lib/components/FAB.js +1 -1
  25. package/lib/components/FlashList.js +1 -1
  26. package/lib/components/FlatList.js +1 -1
  27. package/lib/components/Input.js +1 -1
  28. package/lib/components/InputEmailChip.js +1 -1
  29. package/lib/components/LineLoader.js +1 -1
  30. package/lib/components/ListItem.js +1 -1
  31. package/lib/components/Loader.js +1 -1
  32. package/lib/components/MultiSelect.js +1 -1
  33. package/lib/components/NotificationIcon.js +1 -1
  34. package/lib/components/NotificationPreferenceList.js +1 -1
  35. package/lib/components/OnBoarding.js +1 -1
  36. package/lib/components/OrganizationItem.js +1 -1
  37. package/lib/components/OtpInputs.js +1 -1
  38. package/lib/components/ParentView.js +1 -1
  39. package/lib/components/Popover.js +1 -1
  40. package/lib/components/RadioButton.js +1 -1
  41. package/lib/components/RichTextEditor.js +1 -1
  42. package/lib/components/Ripple.js +1 -1
  43. package/lib/components/ScrollView.js +1 -1
  44. package/lib/components/SearchBar.js +1 -1
  45. package/lib/components/SegmentedTopBar/Indicator.js +1 -1
  46. package/lib/components/SegmentedTopBar/Tab.js +1 -1
  47. package/lib/components/SegmentedTopBar/index.js +1 -1
  48. package/lib/components/SocialButton.js +1 -1
  49. package/lib/components/Toast.js +1 -1
  50. package/lib/components/ToggleSwitch.js +1 -1
  51. package/lib/components/TopBar.js +1 -1
  52. package/lib/components/Touchable.js +1 -1
  53. package/lib/components/TouchableWithoutFeedback.js +1 -1
  54. package/lib/components/Typography.js +1 -1
  55. package/lib/components/index.js +1 -1
  56. package/lib/config/toasterConfig.js +1 -1
  57. package/lib/contexts/index.js +1 -1
  58. package/lib/theme/index.js +1 -1
  59. package/lib/utils/utils.js +1 -1
  60. package/package.json +22 -15
  61. package/src/components/Accordion.jsx +0 -266
  62. package/src/components/ActionIcon.jsx +0 -76
  63. package/src/components/Alert.jsx +0 -262
  64. package/src/components/AnimatedImage.jsx +0 -140
  65. package/src/components/Avatar.jsx +0 -144
  66. package/src/components/Badge.jsx +0 -97
  67. package/src/components/BottomSheet.jsx +0 -487
  68. package/src/components/BottomTabBar.jsx +0 -232
  69. package/src/components/Button.jsx +0 -275
  70. package/src/components/ButtonGroup.jsx +0 -120
  71. package/src/components/Calendar.jsx +0 -128
  72. package/src/components/Card.jsx +0 -90
  73. package/src/components/Carousel.jsx +0 -116
  74. package/src/components/ChatInput/AttachmentsView.jsx +0 -51
  75. package/src/components/ChatInput/Badge.jsx +0 -24
  76. package/src/components/ChatInput/ChatInput.jsx +0 -564
  77. package/src/components/ChatInput/EmailFields.jsx +0 -122
  78. package/src/components/ChatInput/IconButton.jsx +0 -34
  79. package/src/components/ChatInput/MentionsInputWrapper.jsx +0 -155
  80. package/src/components/CheckBox.jsx +0 -150
  81. package/src/components/Chip.jsx +0 -180
  82. package/src/components/Container.jsx +0 -31
  83. package/src/components/Divider.jsx +0 -79
  84. package/src/components/FAB.jsx +0 -113
  85. package/src/components/FlashList.jsx +0 -189
  86. package/src/components/FlatList.js +0 -10
  87. package/src/components/Input.jsx +0 -357
  88. package/src/components/InputEmailChip.jsx +0 -246
  89. package/src/components/LineLoader.jsx +0 -46
  90. package/src/components/ListItem.jsx +0 -68
  91. package/src/components/Loader.jsx +0 -122
  92. package/src/components/MultiSelect.jsx +0 -631
  93. package/src/components/NotificationIcon.jsx +0 -38
  94. package/src/components/NotificationPreferenceList.jsx +0 -208
  95. package/src/components/OnBoarding.jsx +0 -134
  96. package/src/components/OrganizationItem.jsx +0 -110
  97. package/src/components/OtpInputs.jsx +0 -194
  98. package/src/components/ParentView.jsx +0 -139
  99. package/src/components/Popover.jsx +0 -221
  100. package/src/components/RadioButton.jsx +0 -155
  101. package/src/components/RichTextEditor.jsx +0 -163
  102. package/src/components/Ripple.jsx +0 -281
  103. package/src/components/ScrollView.js +0 -14
  104. package/src/components/SearchBar.jsx +0 -207
  105. package/src/components/SegmentedTopBar/Indicator.jsx +0 -77
  106. package/src/components/SegmentedTopBar/Tab.jsx +0 -37
  107. package/src/components/SegmentedTopBar/index.jsx +0 -128
  108. package/src/components/SocialButton.jsx +0 -106
  109. package/src/components/Toast.jsx +0 -195
  110. package/src/components/ToggleSwitch.jsx +0 -112
  111. package/src/components/TopBar.jsx +0 -147
  112. package/src/components/Touchable.jsx +0 -133
  113. package/src/components/TouchableWithoutFeedback.jsx +0 -51
  114. package/src/components/Typography.jsx +0 -93
  115. package/src/components/index.js +0 -45
  116. package/src/config/index.js +0 -1
  117. package/src/config/toasterConfig.jsx +0 -142
  118. package/src/contexts/index.js +0 -3
  119. package/src/hooks/index.js +0 -3
  120. package/src/hooks/useDebounce.js +0 -17
  121. package/src/hooks/useKeyboard.js +0 -33
  122. package/src/hooks/useRefreshByUser.js +0 -20
  123. package/src/index.js +0 -2
  124. package/src/theme/index.js +0 -181
  125. package/src/utils/utils.js +0 -56
@@ -1,275 +0,0 @@
1
- import React, { useContext } from "react";
2
-
3
- import propTypes from "@styled-system/prop-types";
4
- import PropTypes from "prop-types";
5
- import { moderateScale } from "react-native-size-matters";
6
- import { ThemeContext } from "styled-components/native";
7
-
8
- import { Typography, Touchable, Container, Loader } from "@components";
9
-
10
- // eslint-disable-next-line @bigbinary/neeto/no-dangling-constants
11
- export const BUTTON_VARIANTS = Object.freeze({
12
- SOLID: "solid",
13
- SECONDARY: "secondary",
14
- TEXT: "text",
15
- DANGER: "danger",
16
- DANGER_INVERSE: "danger-inverse",
17
- DANGER_TEXT: "danger-text",
18
- });
19
-
20
- /**
21
- *
22
- * Buttons are touchable elements used to interact with the screen and to trigger an action.
23
- *
24
- * <div class="screenshots">
25
- * <img src="screenshots/button/button.png" />
26
- * </div>
27
- *
28
- * ## Usage
29
- * ```js
30
- * import * as React from 'react';
31
- * import { Button, Container } from '@bigbinary/neetoui-rn';
32
- *
33
- * export default function Main() {
34
- * return (
35
- * <Container>
36
- * <Button my={moderateScale(9)} label="Button1" />
37
- * <Button my={moderateScale(9)} disabled label="Disabled Button2" />
38
- * <Button
39
- * my={moderateScale(9)}
40
- * LeftIcon={() => <Icon name="ri-add-line" color="white" size={moderateScale(16)} />}
41
- * label="Left Icon Button"
42
- * />
43
- * <Button
44
- * my={moderateScale(9)}
45
- * RightIcon={() => <Icon name="ri-add-line" color="white" size={moderateScale(16)} />}
46
- * label="Right Icon Button"
47
- * />
48
- * <Button my={moderateScale(9)} variant="text" label="Text Button" />
49
- * <Button
50
- * my={moderateScale(9)}
51
- * variant="text"
52
- * LeftIcon={() => (
53
- * <Icon name="ri-add-line" color={theme.fonts.primary} size={moderateScale(16)} />
54
- * )}
55
- * label="Left Icon Text Button"
56
- * />
57
- * <Button
58
- * my={moderateScale(9)}
59
- * variant="text"
60
- * RightIcon={() => (
61
- * <Icon name="ri-add-line" color={theme.fonts.primary} size={moderateScale(16)} />
62
- * )}
63
- * label="Right Icon Text Button"
64
- * />
65
- * </Container>
66
- * );
67
- * }
68
- * ```
69
- *
70
- */
71
-
72
- export const Button = React.forwardRef(
73
- (
74
- {
75
- variant,
76
- label,
77
- labelStyle,
78
- RightIcon,
79
- LeftIcon,
80
- disabled,
81
- isLoading,
82
- loadingText,
83
- fontFamily,
84
- color,
85
- fontSize,
86
- ...rest
87
- },
88
- ref
89
- ) => {
90
- const theme = useContext(ThemeContext);
91
- const width =
92
- variant === "text" || variant === "danger-text" ? null : "100%";
93
-
94
- const getButtonColors = () => {
95
- switch (variant) {
96
- case BUTTON_VARIANTS.SOLID:
97
- return {
98
- bg: theme.colors.background[disabled ? "grey400" : "base"],
99
- border: theme.colors.background[disabled ? "grey400" : "base"],
100
- color: theme.colors.background.white,
101
- ripple: "white",
102
- };
103
- case BUTTON_VARIANTS.SECONDARY:
104
- return {
105
- bg: "transparent",
106
- border: theme.colors.background.base,
107
- color: theme.colors.font.base,
108
- ripple: theme.colors.background.base,
109
- };
110
- case BUTTON_VARIANTS.TEXT:
111
- return {
112
- bg: "transparent",
113
- border: "transparent",
114
- color: theme.colors.font.primary,
115
- ripple: theme.colors.background.grey800,
116
- };
117
- case BUTTON_VARIANTS.DANGER:
118
- return {
119
- bg: theme.colors.background.danger,
120
- border: theme.colors.background.danger,
121
- color: theme.colors.background.white,
122
- ripple: "white",
123
- };
124
- case BUTTON_VARIANTS.DANGER_INVERSE:
125
- return {
126
- bg: theme.colors.background.white,
127
- border: theme.colors.background.danger,
128
- color: theme.colors.background.danger,
129
- ripple: theme.colors.background.grey800,
130
- };
131
- case BUTTON_VARIANTS.DANGER_TEXT:
132
- return {
133
- bg: "transparent",
134
- border: "transparent",
135
- color: theme.colors.background.danger,
136
- ripple: theme.colors.background.grey800,
137
- };
138
- default:
139
- return {
140
- bg: theme.colors.background[disabled ? "grey400" : "base"],
141
- border: theme.colors.background[disabled ? "grey400" : "base"],
142
- color: theme.colors.background.white,
143
- ripple: "white",
144
- };
145
- }
146
- };
147
-
148
- const renderOpacity = () => {
149
- if (
150
- [
151
- "text",
152
- "secondary",
153
- "danger",
154
- "danger-inverse",
155
- "danger-text",
156
- ].includes(variant) &&
157
- disabled
158
- ) {
159
- return 0.5;
160
- }
161
-
162
- return 1;
163
- };
164
-
165
- return (
166
- <Touchable
167
- alignItems="center"
168
- bg={getButtonColors().bg}
169
- borderColor={getButtonColors().border}
170
- borderRadius={moderateScale(8)}
171
- borderWidth={moderateScale(1)}
172
- disabled={disabled || isLoading}
173
- flexDirection="row"
174
- height={moderateScale(48)}
175
- justifyContent="center"
176
- opacity={renderOpacity()}
177
- px={width === null ? moderateScale(8) : undefined}
178
- ref={ref}
179
- rippleConfig={{ color: getButtonColors().ripple }}
180
- width={width}
181
- {...rest}
182
- >
183
- {isLoading ? (
184
- <Container flexDirection="row">
185
- <Loader color={getButtonColors().color} />
186
- {!!loadingText && (
187
- <Typography
188
- color={color || getButtonColors().color}
189
- fontFamily={fontFamily || theme.fonts.sf500}
190
- fontSize={fontSize}
191
- ml={moderateScale(8)}
192
- textAlign="center"
193
- {...labelStyle}
194
- >
195
- {loadingText}
196
- </Typography>
197
- )}
198
- </Container>
199
- ) : (
200
- <>
201
- {LeftIcon && <LeftIcon />}
202
- <Typography
203
- color={color || getButtonColors().color}
204
- fontFamily={fontFamily || theme.fonts.sf500}
205
- fontSize={fontSize}
206
- mx={moderateScale(2)}
207
- textAlign="center"
208
- {...labelStyle}
209
- >
210
- {label}
211
- </Typography>
212
- {RightIcon && <RightIcon />}
213
- </>
214
- )}
215
- </Touchable>
216
- );
217
- }
218
- );
219
-
220
- Button.defaultProps = {
221
- variant: "solid",
222
- isLoading: false,
223
- loadingText: "",
224
- fontSize: "m",
225
- };
226
-
227
- Button.propTypes = {
228
- ...propTypes.buttonStyle,
229
- ...propTypes.flexbox,
230
- ...propTypes.space,
231
- ...propTypes.border,
232
- ...propTypes.layout,
233
- ...propTypes.color,
234
- /**
235
- * Takes the text that needs to be displayed inside the button.
236
- */
237
- label: PropTypes.string.isRequired,
238
- /**
239
- * Supported Type: 'text' | 'solid'
240
- * You can change the mode to adjust the styling.
241
- * <ul>
242
- * <li>text - flat button without background or outline.</li>
243
- * <li>solid - button with a background color.</li>
244
- * </ul>
245
- */
246
- variant: PropTypes.oneOf(Object.values(BUTTON_VARIANTS)),
247
- /**
248
- * Enable or Disable the button.
249
- */
250
- disabled: PropTypes.bool,
251
- /**
252
- * Customize label style of the button.
253
- */
254
- labelStyle: PropTypes.object,
255
- /**
256
- * Render a component on the right side of the Label.
257
- */
258
- RightIcon: PropTypes.elementType,
259
- /**
260
- * Render a component on the left side of the Label.
261
- */
262
- LeftIcon: PropTypes.elementType,
263
- /**
264
- * To show loading indicator on the button.
265
- */
266
- isLoading: PropTypes.bool,
267
- /**
268
- * To show loading text along with the loading indicator on the button.
269
- */
270
- loadingText: PropTypes.string,
271
- fontFamily: PropTypes.string,
272
- color: PropTypes.string,
273
- fontSize: PropTypes.string,
274
- };
275
- Button.displayName = "Button";
@@ -1,120 +0,0 @@
1
- import * as React from "react";
2
-
3
- import PropTypes from "prop-types";
4
- import { moderateScale } from "react-native-size-matters";
5
-
6
- import { Container, Typography, Touchable } from "@components";
7
-
8
- /**
9
- * ButtonGroup is a linear set of segments, each of which function as a button that can display a different view/or perform a different action.
10
- * <div class="screenshots">
11
- * <img src="screenshots/buttonGroup/buttonGroup.png" />
12
- * </div>
13
- *
14
- * ## Usage
15
- * ```js
16
- * import React, { useState } from 'react';
17
- * import { ButtonGroup } from '@bigbinary/neetoui-rn';
18
- *
19
- * export default function Main(){
20
- * const buttonItems = ["Button1", "Button2"];
21
- * const [activeButton, setActiveButton] = useState(buttonItems[0]);
22
- *
23
- * return(
24
- * <ButtonGroup
25
- * buttonItems={buttonItems}
26
- * onPress={setActiveButton}
27
- * currentActiveBtn={activeButton}
28
- * />
29
- * );
30
- * }
31
-
32
- * ```
33
- */
34
-
35
- export const ButtonGroup = ({
36
- activeColor,
37
- inActiveColor,
38
- buttonItems,
39
- onPress,
40
- currentActiveBtn,
41
- wrapperStyle,
42
- buttonStyle,
43
- buttonTextStyle,
44
- }) => (
45
- <Container
46
- alignSelf="center"
47
- border="1px solid"
48
- borderColor={activeColor}
49
- borderRadius={moderateScale(2)}
50
- flexDirection="row"
51
- justifyContent="space-between"
52
- my={moderateScale(3)}
53
- {...wrapperStyle}
54
- >
55
- {buttonItems.map(item => (
56
- <Touchable
57
- bg={item === currentActiveBtn ? activeColor : inActiveColor}
58
- key={item}
59
- p={moderateScale(2)}
60
- px={moderateScale(3)}
61
- onPress={() => {
62
- if (item !== currentActiveBtn) {
63
- onPress(item);
64
- }
65
- }}
66
- {...buttonStyle}
67
- >
68
- <Typography
69
- color={item === currentActiveBtn ? inActiveColor : activeColor}
70
- {...buttonTextStyle}
71
- >
72
- {item}
73
- </Typography>
74
- </Touchable>
75
- ))}
76
- </Container>
77
- );
78
-
79
- ButtonGroup.defaultProps = {
80
- activeColor: "background.grey600",
81
- inActiveColor: "background.white",
82
- wrapperStyle: {},
83
- buttonTextStyle: { ellipsizeMode: "tail", numberOfLines: 1 },
84
- buttonStyle: {},
85
- };
86
-
87
- ButtonGroup.propTypes = {
88
- /**
89
- * Sets active color to the selected button in buttonGroup.
90
- */
91
- activeColor: PropTypes.string,
92
- /**
93
- * Sets inActive color to the unselected button in buttonGroup.
94
- */
95
- inActiveColor: PropTypes.string,
96
- /**
97
- * Returns the current selected item on button press.
98
- */
99
- onPress: PropTypes.func.isRequired,
100
- /**
101
- * Array of button text.
102
- */
103
- buttonItems: PropTypes.array.isRequired,
104
- /**
105
- * Sets current active button.
106
- */
107
- currentActiveBtn: PropTypes.string.isRequired,
108
- /**
109
- * Styling for main container.
110
- */
111
- wrapperStyle: PropTypes.object,
112
- /**
113
- * Styling for button text.
114
- */
115
- buttonTextStyle: PropTypes.object,
116
- /**
117
- * Styling for button.
118
- */
119
- buttonStyle: PropTypes.object,
120
- };
@@ -1,128 +0,0 @@
1
- import React, { useContext } from "react";
2
-
3
- import dayjs from "dayjs";
4
- import PropTypes from "prop-types";
5
- import { Calendar as RNCalender } from "react-native-calendars";
6
- import { moderateScale } from "react-native-size-matters";
7
- import { ThemeContext } from "styled-components/native";
8
-
9
- /**
10
- *
11
- * Calendar component built on top of [react-native-calendars](https://github.com/wix/react-native-calendars) with our custom theme.
12
- *
13
- * <div class="screenshots">
14
- * <img src="screenshots/calendar/calendar.png" />
15
- * </div>
16
- *
17
- * ## Usage
18
- * ```js
19
- * import * as React from 'react';
20
- * import dayjs from "dayjs";
21
- * import { Calendar } from '@bigbinary/neetoui-rn';
22
- *
23
- * export default function Main() {
24
- * const [selectedDate, setSelectedDate] = useState(dayjs());
25
- * return (
26
- * <Calendar
27
- * selectedDate={selectedDate}
28
- * onDayPress={({ dateString }) => setSelectedDate(dateString)}
29
- * />
30
- * );
31
- * }
32
- * ```
33
- *
34
- * Checkout <a href=" https://www.npmjs.com/package/react-native-calendars">react-native-calendars</a> package for all the available props
35
- */
36
-
37
- export const Calendar = ({ selectedDate, ...rest }) => {
38
- delete rest.markedDates;
39
- const theme = useContext(ThemeContext);
40
- const isCurrentDay = dayjs(selectedDate).isSame(dayjs(), "D");
41
-
42
- return (
43
- <RNCalender
44
- current={selectedDate}
45
- firstDay={1}
46
- key={selectedDate}
47
- markedDates={{
48
- [dayjs(selectedDate).format("YYYY-MM-DD")]: {
49
- selected: true,
50
- },
51
- }}
52
- theme={{
53
- arrowColor: theme.colors.font.primary,
54
- dotStyle: {
55
- height: 0,
56
- width: 0,
57
- marginTop: 0,
58
- },
59
- "stylesheet.calendar.header": {
60
- week: {
61
- marginVertical: moderateScale(10),
62
- flexDirection: "row",
63
- justifyContent: "space-around",
64
- alignItems: "center",
65
- fontFamily: theme.fonts.sf600,
66
- },
67
- dayHeader: {
68
- flex: 1,
69
- textAlign: "center",
70
- fontFamily: theme.fonts.sf600,
71
- fontSize: theme.fontSizes.xs,
72
- color: theme.colors.font.grey500,
73
- textTransform: "uppercase",
74
- },
75
- monthText: {
76
- fontFamily: theme.fonts.sf400,
77
- fontSize: theme.fontSizes.l,
78
- color: theme.colors.font.primary,
79
- },
80
- },
81
- "stylesheet.day.basic": {
82
- base: {
83
- alignItems: "center",
84
- justifyContent: "center",
85
- height: moderateScale(26),
86
- width: moderateScale(26),
87
- borderRadius: moderateScale(5),
88
- borderWidth: moderateScale(1),
89
- borderColor: "transparent",
90
- },
91
- today: {
92
- borderColor: isCurrentDay
93
- ? "transparent"
94
- : theme.colors.border.base,
95
- },
96
- selected: {
97
- backgroundColor: theme.colors.background.purple100,
98
- },
99
- text: {
100
- fontFamily: theme.fonts.sf400,
101
- fontSize: theme.fontSizes.xs,
102
- color: theme.colors.font.primary,
103
- margin: 0,
104
- padding: 0,
105
- },
106
- todayText: {
107
- color: theme.colors.font.base,
108
- },
109
- selectedText: {
110
- fontFamily: theme.fonts.sf600,
111
- color: theme.colors.font.base,
112
- },
113
- disabledText: {
114
- color: theme.colors.font.grey400,
115
- },
116
- },
117
- }}
118
- {...rest}
119
- />
120
- );
121
- };
122
-
123
- Calendar.propTypes = {
124
- selectedDate: PropTypes.oneOfType([
125
- PropTypes.string,
126
- PropTypes.instanceOf(dayjs),
127
- ]),
128
- };
@@ -1,90 +0,0 @@
1
- import * as React from "react";
2
- import { StyleSheet, TouchableOpacity } from "react-native";
3
-
4
- import PropTypes from "prop-types";
5
- import { moderateScale } from "react-native-size-matters";
6
- import styled from "styled-components/native";
7
- import { flexbox, space, border, color, layout } from "styled-system";
8
-
9
- import { theme } from "@theme";
10
-
11
- import { getShadowStyles } from "../utils/utils";
12
-
13
- const StyledTouchableOpacity = styled(TouchableOpacity)`
14
- ${flexbox}
15
- ${space}
16
- ${border}
17
- ${color}
18
- ${layout}
19
- `;
20
-
21
- /**
22
- * This component is wrapper over Container component.
23
- * This component supports below props categories from [styled-system ](/styled-system).
24
- *
25
- *
26
- * <ul>
27
- * <li>flexbox</li>
28
- * <li>space</li>
29
- * <li>border</li>
30
- * <li>color</li>
31
- * <li>layout</li>
32
- * </ul>
33
- *
34
- * <div class="screenshots">
35
- * <img src="screenshots/card/shadows.png" />
36
- * </div>
37
- *
38
- * ## Usage
39
- * ```js
40
- * import * as React from 'react';
41
- * import { Card, Typography } from '@bigbinary/neetoui-rn';
42
- *
43
- * export default function Main() {
44
- * return (
45
- * <Card height="100px" width="100px" bg="background.danger" elevation={moderateScale(8)}>
46
- * <Typography fontSize="14px">Card</Typography>
47
- * </Card>
48
- * );
49
- * }
50
- * ```
51
- *
52
- */
53
-
54
- export const Card = ({ children, elevation, ...rest }) => {
55
- const shadowStyles = elevation ? getShadowStyles(elevation) : {};
56
-
57
- const cardStyles = { ...styles.defaultShadows, ...shadowStyles };
58
-
59
- return (
60
- <StyledTouchableOpacity
61
- activeOpacity={rest.onPress ? 0.2 : 1}
62
- style={cardStyles}
63
- {...rest}
64
- >
65
- {children}
66
- </StyledTouchableOpacity>
67
- );
68
- };
69
-
70
- Card.propTypes = {
71
- /**
72
- * To change the shadow styles based on elevation.
73
- * Valid elevation values (0-21).
74
- */
75
- elevation: PropTypes.number,
76
- children: PropTypes.node,
77
- };
78
-
79
- export const styles = StyleSheet.create({
80
- defaultShadows: {
81
- shadowColor: theme.colors.background.grey800,
82
- shadowOffset: {
83
- width: 0,
84
- height: moderateScale(2),
85
- },
86
- shadowOpacity: 0.25,
87
- shadowRadius: moderateScale(3.84),
88
- elevation: 5,
89
- },
90
- });