@momo-kits/foundation 0.115.3-beta.1 → 0.115.3-beta.3

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.
@@ -1,8 +1,7 @@
1
- import React, {useContext} from 'react';
2
- import {View, ViewStyle} from 'react-native';
1
+ import React, {useContext, useState} from 'react';
2
+ import {LayoutChangeEvent, View, ViewStyle} from 'react-native';
3
3
  import {ApplicationContext} from '../Application';
4
4
  import {Spacing} from '../Consts';
5
- import Svg, {Line} from 'react-native-svg';
6
5
 
7
6
  export interface DashDividerProps {
8
7
  /**
@@ -14,30 +13,43 @@ export interface DashDividerProps {
14
13
  const DashDivider: React.FC<DashDividerProps> = ({style}) => {
15
14
  const {theme} = useContext(ApplicationContext);
16
15
  const borderColor = theme.colors.border.default;
16
+ const DASH_WIDTH = 4;
17
+ const DASH_GAP = 4;
18
+ const [containerWidth, setContainerWidth] = useState(DASH_WIDTH);
19
+
20
+ const onLayout = (e: LayoutChangeEvent) => {
21
+ const width = e.nativeEvent.layout.width;
22
+ if (width != containerWidth) setContainerWidth(width);
23
+ };
24
+
25
+ const numOfDashes = Math.floor(containerWidth / DASH_WIDTH / 2) + 1;
17
26
 
18
27
  return (
19
28
  <View
29
+ onLayout={onLayout}
20
30
  style={[
21
31
  {
22
32
  width: '100%',
23
33
  height: 1,
24
34
  marginVertical: Spacing.XS,
35
+ flexDirection: 'row',
36
+ overflow: 'hidden',
25
37
  },
26
38
  style,
27
39
  ]}>
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>
40
+ {[...Array(numOfDashes)].map((dash, index) => {
41
+ return (
42
+ <View
43
+ key={`Dash_divider_${index}`}
44
+ style={{
45
+ width: DASH_WIDTH,
46
+ height: 1,
47
+ backgroundColor: borderColor,
48
+ marginLeft: index != 0 ? DASH_GAP : 0,
49
+ }}
50
+ />
51
+ );
52
+ })}
41
53
  </View>
42
54
  );
43
55
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@momo-kits/foundation",
3
- "version": "0.115.3-beta.1",
3
+ "version": "0.115.3-beta.3",
4
4
  "description": "React Native Component Kits",
5
5
  "main": "index.ts",
6
6
  "scripts": {},
@@ -20,8 +20,7 @@
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",
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"
23
+ "@react-navigation/stack": "https://gitlab.mservice.com.vn/momo-platform/react-navigation-stack.git"
25
24
  },
26
25
  "peerDependencies": {
27
26
  "react-native": "*"