@bigbinary/neetoui-rn 0.0.229 → 0.0.231
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/README.md +7 -1
- 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/Divider.js +1 -1
- package/lib/components/FAB.js +1 -1
- package/lib/components/FlashList.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/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/theme/index.js +1 -1
- package/lib/utils/utils.js +1 -1
- package/package.json +2 -1
- package/src/components/Accordion.jsx +9 -9
- package/src/components/Alert.jsx +20 -17
- package/src/components/AnimatedImage.jsx +11 -5
- package/src/components/Avatar.jsx +5 -4
- package/src/components/Badge.jsx +6 -5
- package/src/components/BottomSheet.jsx +18 -13
- package/src/components/BottomTabBar.jsx +63 -51
- package/src/components/Button.jsx +17 -16
- package/src/components/ButtonGroup.jsx +5 -4
- package/src/components/Calendar.jsx +7 -6
- package/src/components/Card.jsx +4 -3
- package/src/components/Carousel.jsx +17 -15
- package/src/components/CheckBox.jsx +11 -9
- package/src/components/Chip.jsx +6 -5
- package/src/components/Divider.jsx +3 -2
- package/src/components/FAB.jsx +5 -4
- package/src/components/FlashList.jsx +12 -5
- package/src/components/Input.jsx +22 -28
- package/src/components/ListItem.jsx +5 -4
- package/src/components/Loader.jsx +4 -3
- package/src/components/MultiSelect.jsx +33 -25
- package/src/components/NotificationPreferenceList.jsx +12 -7
- package/src/components/OnBoarding.jsx +28 -8
- package/src/components/OrganizationItem.jsx +4 -3
- package/src/components/OtpInputs.jsx +11 -6
- package/src/components/ParentView.jsx +4 -3
- package/src/components/Popover.jsx +10 -9
- package/src/components/RadioButton.jsx +11 -9
- package/src/components/RichTextEditor.jsx +1 -0
- package/src/components/SearchBar.jsx +8 -7
- package/src/components/SegmentedTopBar.jsx +12 -11
- package/src/components/Select.jsx +31 -27
- package/src/components/SocialButton.jsx +6 -5
- package/src/components/Toast.jsx +20 -17
- package/src/components/ToggleSwitch.jsx +13 -10
- package/src/components/TopBar.jsx +7 -6
- package/src/components/Touchable.jsx +1 -1
- package/src/theme/index.js +15 -12
- package/src/utils/utils.js +4 -0
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React, { useContext } from "react";
|
|
2
2
|
|
|
3
3
|
import Proptypes from "prop-types";
|
|
4
|
+
import { moderateScale } from "react-native-size-matters";
|
|
4
5
|
import { ThemeContext } from "styled-components/native";
|
|
5
6
|
|
|
6
7
|
import { Container, Typography, Touchable } from "@components";
|
|
@@ -24,6 +25,7 @@ import { Container, Typography, Touchable } from "@components";
|
|
|
24
25
|
* ## Usage
|
|
25
26
|
* ```js
|
|
26
27
|
* import * as React from "react";
|
|
28
|
+
* import { moderateScale } from "react-native-size-matters";
|
|
27
29
|
* import { Container, RadioButton } from "@bigbinary/neetoui-rn";
|
|
28
30
|
*
|
|
29
31
|
* export default function Main() {
|
|
@@ -33,18 +35,18 @@ import { Container, Typography, Touchable } from "@components";
|
|
|
33
35
|
* return (
|
|
34
36
|
* <Container>
|
|
35
37
|
* <RadioButton
|
|
36
|
-
* mt={2}
|
|
38
|
+
* mt={moderateScale(2)}
|
|
37
39
|
* selected={selected1}
|
|
38
40
|
* onSelect={() => setSelected1(prev => !prev)}
|
|
39
41
|
* label={`Radio button marked as ${!selected1 ? "un" : ""}selected`}
|
|
40
42
|
* />
|
|
41
43
|
* <RadioButton
|
|
42
|
-
* mt={3}
|
|
44
|
+
* mt={moderateScale(3)}
|
|
43
45
|
* selected={selected2}
|
|
44
46
|
* onSelect={() => setSelected2(prev => !prev)}
|
|
45
47
|
* label={`Radio button marked as ${!selected2 ? "un" : ""}selected`}
|
|
46
48
|
* />
|
|
47
|
-
* <RadioButton mt={3} disabled label="Disabled Radio button" />
|
|
49
|
+
* <RadioButton mt={moderateScale(3)} disabled label="Disabled Radio button" />
|
|
48
50
|
* </Container>
|
|
49
51
|
* );
|
|
50
52
|
* }
|
|
@@ -70,7 +72,7 @@ export const RadioButton = ({
|
|
|
70
72
|
};
|
|
71
73
|
|
|
72
74
|
const selectedProps = {
|
|
73
|
-
borderWidth: 4,
|
|
75
|
+
borderWidth: moderateScale(4),
|
|
74
76
|
borderColor: theme.colors.background.base,
|
|
75
77
|
labelProps: {
|
|
76
78
|
fontFamily: theme.fonts.sf500,
|
|
@@ -79,7 +81,7 @@ export const RadioButton = ({
|
|
|
79
81
|
};
|
|
80
82
|
|
|
81
83
|
const unselectedProps = {
|
|
82
|
-
borderWidth: 2,
|
|
84
|
+
borderWidth: moderateScale(2),
|
|
83
85
|
borderColor: theme.colors.border.secondary,
|
|
84
86
|
labelProps: {
|
|
85
87
|
fontFamily: theme.fonts.sf400,
|
|
@@ -97,9 +99,9 @@ export const RadioButton = ({
|
|
|
97
99
|
>
|
|
98
100
|
<Container
|
|
99
101
|
bg={theme.colors.background.white}
|
|
100
|
-
borderRadius={8}
|
|
101
|
-
height={16}
|
|
102
|
-
width={16}
|
|
102
|
+
borderRadius={moderateScale(8)}
|
|
103
|
+
height={moderateScale(16)}
|
|
104
|
+
width={moderateScale(16)}
|
|
103
105
|
{...(selected && selectedProps)}
|
|
104
106
|
{...(!selected && unselectedProps)}
|
|
105
107
|
{...(disabled && disabledProps)}
|
|
@@ -108,7 +110,7 @@ export const RadioButton = ({
|
|
|
108
110
|
<Typography
|
|
109
111
|
flex={1}
|
|
110
112
|
fontSize="m"
|
|
111
|
-
ml={
|
|
113
|
+
ml={moderateScale(8)}
|
|
112
114
|
{...(selected && selectedProps.labelProps)}
|
|
113
115
|
{...(!selected && unselectedProps.labelProps)}
|
|
114
116
|
{...(disabled && disabledProps.labelProps)}
|
|
@@ -35,6 +35,7 @@ export const ScrollView = styled.ScrollView.attrs(() => ({
|
|
|
35
35
|
* ## Usage
|
|
36
36
|
* ```js
|
|
37
37
|
* import * as React from "react";
|
|
38
|
+
* import { moderateScale } from "react-native-size-matters";
|
|
38
39
|
* import { Container, RichTextEditor, theme } from "@bigbinary/neetoui-rn";
|
|
39
40
|
*
|
|
40
41
|
* export default function Main() {
|
|
@@ -3,6 +3,7 @@ import { Animated, TouchableWithoutFeedback } from "react-native";
|
|
|
3
3
|
|
|
4
4
|
import PropTypes from "prop-types";
|
|
5
5
|
import Icon from "react-native-remix-icon";
|
|
6
|
+
import { moderateScale } from "react-native-size-matters";
|
|
6
7
|
import styled from "styled-components/native";
|
|
7
8
|
import {
|
|
8
9
|
flexbox,
|
|
@@ -109,25 +110,25 @@ export const SearchBar = ({
|
|
|
109
110
|
<Container
|
|
110
111
|
alignItems="center"
|
|
111
112
|
borderColor={theme.colors.border.grey400}
|
|
112
|
-
borderRadius={8}
|
|
113
|
-
borderWidth={1}
|
|
113
|
+
borderRadius={moderateScale(8)}
|
|
114
|
+
borderWidth={moderateScale(1)}
|
|
114
115
|
flex={1}
|
|
115
116
|
flexDirection="row"
|
|
116
|
-
height={42}
|
|
117
|
+
height={moderateScale(42)}
|
|
117
118
|
{...containerProps}
|
|
118
119
|
>
|
|
119
|
-
<Container px={10}>
|
|
120
|
+
<Container px={moderateScale(10)}>
|
|
120
121
|
<Icon
|
|
121
122
|
color={theme.colors.font.grey600}
|
|
122
123
|
name="ri-search-line"
|
|
123
|
-
size={20}
|
|
124
|
+
size={moderateScale(20)}
|
|
124
125
|
/>
|
|
125
126
|
</Container>
|
|
126
127
|
<TextInput
|
|
127
128
|
autoCapitalize="none"
|
|
128
129
|
color="font.primary"
|
|
129
130
|
flex={1}
|
|
130
|
-
fontSize={16}
|
|
131
|
+
fontSize={moderateScale(16)}
|
|
131
132
|
placeholder={placeholder}
|
|
132
133
|
placeholderTextColor={theme.colors.font.grey600}
|
|
133
134
|
ref={inputRef}
|
|
@@ -154,7 +155,7 @@ export const SearchBar = ({
|
|
|
154
155
|
}}
|
|
155
156
|
>
|
|
156
157
|
<Button
|
|
157
|
-
height={20}
|
|
158
|
+
height={moderateScale(20)}
|
|
158
159
|
label="Cancel"
|
|
159
160
|
labelStyle={{ mx: 0 }}
|
|
160
161
|
variant="text"
|
|
@@ -7,6 +7,7 @@ import Animated, {
|
|
|
7
7
|
useSharedValue,
|
|
8
8
|
withSpring,
|
|
9
9
|
} from "react-native-reanimated";
|
|
10
|
+
import { moderateScale } from "react-native-size-matters";
|
|
10
11
|
|
|
11
12
|
import { Typography, Touchable } from "@components";
|
|
12
13
|
import { theme } from "@theme";
|
|
@@ -15,10 +16,10 @@ const defaultShadowStyle = {
|
|
|
15
16
|
shadowColor: theme.colors.background.grey800,
|
|
16
17
|
shadowOffset: {
|
|
17
18
|
width: 0,
|
|
18
|
-
height: 2,
|
|
19
|
+
height: moderateScale(2),
|
|
19
20
|
},
|
|
20
21
|
shadowOpacity: 0.23,
|
|
21
|
-
shadowRadius: 2.62,
|
|
22
|
+
shadowRadius: moderateScale(2.62),
|
|
22
23
|
elevation: 4,
|
|
23
24
|
};
|
|
24
25
|
|
|
@@ -33,7 +34,7 @@ const DEFAULT_SPRING_CONFIG = {
|
|
|
33
34
|
};
|
|
34
35
|
|
|
35
36
|
// So that it stretches in landscape mode.
|
|
36
|
-
const width = Dimensions.get("screen").width - 32;
|
|
37
|
+
const width = Dimensions.get("screen").width - moderateScale(32);
|
|
37
38
|
|
|
38
39
|
/**
|
|
39
40
|
*
|
|
@@ -109,7 +110,7 @@ export const SegmentedTopBar = ({
|
|
|
109
110
|
defaultShadowStyle,
|
|
110
111
|
StyleSheet.absoluteFill,
|
|
111
112
|
{
|
|
112
|
-
width: (width - 4) / routes?.length,
|
|
113
|
+
width: (width - moderateScale(4)) / routes?.length,
|
|
113
114
|
},
|
|
114
115
|
tabTranslateAnimatedStyles,
|
|
115
116
|
]}
|
|
@@ -156,7 +157,7 @@ const styles = StyleSheet.create({
|
|
|
156
157
|
display: "flex",
|
|
157
158
|
flexDirection: "row",
|
|
158
159
|
alignItems: "center",
|
|
159
|
-
borderRadius: 8,
|
|
160
|
+
borderRadius: moderateScale(8),
|
|
160
161
|
width,
|
|
161
162
|
},
|
|
162
163
|
defaultSegmentedControlWrapper: {
|
|
@@ -164,16 +165,16 @@ const styles = StyleSheet.create({
|
|
|
164
165
|
display: "flex",
|
|
165
166
|
flexDirection: "row",
|
|
166
167
|
alignItems: "center",
|
|
167
|
-
borderRadius: 8,
|
|
168
|
+
borderRadius: moderateScale(8),
|
|
168
169
|
backgroundColor: "#F6F6FA",
|
|
169
170
|
width,
|
|
170
|
-
marginBottom: 5,
|
|
171
|
+
marginBottom: moderateScale(5),
|
|
171
172
|
},
|
|
172
173
|
movingSegmentStyle: {
|
|
173
174
|
top: 0,
|
|
174
|
-
marginVertical: 2,
|
|
175
|
-
marginHorizontal: 2,
|
|
176
|
-
borderRadius: 6,
|
|
175
|
+
marginVertical: moderateScale(2),
|
|
176
|
+
marginHorizontal: moderateScale(2),
|
|
177
|
+
borderRadius: moderateScale(6),
|
|
177
178
|
backgroundColor: "#FFFFFF",
|
|
178
179
|
},
|
|
179
180
|
});
|
|
@@ -206,5 +207,5 @@ SegmentedTopBar.propTypes = {
|
|
|
206
207
|
|
|
207
208
|
SegmentedTopBar.defaultProps = {
|
|
208
209
|
tabs: [],
|
|
209
|
-
height: 32,
|
|
210
|
+
height: moderateScale(32),
|
|
210
211
|
};
|
|
@@ -11,6 +11,7 @@ import Animated, {
|
|
|
11
11
|
runOnJS,
|
|
12
12
|
} from "react-native-reanimated";
|
|
13
13
|
import Icon from "react-native-remix-icon";
|
|
14
|
+
import { moderateScale } from "react-native-size-matters";
|
|
14
15
|
import { ThemeContext } from "styled-components/native";
|
|
15
16
|
|
|
16
17
|
import {
|
|
@@ -36,7 +37,7 @@ const DropdownItem = ({
|
|
|
36
37
|
<Container
|
|
37
38
|
bg={isSelectedItem ? "background.base" : "background.white"}
|
|
38
39
|
height={defaultDropdownItemHeight}
|
|
39
|
-
p={2}
|
|
40
|
+
p={moderateScale(2)}
|
|
40
41
|
{...itemContainerStyle}
|
|
41
42
|
{...(isSelectedItem && selectedItemContainerStyle)}
|
|
42
43
|
>
|
|
@@ -154,15 +155,18 @@ export const Select = ({
|
|
|
154
155
|
const isOptionsEmpty = !options || options?.length === 0;
|
|
155
156
|
const isSearchedOptionsEmpty =
|
|
156
157
|
searchQuery.length > 0 && filteredOptions.length === 0;
|
|
157
|
-
const emptyOptionsPlaceholderHeight = 40;
|
|
158
|
-
const emptySearchedOptionsHeight = 40;
|
|
159
|
-
const searchInputHeight = 35;
|
|
160
|
-
const defaultDropdownItemHeight =
|
|
158
|
+
const emptyOptionsPlaceholderHeight = moderateScale(40);
|
|
159
|
+
const emptySearchedOptionsHeight = moderateScale(40);
|
|
160
|
+
const searchInputHeight = moderateScale(35);
|
|
161
|
+
const defaultDropdownItemHeight =
|
|
162
|
+
itemContainerStyle?.height || moderateScale(32);
|
|
163
|
+
|
|
161
164
|
const dropdownHeight =
|
|
162
165
|
dropdownContainerStyle?.height ||
|
|
163
166
|
dropdownContainerStyle?.maxHeight ||
|
|
164
|
-
defaultDropdownItemHeight *
|
|
165
|
-
(
|
|
167
|
+
defaultDropdownItemHeight *
|
|
168
|
+
Math.min(filteredOptions?.length, moderateScale(6)) +
|
|
169
|
+
(isSearchable ? searchInputHeight + moderateScale(10) : 0) +
|
|
166
170
|
(isOptionsEmpty && !(isSearchedOptionsEmpty && showCreateOption)
|
|
167
171
|
? emptyOptionsPlaceholderHeight
|
|
168
172
|
: 0) +
|
|
@@ -224,7 +228,7 @@ export const Select = ({
|
|
|
224
228
|
color="font.base"
|
|
225
229
|
fontFamily="sf400"
|
|
226
230
|
fontSize="s"
|
|
227
|
-
mb={1}
|
|
231
|
+
mb={moderateScale(1)}
|
|
228
232
|
{...labelStyle}
|
|
229
233
|
>
|
|
230
234
|
{label}
|
|
@@ -236,10 +240,10 @@ export const Select = ({
|
|
|
236
240
|
<Container
|
|
237
241
|
alignItems="center"
|
|
238
242
|
borderColor="border.grey400"
|
|
239
|
-
borderWidth={1}
|
|
243
|
+
borderWidth={moderateScale(1)}
|
|
240
244
|
flexDirection="row"
|
|
241
245
|
justifyContent="space-between"
|
|
242
|
-
p={2}
|
|
246
|
+
p={moderateScale(2)}
|
|
243
247
|
{...inputContainerStyle}
|
|
244
248
|
{...rest}
|
|
245
249
|
>
|
|
@@ -252,7 +256,7 @@ export const Select = ({
|
|
|
252
256
|
<Icon
|
|
253
257
|
color="grey"
|
|
254
258
|
name={`arrow-${showDropdown ? "up" : "down"}-s-line`}
|
|
255
|
-
size=
|
|
259
|
+
size={moderateScale(20)}
|
|
256
260
|
/>
|
|
257
261
|
)}
|
|
258
262
|
</Container>
|
|
@@ -263,12 +267,12 @@ export const Select = ({
|
|
|
263
267
|
<Card
|
|
264
268
|
bg="background.white"
|
|
265
269
|
borderColor="border.grey400"
|
|
266
|
-
borderWidth={1}
|
|
270
|
+
borderWidth={moderateScale(1)}
|
|
267
271
|
maxHeight={dropdownHeight}
|
|
268
272
|
{...dropdownContainerStyle}
|
|
269
273
|
>
|
|
270
274
|
{isSearchable && (
|
|
271
|
-
<Container p={1} {...searchInputContainerStyle}>
|
|
275
|
+
<Container p={moderateScale(1)} {...searchInputContainerStyle}>
|
|
272
276
|
<Input
|
|
273
277
|
fontSize="s"
|
|
274
278
|
placeholder="Search"
|
|
@@ -417,59 +421,59 @@ Select.propTypes = {
|
|
|
417
421
|
*/
|
|
418
422
|
onPressCreateOption: PropTypes.func,
|
|
419
423
|
/**
|
|
420
|
-
* To
|
|
424
|
+
* To customize floating label styles.
|
|
421
425
|
*/
|
|
422
426
|
labelStyle: PropTypes.object,
|
|
423
427
|
/**
|
|
424
|
-
* To
|
|
428
|
+
* To customize outermost container style.
|
|
425
429
|
*/
|
|
426
430
|
containerStyle: PropTypes.object,
|
|
427
431
|
/**
|
|
428
|
-
* To
|
|
432
|
+
* To customize Select input container styles.
|
|
429
433
|
*/
|
|
430
434
|
inputContainerStyle: PropTypes.object,
|
|
431
435
|
/**
|
|
432
|
-
* To
|
|
436
|
+
* To customize dropdown container styles.
|
|
433
437
|
*/
|
|
434
438
|
dropdownContainerStyle: PropTypes.object,
|
|
435
439
|
/**
|
|
436
|
-
* To
|
|
440
|
+
* To customize dropdown item container styles.
|
|
437
441
|
*/
|
|
438
442
|
itemContainerStyle: PropTypes.object,
|
|
439
443
|
/**
|
|
440
|
-
* To
|
|
444
|
+
* To customize dropdown item text styles.
|
|
441
445
|
*/
|
|
442
446
|
itemLabelStyle: PropTypes.object,
|
|
443
447
|
/**
|
|
444
|
-
* To
|
|
448
|
+
* To customize dropdown item container styles for selected item.
|
|
445
449
|
*/
|
|
446
450
|
selectedItemContainerStyle: PropTypes.object,
|
|
447
451
|
/**
|
|
448
|
-
* To
|
|
452
|
+
* To customize dropdown item text styles for selected item.
|
|
449
453
|
*/
|
|
450
454
|
selectedItemLabelStyle: PropTypes.object,
|
|
451
455
|
/**
|
|
452
|
-
* To
|
|
456
|
+
* To customize search input containerr style.
|
|
453
457
|
*/
|
|
454
458
|
searchInputContainerStyle: PropTypes.object,
|
|
455
459
|
/**
|
|
456
|
-
* To
|
|
460
|
+
* To customize search input style.
|
|
457
461
|
*/
|
|
458
462
|
searchInputStyle: PropTypes.object,
|
|
459
463
|
/**
|
|
460
|
-
* To
|
|
464
|
+
* To customize empty options placeholder container style.
|
|
461
465
|
*/
|
|
462
466
|
emptyOptionsContainerStyle: PropTypes.object,
|
|
463
467
|
/**
|
|
464
|
-
* To
|
|
468
|
+
* To customize empty options placeholder text style.
|
|
465
469
|
*/
|
|
466
470
|
emptyOptionsLabelStyle: PropTypes.object,
|
|
467
471
|
/**
|
|
468
|
-
* To
|
|
472
|
+
* To customize empty options placeholder container style.
|
|
469
473
|
*/
|
|
470
474
|
createSearchedOptionContainerStyle: PropTypes.object,
|
|
471
475
|
/**
|
|
472
|
-
* To
|
|
476
|
+
* To customize empty options placeholder text style.
|
|
473
477
|
*/
|
|
474
478
|
createSearchedOptionLabelStyle: PropTypes.object,
|
|
475
479
|
};
|
|
@@ -2,6 +2,7 @@ import React, { useContext } from "react";
|
|
|
2
2
|
|
|
3
3
|
import propTypes from "@styled-system/prop-types";
|
|
4
4
|
import PropTypes from "prop-types";
|
|
5
|
+
import { moderateScale } from "react-native-size-matters";
|
|
5
6
|
import { ThemeContext } from "styled-components/native";
|
|
6
7
|
|
|
7
8
|
import AppleLogo from "@assets/icons/apple-logo.svg";
|
|
@@ -24,7 +25,7 @@ import { Container, Typography, Touchable, Loader } from "@components";
|
|
|
24
25
|
* export default function Main() {
|
|
25
26
|
* return (
|
|
26
27
|
* <Container>
|
|
27
|
-
* <SocialButton variant="apple" my={9} />
|
|
28
|
+
* <SocialButton variant="apple" my={moderateScale(9)} />
|
|
28
29
|
* <SocialButton variant="google" />
|
|
29
30
|
* </Container>
|
|
30
31
|
* );
|
|
@@ -48,10 +49,10 @@ export const SocialButton = ({
|
|
|
48
49
|
alignItems="center"
|
|
49
50
|
bg="transparent"
|
|
50
51
|
borderColor={theme.colors.border.grey800}
|
|
51
|
-
borderRadius={8}
|
|
52
|
-
borderWidth={1}
|
|
52
|
+
borderRadius={moderateScale(8)}
|
|
53
|
+
borderWidth={moderateScale(1)}
|
|
53
54
|
disabled={disabled}
|
|
54
|
-
height={48}
|
|
55
|
+
height={moderateScale(48)}
|
|
55
56
|
justifyContent="center"
|
|
56
57
|
rippleColor={theme.colors.background.grey800}
|
|
57
58
|
width="100%"
|
|
@@ -61,7 +62,7 @@ export const SocialButton = ({
|
|
|
61
62
|
<Loader color={theme.colors.background.grey800} />
|
|
62
63
|
) : (
|
|
63
64
|
<>
|
|
64
|
-
<Container left={17} position="absolute">
|
|
65
|
+
<Container left={moderateScale(17)} position="absolute">
|
|
65
66
|
{variant === "apple" && <AppleLogo />}
|
|
66
67
|
{variant === "google" && <GoogleLogo />}
|
|
67
68
|
</Container>
|
package/src/components/Toast.jsx
CHANGED
|
@@ -5,6 +5,7 @@ import { useWindowDimensions } from "react-native";
|
|
|
5
5
|
import PropTypes from "prop-types";
|
|
6
6
|
import DeviceInfo from "react-native-device-info";
|
|
7
7
|
import CloseIcon from "react-native-remix-icon";
|
|
8
|
+
import { moderateScale } from "react-native-size-matters";
|
|
8
9
|
import T from "react-native-toast-message";
|
|
9
10
|
import { ThemeContext } from "styled-components/native";
|
|
10
11
|
|
|
@@ -12,7 +13,7 @@ import ErrorIcon from "@assets/icons/error.svg";
|
|
|
12
13
|
import InfoIcon from "@assets/icons/info.svg";
|
|
13
14
|
import SuccessIcon from "@assets/icons/success.svg";
|
|
14
15
|
import WarningIcon from "@assets/icons/warning.svg";
|
|
15
|
-
import { Container, Typography, Touchable } from "@components";
|
|
16
|
+
import { Container, Typography, Card, Touchable } from "@components";
|
|
16
17
|
import { defaultToasterConfig } from "@config";
|
|
17
18
|
|
|
18
19
|
const ToastComponent = ({ type, text1, text2, hide }) => {
|
|
@@ -34,28 +35,29 @@ const ToastComponent = ({ type, text1, text2, hide }) => {
|
|
|
34
35
|
};
|
|
35
36
|
|
|
36
37
|
return (
|
|
37
|
-
<
|
|
38
|
+
<Card
|
|
38
39
|
alignItems="center"
|
|
39
40
|
bg={theme.colors.background.secondary}
|
|
40
|
-
borderRadius={16}
|
|
41
|
+
borderRadius={moderateScale(16)}
|
|
42
|
+
elevation={10}
|
|
41
43
|
flexDirection="row"
|
|
42
|
-
minHeight={60}
|
|
43
|
-
mt={DeviceInfo.hasDynamicIsland() ? 10 : 0}
|
|
44
|
-
mx={10}
|
|
45
|
-
px={10}
|
|
46
|
-
width={width - 20}
|
|
44
|
+
minHeight={moderateScale(60)}
|
|
45
|
+
mt={DeviceInfo.hasDynamicIsland() ? moderateScale(10) : 0}
|
|
46
|
+
mx={moderateScale(10)}
|
|
47
|
+
px={moderateScale(10)}
|
|
48
|
+
width={width - moderateScale(20)}
|
|
47
49
|
>
|
|
48
50
|
<Container
|
|
49
51
|
alignItems="center"
|
|
50
52
|
bg={theme.colors.toast[type]}
|
|
51
|
-
borderRadius={10}
|
|
52
|
-
height={42}
|
|
53
|
+
borderRadius={moderateScale(10)}
|
|
54
|
+
height={moderateScale(42)}
|
|
53
55
|
justifyContent="center"
|
|
54
|
-
width={42}
|
|
56
|
+
width={moderateScale(42)}
|
|
55
57
|
>
|
|
56
58
|
<Icon />
|
|
57
59
|
</Container>
|
|
58
|
-
<Container flex={1} ml={10} py={3}>
|
|
60
|
+
<Container flex={1} ml={moderateScale(10)} py={moderateScale(3)}>
|
|
59
61
|
{text1 && (
|
|
60
62
|
<Typography
|
|
61
63
|
fontColor={theme.colors.font.primary}
|
|
@@ -77,16 +79,16 @@ const ToastComponent = ({ type, text1, text2, hide }) => {
|
|
|
77
79
|
</Container>
|
|
78
80
|
<Touchable
|
|
79
81
|
hitSlop={{
|
|
80
|
-
top: 5,
|
|
81
|
-
right: 5,
|
|
82
|
-
bottom: 5,
|
|
83
|
-
left: 5,
|
|
82
|
+
top: moderateScale(5),
|
|
83
|
+
right: moderateScale(5),
|
|
84
|
+
bottom: moderateScale(5),
|
|
85
|
+
left: moderateScale(5),
|
|
84
86
|
}}
|
|
85
87
|
onPress={hide}
|
|
86
88
|
>
|
|
87
89
|
<CloseIcon color={theme.colors.font.grey500} name="ri-close-line" />
|
|
88
90
|
</Touchable>
|
|
89
|
-
</
|
|
91
|
+
</Card>
|
|
90
92
|
);
|
|
91
93
|
};
|
|
92
94
|
|
|
@@ -122,6 +124,7 @@ ToastComponent.propTypes = {
|
|
|
122
124
|
*
|
|
123
125
|
*
|
|
124
126
|
*import * as React from "react";
|
|
127
|
+
*import { moderateScale } from "react-native-size-matters";
|
|
125
128
|
*import { Toast, Container, Button } from "@bigbinary/neetoui-rn";
|
|
126
129
|
*
|
|
127
130
|
*export default function Main() {
|
|
@@ -3,6 +3,7 @@ import { Animated } from "react-native";
|
|
|
3
3
|
|
|
4
4
|
import PropTypes from "prop-types";
|
|
5
5
|
import Icon from "react-native-remix-icon";
|
|
6
|
+
import { moderateScale } from "react-native-size-matters";
|
|
6
7
|
import { ThemeContext } from "styled-components/native";
|
|
7
8
|
|
|
8
9
|
import { Container, Touchable } from "@components";
|
|
@@ -36,7 +37,9 @@ import { Container, Touchable } from "@components";
|
|
|
36
37
|
|
|
37
38
|
export const ToggleSwitch = ({ value, onValueChange, disabled }) => {
|
|
38
39
|
const theme = useContext(ThemeContext);
|
|
39
|
-
const animatedPosition = useRef(
|
|
40
|
+
const animatedPosition = useRef(
|
|
41
|
+
new Animated.Value(value ? moderateScale(1) : 0)
|
|
42
|
+
).current;
|
|
40
43
|
|
|
41
44
|
useEffect(() => {
|
|
42
45
|
startAnimation();
|
|
@@ -44,7 +47,7 @@ export const ToggleSwitch = ({ value, onValueChange, disabled }) => {
|
|
|
44
47
|
|
|
45
48
|
const startAnimation = () => {
|
|
46
49
|
Animated.timing(animatedPosition, {
|
|
47
|
-
toValue: value ?
|
|
50
|
+
toValue: value ? moderateScale(18) : 0,
|
|
48
51
|
duration: 300,
|
|
49
52
|
useNativeDriver: false,
|
|
50
53
|
}).start();
|
|
@@ -61,28 +64,28 @@ export const ToggleSwitch = ({ value, onValueChange, disabled }) => {
|
|
|
61
64
|
return (
|
|
62
65
|
<Touchable
|
|
63
66
|
bg={containerBg}
|
|
64
|
-
borderRadius={70}
|
|
67
|
+
borderRadius={moderateScale(70)}
|
|
65
68
|
disabled={disabled}
|
|
66
|
-
height={24}
|
|
69
|
+
height={moderateScale(24)}
|
|
67
70
|
justifyContent="center"
|
|
68
71
|
opacity={disabled ? 0.5 : 1}
|
|
69
|
-
px={
|
|
70
|
-
width={44}
|
|
72
|
+
px={moderateScale(5)}
|
|
73
|
+
width={moderateScale(44)}
|
|
71
74
|
onPress={() => onValueChange(!value)}
|
|
72
75
|
>
|
|
73
76
|
<Animated.View style={{ transform: [{ translateX: animatedPosition }] }}>
|
|
74
77
|
<Container
|
|
75
78
|
alignItems="center"
|
|
76
79
|
bg="background.white"
|
|
77
|
-
borderRadius={8}
|
|
78
|
-
height={16}
|
|
80
|
+
borderRadius={moderateScale(8)}
|
|
81
|
+
height={moderateScale(16)}
|
|
79
82
|
justifyContent="center"
|
|
80
|
-
width={16}
|
|
83
|
+
width={moderateScale(16)}
|
|
81
84
|
>
|
|
82
85
|
<Icon
|
|
83
86
|
color={iconColor}
|
|
84
87
|
name={`ri-${value ? "check" : "close"}-line`}
|
|
85
|
-
size={12}
|
|
88
|
+
size={moderateScale(12)}
|
|
86
89
|
/>
|
|
87
90
|
</Container>
|
|
88
91
|
</Animated.View>
|
|
@@ -2,6 +2,7 @@ import React, { useEffect, useState } from "react";
|
|
|
2
2
|
import { ScrollView, StyleSheet } from "react-native";
|
|
3
3
|
|
|
4
4
|
import PropTypes from "prop-types";
|
|
5
|
+
import { moderateScale } from "react-native-size-matters";
|
|
5
6
|
|
|
6
7
|
import { Container, Touchable, Typography } from "@components";
|
|
7
8
|
import { theme } from "@theme";
|
|
@@ -67,7 +68,7 @@ export const TopBar = ({
|
|
|
67
68
|
|
|
68
69
|
return (
|
|
69
70
|
<Container
|
|
70
|
-
height={50}
|
|
71
|
+
height={moderateScale(50)}
|
|
71
72
|
style={[styles.defaultTabContainerStyle, tabContainerStyle]}
|
|
72
73
|
>
|
|
73
74
|
<ScrollView horizontal showsHorizontalScrollIndicator={false}>
|
|
@@ -114,14 +115,14 @@ export const TopBar = ({
|
|
|
114
115
|
const styles = StyleSheet.create({
|
|
115
116
|
defaultActiveContainerStyle: {
|
|
116
117
|
backgroundColor: theme.colors.background.grey800,
|
|
117
|
-
marginHorizontal: 10,
|
|
118
|
-
paddingHorizontal: 10,
|
|
119
|
-
marginVertical: 5,
|
|
120
|
-
borderRadius: 5,
|
|
118
|
+
marginHorizontal: moderateScale(10),
|
|
119
|
+
paddingHorizontal: moderateScale(10),
|
|
120
|
+
marginVertical: moderateScale(5),
|
|
121
|
+
borderRadius: moderateScale(5),
|
|
121
122
|
},
|
|
122
123
|
defaultInActiveTabContainerStyle: {
|
|
123
124
|
backgroundColor: theme.colors.background.white,
|
|
124
|
-
marginHorizontal: 20,
|
|
125
|
+
marginHorizontal: moderateScale(20),
|
|
125
126
|
},
|
|
126
127
|
defaultActiveTabTextStyle: {
|
|
127
128
|
color: theme.colors.font.white,
|
|
@@ -50,7 +50,7 @@ const StyledRipple = styled(Ripple)`
|
|
|
50
50
|
* height="30px"
|
|
51
51
|
* rippleOpacity = {0.09}
|
|
52
52
|
* rippleDuration = {600}
|
|
53
|
-
* rippleContainerBorderRadius = {50}
|
|
53
|
+
* rippleContainerBorderRadius = {moderateScale(50)}
|
|
54
54
|
* >
|
|
55
55
|
* <Typography fontSize="10px">This is wrapped in Touchable component</Typography>
|
|
56
56
|
* </Touchable>
|
package/src/theme/index.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { moderateScale } from "react-native-size-matters";
|
|
2
|
+
|
|
1
3
|
const defaultColors = {
|
|
2
4
|
white: "#ffffff",
|
|
3
5
|
base: "#4557F8",
|
|
@@ -102,19 +104,20 @@ const baseTheme = {
|
|
|
102
104
|
},
|
|
103
105
|
lineHeights: [24],
|
|
104
106
|
fontSizes: {
|
|
105
|
-
"4xs": 10,
|
|
106
|
-
"3xs": 11,
|
|
107
|
-
"2xs": 12,
|
|
108
|
-
xs: 13,
|
|
109
|
-
s: 14,
|
|
110
|
-
m: 15,
|
|
111
|
-
l: 16,
|
|
112
|
-
xl: 17,
|
|
113
|
-
"2xl": 18,
|
|
114
|
-
"3xl": 20,
|
|
115
|
-
"4xl": 22,
|
|
116
|
-
"5xl": 30,
|
|
107
|
+
"4xs": moderateScale(10),
|
|
108
|
+
"3xs": moderateScale(11),
|
|
109
|
+
"2xs": moderateScale(12),
|
|
110
|
+
xs: moderateScale(13),
|
|
111
|
+
s: moderateScale(14),
|
|
112
|
+
m: moderateScale(15),
|
|
113
|
+
l: moderateScale(16),
|
|
114
|
+
xl: moderateScale(17),
|
|
115
|
+
"2xl": moderateScale(18),
|
|
116
|
+
"3xl": moderateScale(20),
|
|
117
|
+
"4xl": moderateScale(22),
|
|
118
|
+
"5xl": moderateScale(30),
|
|
117
119
|
},
|
|
120
|
+
space: new Array(100).fill(0).map((_, index) => index + 1),
|
|
118
121
|
};
|
|
119
122
|
|
|
120
123
|
//aliases
|
package/src/utils/utils.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { Platform } from "react-native";
|
|
2
|
+
|
|
1
3
|
const shadowRadiusList = [
|
|
2
4
|
1, 1.41, 2.22, 2.62, 3.84, 4.65, 4.65, 4.65, 5.46, 6.27, 6.68, 7.49, 8.3,
|
|
3
5
|
9.11, 9.51, 10.32, 11.14, 11.95, 12.35, 13.16, 13.97, 14.78, 15.19, 16,
|
|
@@ -21,3 +23,5 @@ export const getShadowStyles = (elevation = 0) => {
|
|
|
21
23
|
elevation,
|
|
22
24
|
};
|
|
23
25
|
};
|
|
26
|
+
|
|
27
|
+
export const isAndroid = () => Platform.OS === "android";
|