@@ -39,6 +39,26 @@ const Line: React.FC<LinePropsType> = ({
39
39
return < View style = { solidLineStyle } />
40
40
} , [ solidLineStyle ] )
41
41
42
+ // ================== dashedCssDom ==================
43
+ const dashedCssDom = useMemo ( ( ) => {
44
+ const wrapperStyle : ViewStyle = {
45
+ flex : 1 ,
46
+ overflow : 'hidden' ,
47
+ ...( isHorizontal ? { height : _thickness } : { width : _thickness } ) ,
48
+ }
49
+ const lineStyle : ViewStyle = {
50
+ ...( isHorizontal ? { height : 0 } : { width : 0 } ) ,
51
+ borderColor : backgroundColor ,
52
+ borderWidth : _thickness ,
53
+ borderStyle : 'dashed' ,
54
+ }
55
+ return (
56
+ < View style = { wrapperStyle } >
57
+ < View style = { lineStyle } />
58
+ </ View >
59
+ )
60
+ } , [ isHorizontal , _thickness , backgroundColor ] )
61
+
42
62
// ================== dashedPattern ==================
43
63
const dashedPattern = useMemo ( ( ) => {
44
64
const [ len , gap ] =
@@ -72,8 +92,8 @@ const Line: React.FC<LinePropsType> = ({
72
92
[ isHorizontal , _thickness , backgroundColor , dashedPattern ] ,
73
93
)
74
94
75
- // ================== dashedLineDom ==================
76
- const dashedLineDom = useMemo ( ( ) => {
95
+ // ================== dashedJointDom ==================
96
+ const dashedJointDom = useMemo ( ( ) => {
77
97
const { l, g } = dashedPattern
78
98
const count = Math . ceil ( ( lineLength + g ) / ( g * 2 + l ) )
79
99
return (
@@ -97,6 +117,15 @@ const Line: React.FC<LinePropsType> = ({
97
117
getDashedLineStyle ,
98
118
] )
99
119
120
+ // ================== dashedLineDom ==================
121
+ const dashedLineDom = useMemo ( ( ) => {
122
+ if ( Array . isArray ( pattern ) ) {
123
+ return dashedJointDom
124
+ } else {
125
+ return dashedCssDom
126
+ }
127
+ } , [ pattern , dashedCssDom , dashedJointDom ] )
128
+
100
129
// ================== lineDom ==================
101
130
const lineDom = useMemo ( ( ) => {
102
131
if ( variant === 'dashed' ) {
0 commit comments