maps icon indicating copy to clipboard operation
maps copied to clipboard

fix: use boolValue for hasPressListener prop

Open chrisforerunner opened this issue 6 months ago • 1 comments

Description

Explicitly extracts the boolValue from the hasPressListener prop on RNMBXVectorSourceComponentView. This fixes an issue when running in New Architecture where all VectorSource layers are marked as touchable because hasPressListener is always true when bridged to Swift.

Functionally, this manifests as a bug wherein VectorSource components will incorrectly "capture" taps, even when no onPress handler is provided, also preventing the root MapView:onPress handler from firing.

Similar change as https://github.com/rnmapbox/maps/pull/3850. Fixes #3864.

Checklist

  • [x] I've read CONTRIBUTING.md
  • [x] I updated the doc/other generated code with running yarn generate in the root folder
  • [x] I have tested the new feature on /example app.
    • [x] In V11 mode/ios
    • [x] In New Architecture mode/ios
    • [ ] In V11 mode/android
    • [ ] In New Architecture mode/android
  • [ ] I added/updated a sample - if a new feature was implemented (/example)

chrisforerunner avatar Jun 13 '25 05:06 chrisforerunner

Apologies. This looks like a duplicate of #3865. My search skills failed me. I'll leave this open for the maintainers to decide how to proceed.

chrisforerunner avatar Jun 13 '25 15:06 chrisforerunner

Hi @chrisforerunner, thank you for this contribution! 🎉

This fix looks great and follows the same pattern as #3850. The explicit boolValue extraction is important for New Architecture compatibility, where bridged boolean values need to be properly unwrapped to avoid them always evaluating as truthy.

I can see you've:

  • ✅ Applied the fix correctly by using [hasPressListener boolValue]
  • ✅ Run yarn generate as requested
  • ✅ Tested on iOS with both V11 and New Architecture modes

This should indeed fix #3864 where VectorSource components were incorrectly capturing taps even without an onPress handler.

The CI is currently not running on this PR. Could you please rebase your branch onto the latest main? This will allow the CI checks to run:

git fetch upstream main
git rebase upstream/main
git push --force-with-lease origin your-branch-name

Thank you again for catching and fixing this New Architecture compatibility issue! The change looks ready to merge once CI passes.

rnmapbox-bot avatar Aug 08 '25 05:08 rnmapbox-bot

Closed by #3865

mfazekas avatar Aug 08 '25 13:08 mfazekas