@servesall/atoms 1.0.55 → 1.1.0
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/dist/bundle.cjs.js +13420 -21640
- package/dist/bundle.esm.js +13388 -21614
- package/dist/bundle.umd.js +13409 -21630
- package/package.json +1 -4
- package/src/Buttons/FeedbackButton/FloatingButton.js +90 -0
- package/src/Buttons/FeedbackButton/FloatingButton.style.js +10 -0
- package/src/Buttons/FeedbackButton/index.js +120 -0
- package/src/Buttons/TextButton/LineAnimation/LineAnimation.style.js +3 -3
- package/src/Buttons/TextButton/TextButton.style.js +11 -4
- package/src/Buttons/TextButton/index.js +34 -26
- package/src/Buttons/index.js +9 -1
- package/src/Icons/Assets/index.js +4 -0
- package/src/Icons/Assets/non-visible.json +1 -0
- package/src/Icons/Assets/visible.json +1 -0
- package/src/Inputs/Animated/Animated.style.js +4 -3
- package/src/Inputs/Animated/index.js +76 -72
- package/src/Layout/Box.js +15 -0
- package/src/Layout/Layout.style.js +12 -0
- package/src/Layout/MarginRight.js +12 -0
- package/src/Layout/RoundedTopBox.js +21 -0
- package/src/Layout/index.js +6 -0
- package/src/Switch/index.js +13 -3
- package/src/Text/H5.js +30 -0
- package/src/Text/Text.style.js +9 -0
- package/src/Text/index.js +8 -7
- package/src/Theme/definitions/colors.js +6 -3
- package/src/Theme/definitions/fonts.js +1 -0
- package/src/index.js +10 -1
- package/src/.DS_Store +0 -0
- package/src/Error/.DS_Store +0 -0
- package/src/Icons/.DS_Store +0 -0
- package/src/Icons/Assets/.DS_Store +0 -0
- package/src/Success/.DS_Store +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@servesall/atoms",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "Atoms for react-native",
|
|
5
5
|
"main": "dist/bundle.cjs.js",
|
|
6
6
|
"module": "dist/bundle.esm.js",
|
|
@@ -22,10 +22,7 @@
|
|
|
22
22
|
"dependencies": {
|
|
23
23
|
"@babel/runtime": "^7.12.18",
|
|
24
24
|
"@killerwink/lottie-react-native-color": "^1.0.2",
|
|
25
|
-
"react-native-gesture-handler": "^1.10.3",
|
|
26
|
-
"react-native-reanimated": "^2.0.0",
|
|
27
25
|
"react-native-status-bar-height": "^2.6.0",
|
|
28
|
-
"react-native-web": "^0.15.0",
|
|
29
26
|
"styled-components": "^5.2.1"
|
|
30
27
|
},
|
|
31
28
|
"peerDependencies": {
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import React, { useEffect } from "react";
|
|
2
|
+
import { Dimensions } from "react-native";
|
|
3
|
+
import { ButtonStyle } from "./FloatingButton.style";
|
|
4
|
+
import Animated, {
|
|
5
|
+
useAnimatedStyle,
|
|
6
|
+
useSharedValue,
|
|
7
|
+
withTiming,
|
|
8
|
+
withSequence,
|
|
9
|
+
Easing,
|
|
10
|
+
withDelay,
|
|
11
|
+
} from "react-native-reanimated";
|
|
12
|
+
|
|
13
|
+
const RoundedBtn = ({
|
|
14
|
+
children,
|
|
15
|
+
active,
|
|
16
|
+
color,
|
|
17
|
+
onClick = () => {},
|
|
18
|
+
loading,
|
|
19
|
+
LoaderElement,
|
|
20
|
+
successElement,
|
|
21
|
+
success,
|
|
22
|
+
error,
|
|
23
|
+
errorElement,
|
|
24
|
+
leftElement = false,
|
|
25
|
+
}) => {
|
|
26
|
+
const scale = useSharedValue(1);
|
|
27
|
+
const width = useSharedValue("100%");
|
|
28
|
+
|
|
29
|
+
const animatedStyle = useAnimatedStyle(() => {
|
|
30
|
+
return {
|
|
31
|
+
opacity: scale.value,
|
|
32
|
+
transform: [
|
|
33
|
+
{
|
|
34
|
+
scale: scale.value,
|
|
35
|
+
},
|
|
36
|
+
],
|
|
37
|
+
};
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
const animatedWidth = useAnimatedStyle(() => {
|
|
41
|
+
return {
|
|
42
|
+
width: width.value,
|
|
43
|
+
};
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
useEffect(() => {
|
|
47
|
+
if (loading) {
|
|
48
|
+
width.value = withTiming(70, {
|
|
49
|
+
duration: 250,
|
|
50
|
+
});
|
|
51
|
+
} else {
|
|
52
|
+
width.value = withDelay(
|
|
53
|
+
800,
|
|
54
|
+
withTiming("100%", {
|
|
55
|
+
duration: 250,
|
|
56
|
+
})
|
|
57
|
+
);
|
|
58
|
+
}
|
|
59
|
+
}, [loading]);
|
|
60
|
+
|
|
61
|
+
return (
|
|
62
|
+
<Animated.View style={[animatedStyle, animatedWidth]}>
|
|
63
|
+
<ButtonStyle
|
|
64
|
+
active={active}
|
|
65
|
+
color={color}
|
|
66
|
+
success={success}
|
|
67
|
+
error={error}
|
|
68
|
+
onPress={() => {
|
|
69
|
+
scale.value = withSequence(
|
|
70
|
+
withTiming(0.9, {
|
|
71
|
+
duration: 80,
|
|
72
|
+
}),
|
|
73
|
+
withTiming(1, {
|
|
74
|
+
duration: 200,
|
|
75
|
+
easing: Easing.in(Easing.elastic(1.4)),
|
|
76
|
+
})
|
|
77
|
+
);
|
|
78
|
+
onClick();
|
|
79
|
+
}}
|
|
80
|
+
>
|
|
81
|
+
{success && successElement}
|
|
82
|
+
{error && errorElement}
|
|
83
|
+
{!success && !error && loading && LoaderElement}
|
|
84
|
+
{!success && !error && !loading && children}
|
|
85
|
+
</ButtonStyle>
|
|
86
|
+
</Animated.View>
|
|
87
|
+
);
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
export default RoundedBtn;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import styled from "styled-components/native";
|
|
2
|
+
import { TouchableWithoutFeedback } from "react-native-gesture-handler";
|
|
3
|
+
|
|
4
|
+
export const ButtonStyle = styled(TouchableWithoutFeedback)`
|
|
5
|
+
min-height: 60px;
|
|
6
|
+
border-radius: ${(props) => props.theme.borderRadius};
|
|
7
|
+
background-color: ${(props) =>
|
|
8
|
+
props.success || props.error ? "transparent" : props.color};
|
|
9
|
+
opacity: ${(props) => (props.active ? 1 : 0.7)};
|
|
10
|
+
`;
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import React, { useEffect } from "react";
|
|
2
|
+
import { Dimensions } from "react-native";
|
|
3
|
+
import { Center } from "../../Layout";
|
|
4
|
+
import Animated, {
|
|
5
|
+
useAnimatedStyle,
|
|
6
|
+
useSharedValue,
|
|
7
|
+
withTiming,
|
|
8
|
+
Easing,
|
|
9
|
+
} from "react-native-reanimated";
|
|
10
|
+
import FloatingButton from "./FloatingButton";
|
|
11
|
+
|
|
12
|
+
const AnimatedButton = ({
|
|
13
|
+
children,
|
|
14
|
+
active,
|
|
15
|
+
color,
|
|
16
|
+
onClick = () => {},
|
|
17
|
+
loading,
|
|
18
|
+
leftElement,
|
|
19
|
+
LoaderElement,
|
|
20
|
+
successElement,
|
|
21
|
+
success,
|
|
22
|
+
error,
|
|
23
|
+
errorElement,
|
|
24
|
+
style,
|
|
25
|
+
}) => {
|
|
26
|
+
const scale = useSharedValue(1);
|
|
27
|
+
const width = useSharedValue("100%");
|
|
28
|
+
const height = useSharedValue("100%");
|
|
29
|
+
const right = useSharedValue(0);
|
|
30
|
+
const left = useSharedValue(0);
|
|
31
|
+
|
|
32
|
+
const animatedStyle = useAnimatedStyle(() => {
|
|
33
|
+
return {
|
|
34
|
+
opacity: scale.value,
|
|
35
|
+
transform: [
|
|
36
|
+
{
|
|
37
|
+
scale: scale.value,
|
|
38
|
+
},
|
|
39
|
+
],
|
|
40
|
+
};
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
const animatedAbsolute = useAnimatedStyle(() => {
|
|
44
|
+
return {
|
|
45
|
+
minWidth: width.value,
|
|
46
|
+
height: height.value,
|
|
47
|
+
right: right.value,
|
|
48
|
+
left: left.value,
|
|
49
|
+
};
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
useEffect(() => {
|
|
53
|
+
if (loading) {
|
|
54
|
+
width.value = withTiming(Dimensions.get("window").width, {
|
|
55
|
+
duration: 250,
|
|
56
|
+
});
|
|
57
|
+
height.value = withTiming(Dimensions.get("window").height, {
|
|
58
|
+
duration: 250,
|
|
59
|
+
});
|
|
60
|
+
right.value = withTiming(0, {
|
|
61
|
+
duration: 250,
|
|
62
|
+
easing: Easing.in(Easing.elastic(2)),
|
|
63
|
+
});
|
|
64
|
+
} else {
|
|
65
|
+
setTimeout(() => {
|
|
66
|
+
width.value = withTiming("100%", {
|
|
67
|
+
duration: 200,
|
|
68
|
+
});
|
|
69
|
+
height.value = withTiming("100%", {
|
|
70
|
+
duration: 200,
|
|
71
|
+
});
|
|
72
|
+
right.value = withTiming(0, {
|
|
73
|
+
duration: 200,
|
|
74
|
+
easing: Easing.in(Easing.elastic(2)),
|
|
75
|
+
});
|
|
76
|
+
}, 600);
|
|
77
|
+
}
|
|
78
|
+
}, [loading]);
|
|
79
|
+
|
|
80
|
+
return (
|
|
81
|
+
<Animated.View
|
|
82
|
+
style={[
|
|
83
|
+
{
|
|
84
|
+
flex: 1,
|
|
85
|
+
position: "absolute",
|
|
86
|
+
height: "auto",
|
|
87
|
+
minWidth: 70,
|
|
88
|
+
zIndex: 11,
|
|
89
|
+
backgroundColor:
|
|
90
|
+
loading || success || error
|
|
91
|
+
? "rgba(255, 255, 255, 0.8)"
|
|
92
|
+
: "rgba(255, 255, 255, 0)",
|
|
93
|
+
},
|
|
94
|
+
animatedAbsolute,
|
|
95
|
+
]}
|
|
96
|
+
>
|
|
97
|
+
<Center>
|
|
98
|
+
<Animated.View style={[animatedStyle]}>
|
|
99
|
+
<FloatingButton
|
|
100
|
+
active={active}
|
|
101
|
+
color={color}
|
|
102
|
+
onClick={onClick}
|
|
103
|
+
loading={loading}
|
|
104
|
+
leftElement={leftElement}
|
|
105
|
+
LoaderElement={LoaderElement}
|
|
106
|
+
successElement={successElement}
|
|
107
|
+
errorElement={errorElement}
|
|
108
|
+
success={success}
|
|
109
|
+
error={error}
|
|
110
|
+
style={style}
|
|
111
|
+
>
|
|
112
|
+
{children}
|
|
113
|
+
</FloatingButton>
|
|
114
|
+
</Animated.View>
|
|
115
|
+
</Center>
|
|
116
|
+
</Animated.View>
|
|
117
|
+
);
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
export default AnimatedButton;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import styled from
|
|
1
|
+
import styled from "styled-components/native";
|
|
2
2
|
|
|
3
3
|
export const BorderIdle = styled.View`
|
|
4
|
-
height:
|
|
4
|
+
height: 18px;
|
|
5
5
|
background-color: ${(props) => props.color};
|
|
6
6
|
flex: 1;
|
|
7
7
|
position: absolute;
|
|
@@ -10,7 +10,7 @@ export const BorderIdle = styled.View`
|
|
|
10
10
|
`;
|
|
11
11
|
|
|
12
12
|
export const BorderActive = styled.View`
|
|
13
|
-
height:
|
|
13
|
+
height: 18px;
|
|
14
14
|
background-color: ${(props) => props.color};
|
|
15
15
|
z-index: 11;
|
|
16
16
|
`;
|
|
@@ -1,8 +1,15 @@
|
|
|
1
|
-
import styled from
|
|
1
|
+
import styled from "styled-components/native";
|
|
2
2
|
|
|
3
|
-
export const ButtonWrapper = styled.Pressable
|
|
4
|
-
`;
|
|
3
|
+
export const ButtonWrapper = styled.Pressable``;
|
|
5
4
|
|
|
6
5
|
export const BorderWrapper = styled.View`
|
|
7
|
-
height:
|
|
6
|
+
height: 18px;
|
|
7
|
+
position: absolute;
|
|
8
|
+
width: 100%;
|
|
9
|
+
bottom: 10;
|
|
10
|
+
z-index: 0;
|
|
11
|
+
`;
|
|
12
|
+
|
|
13
|
+
export const ChildWrapper = styled.View`
|
|
14
|
+
z-index: 2;
|
|
8
15
|
`;
|
|
@@ -1,32 +1,40 @@
|
|
|
1
|
-
import React, {useState, useEffect} from
|
|
2
|
-
import {ButtonWrapper, BorderWrapper} from
|
|
3
|
-
import LineAnimation from
|
|
1
|
+
import React, { useState, useEffect } from "react";
|
|
2
|
+
import { ButtonWrapper, BorderWrapper, ChildWrapper } from "./TextButton.style";
|
|
3
|
+
import LineAnimation from "./LineAnimation";
|
|
4
4
|
|
|
5
|
-
const TextBtn = ({
|
|
5
|
+
const TextBtn = ({
|
|
6
|
+
children,
|
|
7
|
+
active,
|
|
8
|
+
disabled = false,
|
|
9
|
+
borderColorActive,
|
|
10
|
+
borderColorIdle,
|
|
11
|
+
onClick = () => {},
|
|
12
|
+
style,
|
|
13
|
+
}) => {
|
|
14
|
+
const [isActive, setIsActive] = useState(active);
|
|
6
15
|
|
|
7
|
-
|
|
16
|
+
useEffect(() => {
|
|
17
|
+
setIsActive(active);
|
|
18
|
+
}, [active]);
|
|
8
19
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
</BorderWrapper>
|
|
28
|
-
</ButtonWrapper>
|
|
29
|
-
);
|
|
20
|
+
return (
|
|
21
|
+
<ButtonWrapper
|
|
22
|
+
disabled={disabled}
|
|
23
|
+
onPress={() => {
|
|
24
|
+
onClick();
|
|
25
|
+
active !== false && setIsActive(true);
|
|
26
|
+
}}
|
|
27
|
+
>
|
|
28
|
+
<ChildWrapper>{children}</ChildWrapper>
|
|
29
|
+
<BorderWrapper>
|
|
30
|
+
<LineAnimation
|
|
31
|
+
active={isActive}
|
|
32
|
+
borderColorActive={borderColorActive}
|
|
33
|
+
borderColorIdle={borderColorIdle}
|
|
34
|
+
/>
|
|
35
|
+
</BorderWrapper>
|
|
36
|
+
</ButtonWrapper>
|
|
37
|
+
);
|
|
30
38
|
};
|
|
31
39
|
|
|
32
40
|
export default TextBtn;
|
package/src/Buttons/index.js
CHANGED
|
@@ -3,5 +3,13 @@ import RoundedBtn from "./RoundedButton";
|
|
|
3
3
|
import RoundBtn from "./RoundButton";
|
|
4
4
|
import FloatingBtn from "./FloatingButton";
|
|
5
5
|
import AnimatedButton from "./AnimatedButton";
|
|
6
|
+
import FeedbackButton from "./FeedbackButton";
|
|
6
7
|
|
|
7
|
-
export {
|
|
8
|
+
export {
|
|
9
|
+
TextBtn,
|
|
10
|
+
RoundedBtn,
|
|
11
|
+
RoundBtn,
|
|
12
|
+
FloatingBtn,
|
|
13
|
+
AnimatedButton,
|
|
14
|
+
FeedbackButton,
|
|
15
|
+
};
|
|
@@ -72,6 +72,8 @@ import sportsResources from "./sportsResources.json";
|
|
|
72
72
|
import toursResources from "./toursResources.json";
|
|
73
73
|
import plus from "./plus.json";
|
|
74
74
|
import minus from "./minus.json";
|
|
75
|
+
import visible from "./visible.json";
|
|
76
|
+
import nonVisible from "./non-visible.json";
|
|
75
77
|
|
|
76
78
|
const allCategories = {
|
|
77
79
|
restaurants,
|
|
@@ -147,6 +149,8 @@ const allCategories = {
|
|
|
147
149
|
toursResources,
|
|
148
150
|
plus,
|
|
149
151
|
minus,
|
|
152
|
+
visible,
|
|
153
|
+
nonVisible,
|
|
150
154
|
};
|
|
151
155
|
|
|
152
156
|
export default allCategories;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"ip":0,"fr":60,"v":"5.1.20","assets":[],"layers":[{"ty":4,"nm":"not-visible","ip":0,"st":0,"ind":1,"hix":1,"ks":{"o":{"a":0,"k":100},"or":{"a":0,"k":[0,0,0]},"a":{"a":0,"k":[11,11,0]},"p":{"s":true,"x":{"a":0,"k":49.99999870020041},"y":{"a":0,"k":49.99999870020041}},"rx":{"a":0,"k":0},"ry":{"a":0,"k":0},"rz":{"a":0,"k":0},"s":{"a":0,"k":[459.70000000000005,459.70000000000005]}},"shapes":[{"ty":"gr","nm":"not-visible shape group","it":[{"ty":"sh","ks":{"a":0,"k":{"c":false,"v":[[11.3699694,4.71196842],[10.0009689,4.61196876],[1.5779686,9.94596863],[3.33296847,12.4649687]],"i":[[0,0],[0.46499999999999986,0],[1.4989999500000002,-3.1510000199999997],[-0.7139999800000001,-0.7330000000000005]],"o":[[-0.44700000000000095,-0.06599999999999984],[-3.7209999200000006,0],[0.4449999900000001,0.935999970000001],[0,0]]}}},{"ty":"sh","ks":{"a":0,"k":{"c":false,"v":[[8.6669693,15.184968],[10.0009689,15.2799692],[18.4239693,9.94596863],[16.6679688,7.42596817]],"i":[[0,0],[-0.4529999799999995,0],[-1.4989999999999988,3.1510000700000003],[0.7149998999999987,0.7329999799999998]],"o":[[0.4350000000000005,0.062000000000001165],[3.721,0],[-0.4450000000000003,-0.9359999899999991],[0,0]]}}},{"ty":"sh","ks":{"a":0,"k":{"c":false,"v":[[7.38896847,9.40796852],[9.45996857,7.33396816]],"i":[[0,0],[-1.0399999599999994,0.21399999999999952]],"o":[[0.21300000000000008,-1.0399999600000012],[0,0]]}}},{"ty":"sh","ks":{"a":0,"k":{"c":false,"v":[[19.3329697,0.66796875],[0.66796875,19.3329697]],"i":[[0,0],[0,0]],"o":[[0,0],[0,0]]}}},{"ty":"st","o":{"a":0,"k":100},"c":{"a":0,"k":[0,0,0,1]},"lc":2,"lj":2,"ml":1,"w":{"a":0,"k":1.5},"d":[{"n":"d","v":{"a":0,"k":0},"nm":"0"},{"n":"g","v":{"a":0,"k":0},"nm":"1"}]},{"ty":"fl","o":{"a":0,"k":0},"c":{"a":0,"k":[0,0,0,0]},"r":1},{"ty":"tr","o":{"a":0,"k":100},"a":{"a":0,"k":[0,0]},"s":{"a":0,"k":[100,100]},"p":{"a":0,"k":[1,1]},"r":{"a":0,"k":0}}]}],"op":1}],"op":1,"w":100,"h":100}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"ip":0,"fr":60,"v":"5.1.20","assets":[],"layers":[{"ty":4,"nm":"visible","ip":0,"st":0,"ind":1,"hix":1,"ks":{"o":{"a":0,"k":100},"or":{"a":0,"k":[0,0,0]},"a":{"a":0,"k":[9,6.5,0]},"p":{"s":true,"x":{"a":0,"k":49.999999524764874},"y":{"a":0,"k":50.00049965677462}},"rx":{"a":0,"k":0},"ry":{"a":0,"k":0},"rz":{"a":0,"k":0},"s":{"a":0,"k":[499.09999999999997,499.09999999999997]}},"shapes":[{"ty":"gr","nm":"visible shape group","it":[{"ty":"sh","ks":{"a":0,"k":{"c":false,"v":[[11.6667023,5.9460001],[8.99970245,8.61299992],[6.33270264,5.9460001],[8.99970245,3.27900028]],"i":[[0,0],[1.4730000500000013,0],[0,1.4730000499999996],[-1.4730000499999996,0]],"o":[[0,1.4730000499999996],[-1.4730000499999996,0],[0,-1.4730000500000004],[0,0]]}}},{"ty":"sh","ks":{"a":0,"k":{"c":true,"v":[[8.99970245,0.61328125],[17.2494068,5.94653273],[8.99970245,11.2797823],[0.75,5.94653273]],"i":[[-3.6723422999999995,0],[-1.4162720999999987,-3.1443119100000003],[3.672342350000001,0],[1.41627145,3.14431142]],"o":[[3.672342350000001,0],[-1.4162720999999987,3.14431142],[-3.6723422999999995,0],[1.41627145,-3.1443119100000003]]}}},{"ty":"st","o":{"a":0,"k":100},"c":{"a":0,"k":[0,0,0,1]},"lc":2,"lj":2,"ml":1,"w":{"a":0,"k":1.5},"d":[{"n":"d","v":{"a":0,"k":0},"nm":"0"},{"n":"g","v":{"a":0,"k":0},"nm":"1"}]},{"ty":"fl","o":{"a":0,"k":0},"c":{"a":0,"k":[0,0,0,0]},"r":1},{"ty":"tr","o":{"a":0,"k":100},"a":{"a":0,"k":[0,0]},"s":{"a":0,"k":[100,100]},"p":{"a":0,"k":[0,1]},"r":{"a":0,"k":0}}]}],"op":1}],"op":1,"w":100,"h":100}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import styled from
|
|
1
|
+
import styled from "styled-components/native";
|
|
2
2
|
|
|
3
3
|
export const InputWrapper = styled.Pressable`
|
|
4
4
|
min-height: 80px;
|
|
@@ -7,8 +7,9 @@ export const InputWrapper = styled.Pressable`
|
|
|
7
7
|
export const InputElement = styled.TextInput`
|
|
8
8
|
margin-top: 26px;
|
|
9
9
|
min-height: 50px;
|
|
10
|
-
font-family: ${props => props.theme.fontFamily2};
|
|
11
|
-
font-size: ${props => props.theme.small};
|
|
10
|
+
font-family: ${(props) => props.theme.fontFamily2};
|
|
11
|
+
font-size: ${(props) => props.theme.small};
|
|
12
|
+
color: ${(props) => props.theme.color2};
|
|
12
13
|
`;
|
|
13
14
|
export const BorderWrapper = styled.View`
|
|
14
15
|
height: 4px;
|
|
@@ -1,80 +1,84 @@
|
|
|
1
|
-
import React, {useEffect, useState, useRef} from
|
|
2
|
-
import {H3} from
|
|
3
|
-
import {KeyboardAvoidingView, Platform} from
|
|
4
|
-
import {InputWrapper, InputElement, BorderWrapper} from
|
|
5
|
-
import LineAnimation from
|
|
6
|
-
import Placeholder from
|
|
1
|
+
import React, { useEffect, useState, useRef } from "react";
|
|
2
|
+
import { H3 } from "../../Text";
|
|
3
|
+
import { KeyboardAvoidingView, Platform } from "react-native";
|
|
4
|
+
import { InputWrapper, InputElement, BorderWrapper } from "./Animated.style";
|
|
5
|
+
import LineAnimation from "./LineAnimation";
|
|
6
|
+
import Placeholder from "./Placeholder";
|
|
7
7
|
|
|
8
8
|
const Input = ({
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
9
|
+
children,
|
|
10
|
+
style,
|
|
11
|
+
borderColorIdle,
|
|
12
|
+
borderColorActive,
|
|
13
|
+
borderColorError,
|
|
14
|
+
textChange = () => {},
|
|
15
|
+
value,
|
|
16
|
+
multiline = false,
|
|
17
|
+
numberOfLines = 1,
|
|
18
|
+
maxLength = 1000,
|
|
19
|
+
autoFocus = false,
|
|
20
|
+
keyboardType,
|
|
21
|
+
editable = true,
|
|
22
|
+
keyboardVerticalOffset = 0,
|
|
23
|
+
hasError = false,
|
|
24
|
+
error,
|
|
25
|
+
}) => {
|
|
26
|
+
const [isFocused, setIsFocused] = useState(false);
|
|
27
|
+
const [textValue, setTextValue] = useState(value);
|
|
28
|
+
const inputRef = useRef();
|
|
29
29
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
30
|
+
useEffect(() => {
|
|
31
|
+
textChange(textValue);
|
|
32
|
+
}, [textValue]);
|
|
33
33
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
34
|
+
useEffect(() => {
|
|
35
|
+
autoFocus && inputRef.current?.focus();
|
|
36
|
+
}, [autoFocus]);
|
|
37
37
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
38
|
+
return (
|
|
39
|
+
<KeyboardAvoidingView
|
|
40
|
+
behavior={Platform.OS === "ios" ? "padding" : "height"}
|
|
41
|
+
keyboardVerticalOffset={keyboardVerticalOffset}
|
|
42
|
+
>
|
|
43
|
+
<InputWrapper
|
|
44
|
+
onPress={() => {
|
|
45
|
+
setIsFocused(true);
|
|
46
|
+
inputRef.current?.focus();
|
|
47
|
+
}}
|
|
48
|
+
>
|
|
49
|
+
<Placeholder active={isFocused || (textValue && textValue.length > 0)}>
|
|
50
|
+
{!hasError ? (
|
|
51
|
+
children
|
|
52
|
+
) : (
|
|
53
|
+
<H3 color={borderColorError}>{error || hasError}</H3>
|
|
54
|
+
)}
|
|
55
|
+
</Placeholder>
|
|
56
|
+
<InputElement
|
|
57
|
+
ref={inputRef}
|
|
58
|
+
onFocus={() => setIsFocused(true)}
|
|
59
|
+
onBlur={() => setIsFocused(false)}
|
|
60
|
+
onChangeText={(text) => setTextValue(text)}
|
|
61
|
+
value={value}
|
|
62
|
+
multiline={multiline}
|
|
63
|
+
numberOfLines={numberOfLines}
|
|
64
|
+
maxLength={maxLength}
|
|
65
|
+
autoFocus={autoFocus}
|
|
66
|
+
keyboardType={keyboardType}
|
|
67
|
+
editable={editable}
|
|
68
|
+
style={style}
|
|
69
|
+
/>
|
|
70
|
+
<BorderWrapper>
|
|
71
|
+
<LineAnimation
|
|
72
|
+
active={isFocused}
|
|
73
|
+
borderColorActive={borderColorActive}
|
|
74
|
+
borderColorIdle={borderColorIdle}
|
|
75
|
+
borderColorError={borderColorError}
|
|
76
|
+
hasError={hasError}
|
|
77
|
+
/>
|
|
78
|
+
</BorderWrapper>
|
|
79
|
+
</InputWrapper>
|
|
80
|
+
</KeyboardAvoidingView>
|
|
81
|
+
);
|
|
78
82
|
};
|
|
79
83
|
|
|
80
84
|
export default Input;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { BoxElement } from "./Layout.style";
|
|
3
|
+
|
|
4
|
+
const Box = ({ children, color = "", style, direction = false }) => {
|
|
5
|
+
return (
|
|
6
|
+
<BoxElement
|
|
7
|
+
style={{ backgroundColor: color, ...style }}
|
|
8
|
+
flexDirection={direction}
|
|
9
|
+
>
|
|
10
|
+
{children}
|
|
11
|
+
</BoxElement>
|
|
12
|
+
);
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export default Box;
|
|
@@ -69,6 +69,12 @@ export const MarginTopElement = styled.View`
|
|
|
69
69
|
${(props) => props.style};
|
|
70
70
|
`;
|
|
71
71
|
|
|
72
|
+
export const MarginRightElement = styled.View`
|
|
73
|
+
margin-right: ${(props) => props.theme.margin};
|
|
74
|
+
flex-direction: ${(props) => props.flexDirection || DEFAULT_FLEX_DIRECTION};
|
|
75
|
+
${(props) => props.style};
|
|
76
|
+
`;
|
|
77
|
+
|
|
72
78
|
export const PaddingElement = styled.View`
|
|
73
79
|
padding: ${(props) => props.theme.padding};
|
|
74
80
|
flex-direction: ${(props) => props.flexDirection || DEFAULT_FLEX_DIRECTION};
|
|
@@ -105,6 +111,12 @@ export const StretchElement = styled.View`
|
|
|
105
111
|
${(props) => props.style};
|
|
106
112
|
`;
|
|
107
113
|
|
|
114
|
+
export const BoxElement = styled.View`
|
|
115
|
+
flex: 1;
|
|
116
|
+
flex-direction: ${(props) => props.flexDirection || DEFAULT_FLEX_DIRECTION};
|
|
117
|
+
${(props) => props.style};
|
|
118
|
+
`;
|
|
119
|
+
|
|
108
120
|
export const FullScreenElement = styled.View`
|
|
109
121
|
position: absolute;
|
|
110
122
|
top: 0;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { MarginRightElement } from "./Layout.style";
|
|
3
|
+
|
|
4
|
+
const MarginRight = ({ children, style, direction = false }) => {
|
|
5
|
+
return (
|
|
6
|
+
<MarginRightElement style={style} flexDirection={direction}>
|
|
7
|
+
{children}
|
|
8
|
+
</MarginRightElement>
|
|
9
|
+
);
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export default MarginRight;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { BoxElement } from "./Layout.style";
|
|
3
|
+
|
|
4
|
+
const RoundedTopBox = ({ children, color = "", style, direction = false }) => {
|
|
5
|
+
return (
|
|
6
|
+
<BoxElement
|
|
7
|
+
style={{
|
|
8
|
+
backgroundColor: color,
|
|
9
|
+
borderTopLeftRadius: 30,
|
|
10
|
+
borderTopRightRadius: 30,
|
|
11
|
+
overflow: "hidden",
|
|
12
|
+
...style,
|
|
13
|
+
}}
|
|
14
|
+
flexDirection={direction}
|
|
15
|
+
>
|
|
16
|
+
{children}
|
|
17
|
+
</BoxElement>
|
|
18
|
+
);
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export default RoundedTopBox;
|