@momo-kits/foundation 0.115.2-beta.12 → 0.115.3-beta.1
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/Application/BottomSheet.tsx +2 -30
- package/Divider/DashDivider.tsx +45 -0
- package/Divider/index.tsx +25 -9
- package/Input/InputMoney.tsx +2 -3
- package/package.json +3 -2
|
@@ -18,9 +18,6 @@ import {Text} from '../Text';
|
|
|
18
18
|
import {Icon} from '../Icon';
|
|
19
19
|
import {useHeaderHeight} from '@react-navigation/stack';
|
|
20
20
|
import Animated, {Easing, Extrapolate} from 'react-native-reanimated';
|
|
21
|
-
import {Keyboard, LayoutAnimation} from 'react-native';
|
|
22
|
-
import {useState} from 'react';
|
|
23
|
-
import {ScrollView} from 'react-native-gesture-handler';
|
|
24
21
|
|
|
25
22
|
const BottomSheet: React.FC<BottomSheetParams> = props => {
|
|
26
23
|
const {theme, navigator} = useContext(ApplicationContext);
|
|
@@ -29,26 +26,6 @@ const BottomSheet: React.FC<BottomSheetParams> = props => {
|
|
|
29
26
|
const insets = useSafeAreaInsets();
|
|
30
27
|
const heightHeader = useHeaderHeight();
|
|
31
28
|
const keyboardOffset = heightHeader - Math.min(insets.bottom, 21);
|
|
32
|
-
const [keyboardHeight, setKeyboardHeight] = useState(0);
|
|
33
|
-
|
|
34
|
-
useEffect(() => {
|
|
35
|
-
const onKeyboardShow = (e: any) => {
|
|
36
|
-
LayoutAnimation.configureNext(LayoutAnimation.Presets.easeInEaseOut);
|
|
37
|
-
setKeyboardHeight(e.endCoordinates.height);
|
|
38
|
-
};
|
|
39
|
-
const onKeyboardHide = () => {
|
|
40
|
-
LayoutAnimation.configureNext(LayoutAnimation.Presets.easeInEaseOut);
|
|
41
|
-
setKeyboardHeight(0);
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
const showSub = Keyboard.addListener('keyboardDidShow', onKeyboardShow);
|
|
45
|
-
const hideSub = Keyboard.addListener('keyboardDidHide', onKeyboardHide);
|
|
46
|
-
|
|
47
|
-
return () => {
|
|
48
|
-
showSub.remove();
|
|
49
|
-
hideSub.remove();
|
|
50
|
-
};
|
|
51
|
-
}, []);
|
|
52
29
|
|
|
53
30
|
const {
|
|
54
31
|
screen: Screen,
|
|
@@ -239,14 +216,9 @@ const BottomSheet: React.FC<BottomSheetParams> = props => {
|
|
|
239
216
|
<Animated.View
|
|
240
217
|
style={{
|
|
241
218
|
transform: [{translateY}],
|
|
242
|
-
maxHeight: keyboardHeight > 0 ? heightDevice / 2 : undefined,
|
|
243
219
|
}}>
|
|
244
220
|
{renderHeader()}
|
|
245
|
-
<
|
|
246
|
-
scrollEnabled={keyboardHeight > 0 ? true : false}
|
|
247
|
-
keyboardShouldPersistTaps="handled"
|
|
248
|
-
contentContainerStyle={{flexGrow: 1}}
|
|
249
|
-
style={{backgroundColor: backgroundColor}}>
|
|
221
|
+
<View style={{backgroundColor: backgroundColor}}>
|
|
250
222
|
<Screen
|
|
251
223
|
{...props}
|
|
252
224
|
{...props.route.params}
|
|
@@ -255,7 +227,7 @@ const BottomSheet: React.FC<BottomSheetParams> = props => {
|
|
|
255
227
|
{useBottomInset && (
|
|
256
228
|
<View style={{height: Math.min(insets.bottom, 21)}} />
|
|
257
229
|
)}
|
|
258
|
-
</
|
|
230
|
+
</View>
|
|
259
231
|
</Animated.View>
|
|
260
232
|
</KeyboardAvoidingView>
|
|
261
233
|
</Container>
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import React, {useContext} from 'react';
|
|
2
|
+
import {View, ViewStyle} from 'react-native';
|
|
3
|
+
import {ApplicationContext} from '../Application';
|
|
4
|
+
import {Spacing} from '../Consts';
|
|
5
|
+
import Svg, {Line} from 'react-native-svg';
|
|
6
|
+
|
|
7
|
+
export interface DashDividerProps {
|
|
8
|
+
/**
|
|
9
|
+
* Custom styles for dash divider
|
|
10
|
+
*/
|
|
11
|
+
style?: ViewStyle;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
const DashDivider: React.FC<DashDividerProps> = ({style}) => {
|
|
15
|
+
const {theme} = useContext(ApplicationContext);
|
|
16
|
+
const borderColor = theme.colors.border.default;
|
|
17
|
+
|
|
18
|
+
return (
|
|
19
|
+
<View
|
|
20
|
+
style={[
|
|
21
|
+
{
|
|
22
|
+
width: '100%',
|
|
23
|
+
height: 1,
|
|
24
|
+
marginVertical: Spacing.XS,
|
|
25
|
+
},
|
|
26
|
+
style,
|
|
27
|
+
]}>
|
|
28
|
+
<Svg height="1" width="100%">
|
|
29
|
+
<Line
|
|
30
|
+
x1="0"
|
|
31
|
+
y1="0"
|
|
32
|
+
x2="100%"
|
|
33
|
+
y2="0"
|
|
34
|
+
stroke={borderColor}
|
|
35
|
+
strokeWidth="1"
|
|
36
|
+
strokeDasharray={`4, 4`}
|
|
37
|
+
strokeLinecap={'round'}
|
|
38
|
+
strokeLinejoin={'miter'}
|
|
39
|
+
/>
|
|
40
|
+
</Svg>
|
|
41
|
+
</View>
|
|
42
|
+
);
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
export {DashDivider};
|
package/Divider/index.tsx
CHANGED
|
@@ -1,21 +1,37 @@
|
|
|
1
1
|
import React, {useContext} from 'react';
|
|
2
|
-
import {View} from 'react-native';
|
|
2
|
+
import {View, ViewStyle} from 'react-native';
|
|
3
3
|
import {ApplicationContext} from '../Application';
|
|
4
4
|
import {Spacing} from '../Consts';
|
|
5
|
+
import {DashDivider} from './DashDivider';
|
|
5
6
|
|
|
6
|
-
|
|
7
|
+
export interface DividerProps {
|
|
8
|
+
/**
|
|
9
|
+
* Custom styles for divider
|
|
10
|
+
*/
|
|
11
|
+
style?: ViewStyle;
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Enable margin vertical 4px
|
|
15
|
+
*/
|
|
16
|
+
useMargin?: boolean;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const Divider: React.FC<DividerProps> = ({style, useMargin = true}) => {
|
|
7
20
|
const {theme} = useContext(ApplicationContext);
|
|
8
21
|
|
|
9
22
|
return (
|
|
10
23
|
<View
|
|
11
|
-
style={
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
24
|
+
style={[
|
|
25
|
+
style,
|
|
26
|
+
{
|
|
27
|
+
height: 1,
|
|
28
|
+
width: '100%',
|
|
29
|
+
backgroundColor: theme.colors.border.default,
|
|
30
|
+
marginVertical: useMargin ? Spacing.XS : 0,
|
|
31
|
+
},
|
|
32
|
+
]}
|
|
17
33
|
/>
|
|
18
34
|
);
|
|
19
35
|
};
|
|
20
36
|
|
|
21
|
-
export {Divider};
|
|
37
|
+
export {Divider, DashDivider};
|
package/Input/InputMoney.tsx
CHANGED
|
@@ -97,10 +97,10 @@ const InputMoney = forwardRef(
|
|
|
97
97
|
};
|
|
98
98
|
|
|
99
99
|
const onClearText = () => {
|
|
100
|
-
inputRef?.current?.clear();
|
|
101
100
|
setDisplayValue('');
|
|
102
101
|
setNumericValue('');
|
|
103
102
|
onChangeText?.('');
|
|
103
|
+
inputRef?.current?.focus();
|
|
104
104
|
};
|
|
105
105
|
|
|
106
106
|
const _onChangeText = (text: string) => {
|
|
@@ -113,8 +113,7 @@ const InputMoney = forwardRef(
|
|
|
113
113
|
|
|
114
114
|
if (text.length < lastDisplayValue.length) {
|
|
115
115
|
const lastChar = lastDisplayValue.charAt(lastDisplayValue.length - 1);
|
|
116
|
-
const isRemovingCurrency =
|
|
117
|
-
lastDisplayValue.endsWith(currency) || lastChar === ' ';
|
|
116
|
+
const isRemovingCurrency = lastDisplayValue.endsWith(currency) || lastChar === ' ';
|
|
118
117
|
const isRemovingDot = lastChar === '.';
|
|
119
118
|
|
|
120
119
|
if (isRemovingCurrency || isRemovingDot) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@momo-kits/foundation",
|
|
3
|
-
"version": "0.115.
|
|
3
|
+
"version": "0.115.3-beta.1",
|
|
4
4
|
"description": "React Native Component Kits",
|
|
5
5
|
"main": "index.ts",
|
|
6
6
|
"scripts": {},
|
|
@@ -20,7 +20,8 @@
|
|
|
20
20
|
"@react-navigation/routers": "5.7.4",
|
|
21
21
|
"react-native-reanimated": "git+https://gitlab.mservice.com.vn/momo-platform/react-native-reanimated.git#v1.13.4_gradle_7",
|
|
22
22
|
"lottie-react-native": "git+https://gitlab.mservice.com.vn/momo-platform/momo-lottie-react-native.git",
|
|
23
|
-
"@react-navigation/stack": "https://gitlab.mservice.com.vn/momo-platform/react-navigation-stack.git"
|
|
23
|
+
"@react-navigation/stack": "https://gitlab.mservice.com.vn/momo-platform/react-navigation-stack.git",
|
|
24
|
+
"react-native-svg": "git+https://gitlab.mservice.com.vn/momo-platform/react-native-svg.git#v12.1.0.public_fix_not_found_bounds_ios"
|
|
24
25
|
},
|
|
25
26
|
"peerDependencies": {
|
|
26
27
|
"react-native": "*"
|