Skip to content

Commit 7a91212

Browse files
TuTejsymathieupost
authored andcommitted
fix applying of bool properties for MapView compoennt on iOS with New Architecture enabled (rnmapbox#3730)
1 parent 06fd719 commit 7a91212

File tree

1 file changed

+9
-33
lines changed

1 file changed

+9
-33
lines changed

ios/RNMBX/RNMBXMapViewComponentView.mm

+9-33
Original file line numberDiff line numberDiff line change
@@ -136,35 +136,23 @@ - (void)updateProps:(const Props::Shared &)props oldProps:(const Props::Shared &
136136
const auto &oldViewProps = static_cast<const RNMBXMapViewProps &>(*oldProps);
137137
const auto &newViewProps = static_cast<const RNMBXMapViewProps &>(*props);
138138

139-
id attributionEnabled = RNMBXConvertFollyDynamicToId(newViewProps.attributionEnabled);
140-
if (attributionEnabled != nil) {
141-
_view.reactAttributionEnabled = attributionEnabled;
142-
}
139+
RNMBX_REMAP_OPTIONAL_PROP_BOOL(attributionEnabled, reactAttributionEnabled)
143140

144141
id attributionPosition = RNMBXConvertFollyDynamicToId(newViewProps.attributionPosition);
145142
if (attributionPosition != nil) {
146143
_view.reactAttributionPosition = attributionPosition;
147144
}
148145

149-
id logoEnabled = RNMBXConvertFollyDynamicToId(newViewProps.logoEnabled);
150-
if (logoEnabled != nil) {
151-
_view.reactLogoEnabled = logoEnabled;
152-
}
146+
RNMBX_REMAP_OPTIONAL_PROP_BOOL(logoEnabled, reactLogoEnabled)
153147

154148
id logoPosition = RNMBXConvertFollyDynamicToId(newViewProps.logoPosition);
155149
if (logoPosition != nil) {
156150
_view.reactLogoPosition = logoPosition;
157151
}
158152

159-
id compassEnabled = RNMBXConvertFollyDynamicToId(newViewProps.compassEnabled);
160-
if (compassEnabled != nil) {
161-
_view.reactCompassEnabled = compassEnabled;
162-
}
153+
RNMBX_REMAP_OPTIONAL_PROP_BOOL(compassEnabled, reactCompassEnabled)
163154

164-
id compassFadeWhenNorth = RNMBXConvertFollyDynamicToId(newViewProps.compassFadeWhenNorth);
165-
if (compassFadeWhenNorth != nil) {
166-
_view.reactCompassFadeWhenNorth = compassFadeWhenNorth;
167-
}
155+
RNMBX_REMAP_OPTIONAL_PROP_BOOL(compassFadeWhenNorth, reactCompassFadeWhenNorth)
168156

169157
id compassPosition = RNMBXConvertFollyDynamicToId(newViewProps.compassPosition);
170158
if (compassPosition != nil) {
@@ -194,25 +182,13 @@ - (void)updateProps:(const Props::Shared &)props oldProps:(const Props::Shared &
194182
_view.reactScaleBarPosition = scaleBarPosition;
195183
}
196184

197-
id zoomEnabled = RNMBXConvertFollyDynamicToId(newViewProps.zoomEnabled);
198-
if (zoomEnabled != nil) {
199-
_view.reactZoomEnabled = zoomEnabled;
200-
}
185+
RNMBX_REMAP_OPTIONAL_PROP_BOOL(zoomEnabled, reactZoomEnabled)
201186

202-
id scrollEnabled = RNMBXConvertFollyDynamicToId(newViewProps.scrollEnabled);
203-
if (scrollEnabled != nil) {
204-
_view.reactScrollEnabled = scrollEnabled;
205-
}
206-
207-
id rotateEnabled = RNMBXConvertFollyDynamicToId(newViewProps.rotateEnabled);
208-
if (rotateEnabled != nil) {
209-
_view.reactRotateEnabled = rotateEnabled;
210-
}
187+
RNMBX_REMAP_OPTIONAL_PROP_BOOL(scrollEnabled, reactScrollEnabled)
211188

212-
id pitchEnabled = RNMBXConvertFollyDynamicToId(newViewProps.pitchEnabled);
213-
if (pitchEnabled != nil) {
214-
_view.reactPitchEnabled = pitchEnabled;
215-
}
189+
RNMBX_REMAP_OPTIONAL_PROP_BOOL(rotateEnabled, reactRotateEnabled)
190+
191+
RNMBX_REMAP_OPTIONAL_PROP_BOOL(pitchEnabled, reactPitchEnabled)
216192

217193
id projection = RNMBXConvertFollyDynamicToId(newViewProps.projection);
218194
if (projection != nil) {

0 commit comments

Comments
 (0)