This repository was archived by the owner on Feb 12, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +24
-0
lines changed
packages/com.mkmarek.uielements.react/Runtime/Bridge Expand file tree Collapse file tree 2 files changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -89,6 +89,8 @@ public class ComponentStyle
8989 public string paddingTop ;
9090 public string backgroundColor ;
9191 public string backgroundImage ;
92+ public string unityBackgroundImageTintColor ;
93+ public string unityBackgroundScaleMode ;
9294 public string color ;
9395 public string fontSize ;
9496 public string borderColor ;
Original file line number Diff line number Diff line change @@ -15,6 +15,12 @@ public static void AssignStyleProps(JsToNativeBridgePayload.BridgeMessage.Compon
1515 if ( ! string . IsNullOrWhiteSpace ( style . backgroundImage ) )
1616 element . style . backgroundImage = ParseStyleBackground ( style . backgroundImage ) ;
1717
18+ if ( ! string . IsNullOrWhiteSpace ( style . unityBackgroundImageTintColor ) )
19+ element . style . unityBackgroundImageTintColor = ParseStyleColor ( style . unityBackgroundImageTintColor ) ;
20+
21+ if ( ! string . IsNullOrWhiteSpace ( style . unityBackgroundScaleMode ) )
22+ element . style . unityBackgroundScaleMode = ParseScaleModeStyleEnum ( style . unityBackgroundScaleMode ) ;
23+
1824 if ( ! string . IsNullOrWhiteSpace ( style . color ) )
1925 element . style . color = ParseStyleColor ( style . color ) ;
2026
@@ -278,6 +284,22 @@ private static StyleEnum<Align> ParseAlignStyleEnum(string styleAlignItems)
278284 return default ;
279285 }
280286
287+ private static StyleEnum < ScaleMode > ParseScaleModeStyleEnum ( string scaleMode )
288+ {
289+ var keyword = GetStyleKeyword ( scaleMode ) ;
290+
291+ if ( keyword . HasValue ) return new StyleEnum < ScaleMode > ( keyword . Value ) ;
292+
293+ switch ( scaleMode )
294+ {
295+ case "scale-and-crop" : return new StyleEnum < ScaleMode > ( ScaleMode . ScaleAndCrop ) ;
296+ case "scale-to-fit" : return new StyleEnum < ScaleMode > ( ScaleMode . ScaleToFit ) ;
297+ case "stretch-to-fill" : return new StyleEnum < ScaleMode > ( ScaleMode . StretchToFill ) ;
298+ }
299+
300+ return default ;
301+ }
302+
281303 private static StyleFloat ParseStyleFloat ( string styleFloat )
282304 {
283305 var keyword = GetStyleKeyword ( styleFloat ) ;
You can’t perform that action at this time.
0 commit comments