@@ -86,13 +86,28 @@ public static void MapBackground(IBorderHandler handler, IBorderView border)
8686 ( ( PlatformView ? ) handler . PlatformView ) ? . UpdateBackground ( border ) ;
8787 }
8888
89+ private static bool ShouldSkipStrokeMappings ( IBorderHandler handler ) {
90+ #if __IOS__ || MACCATALYST || ANDROID
91+ // During the initial connection, the `MapBackground` takes care of updating the stroke properties
92+ // so we can skip the stroke mappings to avoid repetitive and useless updates.
93+ return handler . IsConnectingHandler ( ) ;
94+ #else
95+ return false ;
96+ #endif
97+ }
98+
8999 /// <summary>
90100 /// Maps the abstract <see cref="IBorderStroke.Shape"/> property to the platform-specific implementations.
91101 /// </summary>
92102 /// <param name="handler">The associated handler.</param>
93103 /// <param name="border">The associated <see cref="IBorderView"/> instance.</param>
94104 public static void MapStrokeShape ( IBorderHandler handler , IBorderView border )
95105 {
106+ if ( ShouldSkipStrokeMappings ( handler ) )
107+ {
108+ return ;
109+ }
110+
96111 ( ( PlatformView ? ) handler . PlatformView ) ? . UpdateStrokeShape ( border ) ;
97112 MapBackground ( handler , border ) ;
98113 }
@@ -104,6 +119,11 @@ public static void MapStrokeShape(IBorderHandler handler, IBorderView border)
104119 /// <param name="border">The associated <see cref="IBorderView"/> instance.</param>
105120 public static void MapStroke ( IBorderHandler handler , IBorderView border )
106121 {
122+ if ( ShouldSkipStrokeMappings ( handler ) )
123+ {
124+ return ;
125+ }
126+
107127 ( ( PlatformView ? ) handler . PlatformView ) ? . UpdateStroke ( border ) ;
108128 MapBackground ( handler , border ) ;
109129 }
@@ -115,6 +135,11 @@ public static void MapStroke(IBorderHandler handler, IBorderView border)
115135 /// <param name="border">The associated <see cref="IBorderView"/> instance.</param>
116136 public static void MapStrokeThickness ( IBorderHandler handler , IBorderView border )
117137 {
138+ if ( ShouldSkipStrokeMappings ( handler ) )
139+ {
140+ return ;
141+ }
142+
118143 ( ( PlatformView ? ) handler . PlatformView ) ? . UpdateStrokeThickness ( border ) ;
119144 MapBackground ( handler , border ) ;
120145 }
@@ -126,6 +151,11 @@ public static void MapStrokeThickness(IBorderHandler handler, IBorderView border
126151 /// <param name="border">The associated <see cref="IBorderView"/> instance.</param>
127152 public static void MapStrokeLineCap ( IBorderHandler handler , IBorderView border )
128153 {
154+ if ( ShouldSkipStrokeMappings ( handler ) )
155+ {
156+ return ;
157+ }
158+
129159 ( ( PlatformView ? ) handler . PlatformView ) ? . UpdateStrokeLineCap ( border ) ;
130160 }
131161
@@ -136,6 +166,11 @@ public static void MapStrokeLineCap(IBorderHandler handler, IBorderView border)
136166 /// <param name="border">The associated <see cref="IBorderView"/> instance.</param>
137167 public static void MapStrokeLineJoin ( IBorderHandler handler , IBorderView border )
138168 {
169+ if ( ShouldSkipStrokeMappings ( handler ) )
170+ {
171+ return ;
172+ }
173+
139174 ( ( PlatformView ? ) handler . PlatformView ) ? . UpdateStrokeLineJoin ( border ) ;
140175 }
141176
@@ -146,6 +181,11 @@ public static void MapStrokeLineJoin(IBorderHandler handler, IBorderView border)
146181 /// <param name="border">The associated <see cref="IBorderView"/> instance.</param>
147182 public static void MapStrokeDashPattern ( IBorderHandler handler , IBorderView border )
148183 {
184+ if ( ShouldSkipStrokeMappings ( handler ) )
185+ {
186+ return ;
187+ }
188+
149189 ( ( PlatformView ? ) handler . PlatformView ) ? . UpdateStrokeDashPattern ( border ) ;
150190 }
151191
@@ -156,6 +196,11 @@ public static void MapStrokeDashPattern(IBorderHandler handler, IBorderView bord
156196 /// <param name="border">The associated <see cref="IBorderView"/> instance.</param>
157197 public static void MapStrokeDashOffset ( IBorderHandler handler , IBorderView border )
158198 {
199+ if ( ShouldSkipStrokeMappings ( handler ) )
200+ {
201+ return ;
202+ }
203+
159204 ( ( PlatformView ? ) handler . PlatformView ) ? . UpdateStrokeDashOffset ( border ) ;
160205 }
161206
@@ -166,6 +211,11 @@ public static void MapStrokeDashOffset(IBorderHandler handler, IBorderView borde
166211 /// <param name="border">The associated <see cref="IBorderView"/> instance.</param>
167212 public static void MapStrokeMiterLimit ( IBorderHandler handler , IBorderView border )
168213 {
214+ if ( ShouldSkipStrokeMappings ( handler ) )
215+ {
216+ return ;
217+ }
218+
169219 ( ( PlatformView ? ) handler . PlatformView ) ? . UpdateStrokeMiterLimit ( border ) ;
170220 }
171221
0 commit comments