@@ -86,13 +86,25 @@ 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 ) ) return ;
107+
96108 ( ( PlatformView ? ) handler . PlatformView ) ? . UpdateStrokeShape ( border ) ;
97109 MapBackground ( handler , border ) ;
98110 }
@@ -104,6 +116,8 @@ public static void MapStrokeShape(IBorderHandler handler, IBorderView border)
104116 /// <param name="border">The associated <see cref="IBorderView"/> instance.</param>
105117 public static void MapStroke ( IBorderHandler handler , IBorderView border )
106118 {
119+ if ( ShouldSkipStrokeMappings ( handler ) ) return ;
120+
107121 ( ( PlatformView ? ) handler . PlatformView ) ? . UpdateStroke ( border ) ;
108122 MapBackground ( handler , border ) ;
109123 }
@@ -115,6 +129,8 @@ public static void MapStroke(IBorderHandler handler, IBorderView border)
115129 /// <param name="border">The associated <see cref="IBorderView"/> instance.</param>
116130 public static void MapStrokeThickness ( IBorderHandler handler , IBorderView border )
117131 {
132+ if ( ShouldSkipStrokeMappings ( handler ) ) return ;
133+
118134 ( ( PlatformView ? ) handler . PlatformView ) ? . UpdateStrokeThickness ( border ) ;
119135 MapBackground ( handler , border ) ;
120136 }
@@ -126,6 +142,8 @@ public static void MapStrokeThickness(IBorderHandler handler, IBorderView border
126142 /// <param name="border">The associated <see cref="IBorderView"/> instance.</param>
127143 public static void MapStrokeLineCap ( IBorderHandler handler , IBorderView border )
128144 {
145+ if ( ShouldSkipStrokeMappings ( handler ) ) return ;
146+
129147 ( ( PlatformView ? ) handler . PlatformView ) ? . UpdateStrokeLineCap ( border ) ;
130148 }
131149
@@ -136,6 +154,8 @@ public static void MapStrokeLineCap(IBorderHandler handler, IBorderView border)
136154 /// <param name="border">The associated <see cref="IBorderView"/> instance.</param>
137155 public static void MapStrokeLineJoin ( IBorderHandler handler , IBorderView border )
138156 {
157+ if ( ShouldSkipStrokeMappings ( handler ) ) return ;
158+
139159 ( ( PlatformView ? ) handler . PlatformView ) ? . UpdateStrokeLineJoin ( border ) ;
140160 }
141161
@@ -146,6 +166,8 @@ public static void MapStrokeLineJoin(IBorderHandler handler, IBorderView border)
146166 /// <param name="border">The associated <see cref="IBorderView"/> instance.</param>
147167 public static void MapStrokeDashPattern ( IBorderHandler handler , IBorderView border )
148168 {
169+ if ( ShouldSkipStrokeMappings ( handler ) ) return ;
170+
149171 ( ( PlatformView ? ) handler . PlatformView ) ? . UpdateStrokeDashPattern ( border ) ;
150172 }
151173
@@ -156,6 +178,8 @@ public static void MapStrokeDashPattern(IBorderHandler handler, IBorderView bord
156178 /// <param name="border">The associated <see cref="IBorderView"/> instance.</param>
157179 public static void MapStrokeDashOffset ( IBorderHandler handler , IBorderView border )
158180 {
181+ if ( ShouldSkipStrokeMappings ( handler ) ) return ;
182+
159183 ( ( PlatformView ? ) handler . PlatformView ) ? . UpdateStrokeDashOffset ( border ) ;
160184 }
161185
@@ -166,6 +190,8 @@ public static void MapStrokeDashOffset(IBorderHandler handler, IBorderView borde
166190 /// <param name="border">The associated <see cref="IBorderView"/> instance.</param>
167191 public static void MapStrokeMiterLimit ( IBorderHandler handler , IBorderView border )
168192 {
193+ if ( ShouldSkipStrokeMappings ( handler ) ) return ;
194+
169195 ( ( PlatformView ? ) handler . PlatformView ) ? . UpdateStrokeMiterLimit ( border ) ;
170196 }
171197
0 commit comments