Skip to content

fix: use boolValue for hasPressListener prop#3872

Closed
chrisforerunner wants to merge 1 commit into
rnmapbox:mainfrom
chrisforerunner:fix/has-press-listener-bool
Closed

fix: use boolValue for hasPressListener prop#3872
chrisforerunner wants to merge 1 commit into
rnmapbox:mainfrom
chrisforerunner:fix/has-press-listener-bool

Conversation

@chrisforerunner

@chrisforerunner chrisforerunner commented Jun 13, 2025

Copy link
Copy Markdown

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 #3850. Fixes #3864.

Checklist

  • I've read CONTRIBUTING.md
  • I updated the doc/other generated code with running yarn generate in the root folder
  • I have tested the new feature on /example app.
    • In V11 mode/ios
    • 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

Copy link
Copy Markdown
Author

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.

@rnmapbox-bot

Copy link
Copy Markdown
Contributor

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.

@mfazekas

mfazekas commented Aug 8, 2025

Copy link
Copy Markdown
Contributor

Closed by #3865

@mfazekas mfazekas closed this Aug 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: MapView onPress doesn't fire through VectorSource Layer

3 participants