Skip to content

[fix] Linking: register listeners once and remove by subscription - #2919

Merged
zoontek merged 1 commit into
masterfrom
linking-listeners
Oct 21, 2026
Merged

zoontek merged 1 commit into
masterfrom
linking-listeners

Conversation

@zoontek

@zoontek zoontek commented Oct 20, 2026

Copy link
Copy Markdown
Collaborator

Replaces #2901.

The first Linking.addEventListener call added its callback twice. remove() compared toString(), so it also removed other callbacks with the same source.

Each subscription now stores its own entry in a Set, and remove() deletes only that entry. Calling remove() again does nothing. If the same function is registered twice, removing one subscription keeps the other.

Other changes:

  • Add addListener, emit, listenerCount, removeAllListeners, sendIntent and openSettings to match the React Native 0.88 API.
  • Remove removeEventListener. React Native 0.88 does not have it.
  • Remove the unused _validateURL.

@github-actions

Copy link
Copy Markdown

Size Change: -187 B (-0.14%)

Total Size: 134 kB

📦 View Changed
Filename Size Change
packages/react-native-web/dist/exports/Linking/index.js 698 B -187 B (-21.13%) 🎉

compressed-size-action

@Kudo Kudo left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

leaving some agent review comments. leave you to judge if that's reasonable

Comment thread packages/react-native-web/src/exports/Linking/index.js
Comment thread packages/react-native-web/src/exports/Linking/index.js
Comment thread packages/react-native-web/src/exports/Linking/index.js
@zoontek

zoontek commented Oct 21, 2026

Copy link
Copy Markdown
Collaborator Author

@Kudo Thanks, I fixed them all.

@zoontek
zoontek merged commit 957229e into master Oct 21, 2026
5 checks passed
@zoontek
zoontek deleted the linking-listeners branch October 21, 2026 07:15
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.

2 participants