From b386d37a2169a66c9328e14ac553d8afab996082 Mon Sep 17 00:00:00 2001 From: Vasil <41544754+TuTejsy@users.noreply.github.com> Date: Thu, 9 Jan 2025 16:19:57 +0400 Subject: [PATCH] fix applying of bool properties for MapView compoennt on iOS with New Architecture enabled (#3730) --- ios/RNMBX/RNMBXMapViewComponentView.mm | 42 ++++++-------------------- 1 file changed, 9 insertions(+), 33 deletions(-) diff --git a/ios/RNMBX/RNMBXMapViewComponentView.mm b/ios/RNMBX/RNMBXMapViewComponentView.mm index 0e4b66acf..1de2fad18 100644 --- a/ios/RNMBX/RNMBXMapViewComponentView.mm +++ b/ios/RNMBX/RNMBXMapViewComponentView.mm @@ -136,35 +136,23 @@ - (void)updateProps:(const Props::Shared &)props oldProps:(const Props::Shared & const auto &oldViewProps = static_cast(*oldProps); const auto &newViewProps = static_cast(*props); - id attributionEnabled = RNMBXConvertFollyDynamicToId(newViewProps.attributionEnabled); - if (attributionEnabled != nil) { - _view.reactAttributionEnabled = attributionEnabled; - } + RNMBX_REMAP_OPTIONAL_PROP_BOOL(attributionEnabled, reactAttributionEnabled) id attributionPosition = RNMBXConvertFollyDynamicToId(newViewProps.attributionPosition); if (attributionPosition != nil) { _view.reactAttributionPosition = attributionPosition; } - id logoEnabled = RNMBXConvertFollyDynamicToId(newViewProps.logoEnabled); - if (logoEnabled != nil) { - _view.reactLogoEnabled = logoEnabled; - } + RNMBX_REMAP_OPTIONAL_PROP_BOOL(logoEnabled, reactLogoEnabled) id logoPosition = RNMBXConvertFollyDynamicToId(newViewProps.logoPosition); if (logoPosition != nil) { _view.reactLogoPosition = logoPosition; } - id compassEnabled = RNMBXConvertFollyDynamicToId(newViewProps.compassEnabled); - if (compassEnabled != nil) { - _view.reactCompassEnabled = compassEnabled; - } + RNMBX_REMAP_OPTIONAL_PROP_BOOL(compassEnabled, reactCompassEnabled) - id compassFadeWhenNorth = RNMBXConvertFollyDynamicToId(newViewProps.compassFadeWhenNorth); - if (compassFadeWhenNorth != nil) { - _view.reactCompassFadeWhenNorth = compassFadeWhenNorth; - } + RNMBX_REMAP_OPTIONAL_PROP_BOOL(compassFadeWhenNorth, reactCompassFadeWhenNorth) id compassPosition = RNMBXConvertFollyDynamicToId(newViewProps.compassPosition); if (compassPosition != nil) { @@ -194,25 +182,13 @@ - (void)updateProps:(const Props::Shared &)props oldProps:(const Props::Shared & _view.reactScaleBarPosition = scaleBarPosition; } - id zoomEnabled = RNMBXConvertFollyDynamicToId(newViewProps.zoomEnabled); - if (zoomEnabled != nil) { - _view.reactZoomEnabled = zoomEnabled; - } + RNMBX_REMAP_OPTIONAL_PROP_BOOL(zoomEnabled, reactZoomEnabled) - id scrollEnabled = RNMBXConvertFollyDynamicToId(newViewProps.scrollEnabled); - if (scrollEnabled != nil) { - _view.reactScrollEnabled = scrollEnabled; - } - - id rotateEnabled = RNMBXConvertFollyDynamicToId(newViewProps.rotateEnabled); - if (rotateEnabled != nil) { - _view.reactRotateEnabled = rotateEnabled; - } + RNMBX_REMAP_OPTIONAL_PROP_BOOL(scrollEnabled, reactScrollEnabled) - id pitchEnabled = RNMBXConvertFollyDynamicToId(newViewProps.pitchEnabled); - if (pitchEnabled != nil) { - _view.reactPitchEnabled = pitchEnabled; - } + RNMBX_REMAP_OPTIONAL_PROP_BOOL(rotateEnabled, reactRotateEnabled) + + RNMBX_REMAP_OPTIONAL_PROP_BOOL(pitchEnabled, reactPitchEnabled) id projection = RNMBXConvertFollyDynamicToId(newViewProps.projection); if (projection != nil) {