From 3d27ae0a5a66dde570084d5c1cd4651f40132f4a Mon Sep 17 00:00:00 2001 From: Janic Duplessis Date: Sat, 29 Jun 2024 00:04:40 -0400 Subject: [PATCH] Fix scaleBarEnabled on new arch --- ios/RNMBX/RNMBXFabricPropConvert.h | 6 ++++-- ios/RNMBX/RNMBXMapViewComponentView.mm | 5 +---- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/ios/RNMBX/RNMBXFabricPropConvert.h b/ios/RNMBX/RNMBXFabricPropConvert.h index fe266edeb..84c9fb40e 100644 --- a/ios/RNMBX/RNMBXFabricPropConvert.h +++ b/ios/RNMBX/RNMBXFabricPropConvert.h @@ -21,11 +21,13 @@ NSDictionary* RNMBXPropConvert_Optional_NSDictionary(const folly::dynamic &dyn, _view.name = RNMBXPropConvert_Optional_BOOL_NSNumber(newViewProps.name, @#name); \ } -#define RNMBX_OPTIONAL_PROP_BOOL(name) \ +#define RNMBX_REMAP_OPTIONAL_PROP_BOOL(name, viewName) \ if ((!oldProps.get() || oldViewProps.name != newViewProps.name) && !newViewProps.name.isNull()) { \ - _view.name = RNMBXPropConvert_Optional_BOOL(newViewProps.name, @#name); \ + _view.viewName = RNMBXPropConvert_Optional_BOOL(newViewProps.name, @#name); \ } +#define RNMBX_OPTIONAL_PROP_BOOL(name) RNMBX_REMAP_OPTIONAL_PROP_BOOL(name, name) + #define RNMBX_OPTIONAL_PROP_NSString(name) \ if ((!oldProps.get() || oldViewProps.name != newViewProps.name) && !newViewProps.name.isNull()) { \ _view.name = RNMBXPropConvert_Optional_NSString(newViewProps.name, @#name); \ diff --git a/ios/RNMBX/RNMBXMapViewComponentView.mm b/ios/RNMBX/RNMBXMapViewComponentView.mm index 16fb98d3e..475ec02f2 100644 --- a/ios/RNMBX/RNMBXMapViewComponentView.mm +++ b/ios/RNMBX/RNMBXMapViewComponentView.mm @@ -181,10 +181,7 @@ - (void)updateProps:(const Props::Shared &)props oldProps:(const Props::Shared & _view.reactCompassImage = compassImage; } - id scaleBarEnabled = RNMBXConvertFollyDynamicToId(newViewProps.scaleBarEnabled); - if (scaleBarEnabled != nil) { - _view.reactScaleBarEnabled = scaleBarEnabled; - } + RNMBX_REMAP_OPTIONAL_PROP_BOOL(scaleBarEnabled, reactScaleBarEnabled) id scaleBarPosition = RNMBXConvertFollyDynamicToId(newViewProps.scaleBarPosition); if (scaleBarPosition != nil) {