Skip to content

fix: iOS gesture props (rotateEnabled, zoomEnabled, scrollEnabled, pitchEnabled) silently ignored on first render#64

Merged
lodev09 merged 2 commits intolugg:mainfrom
dacoto:copilot/fix-ios-map-rotation-issue
Mar 28, 2026
Merged

fix: iOS gesture props (rotateEnabled, zoomEnabled, scrollEnabled, pitchEnabled) silently ignored on first render#64
lodev09 merged 2 commits intolugg:mainfrom
dacoto:copilot/fix-ios-map-rotation-issue

Conversation

@dacoto
Copy link
Copy Markdown
Contributor

@dacoto dacoto commented Mar 27, 2026

Summary

rotateEnabled={false} had no effect on iOS — the map could still be rotated freely.
The same silent failure affected zoomEnabled, scrollEnabled, and pitchEnabled.

Root cause: The Fabric spec declared these as plain boolean, so Codegen generated
C++ props with a default of false. On first render, updateProps compares incoming
props against the C++ default-constructed LuggMapViewProps:

newViewProps.rotateEnabled = false  (user-set)
prevViewProps.rotateEnabled = false (C++ default for bool)
→ no change detected → _rotateEnabled stays YES
→ applyProps() writes YES to the map → gesture remains enabled

The ObjC-side initialization (_rotateEnabled = YES) was never overwritten.

Fix: Declare the four gesture props with WithDefault<boolean, true> in the Fabric
spec so Codegen generates C++ defaults of true, aligning with the ObjC initialization
and making first-render change detection correct.

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation update

Test Plan

  • Set rotateEnabled={false} on a MapView and verify the map cannot be rotated on iOS.
  • Repeat for zoomEnabled={false}, scrollEnabled={false}, and pitchEnabled={false}.
  • Verify that omitting these props (defaulting to true) still allows all gestures freely.
  • Confirm no regressions on Android.

Screenshots / Videos

Checklist

  • I tested on iOS
  • I tested on Android
  • I tested on Web
  • I updated the documentation (if needed)

Copilot AI and others added 2 commits March 27, 2026 23:18
Use WithDefault<boolean, true> for rotateEnabled, zoomEnabled,
scrollEnabled, and pitchEnabled in the Fabric spec. This ensures
the Codegen-generated C++ Props struct defaults these fields to
true, matching the Objective-C initialization in LuggMapView.mm.

Previously, with plain `boolean` (C++ default: false), setting
any of these props to false on initial render would not be
detected as a change (false != false), leaving the ObjC cached
value as YES and thus keeping the gesture enabled.

Agent-Logs-Url: https://github.com/dacoto/maps/sessions/a1861844-41b6-489b-ae7c-8e8d1488182c

Co-authored-by: dacoto <16915053+dacoto@users.noreply.github.com>
Copilot AI review requested due to automatic review settings March 27, 2026 23:41
@dacoto
Copy link
Copy Markdown
Contributor Author

dacoto commented Mar 27, 2026

Closes #62

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes an iOS Fabric prop-diffing issue where rotateEnabled, zoomEnabled, scrollEnabled, and pitchEnabled could be silently ignored on first render due to mismatched Codegen (C++) vs native (ObjC) default values.

Changes:

  • Updates the Fabric spec to declare the four gesture props as WithDefault<boolean, true> so Codegen-generated C++ defaults align with native initialization.
  • Ensures first-render updateProps comparisons correctly detect ...Enabled={false} and apply the expected gesture settings on iOS.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@lodev09 lodev09 merged commit a475c16 into lugg:main Mar 28, 2026
6 of 7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants