Skip to content

fix(utils): do not throw when the native module is missing - #5321

Open
pcbeingused333 wants to merge 1 commit into
callstack:mainfrom
pcbeingused333:fix/react-native-paper-4373
Open

pcbeingused333 wants to merge 1 commit into
callstack:mainfrom
pcbeingused333:fix/react-native-paper-4373

Conversation

@pcbeingused333

Copy link
Copy Markdown

PaperProvider subscribes to AccessibilityInfo while it mounts. Jest presets often leave that native module undefined, and addEventListener called Module.addEventListener without checking. The provider then threw during mount instead of rendering.

When the module is missing, or it has no addEventListener, the helper now returns a subscription whose remove is a no-op. A present module still subscribes and removes as before.

Prepared with the help of an AI coding assistant.

Fixes #4373

@github-actions

Copy link
Copy Markdown

Found potential problems with the pull request:

  • Screenshot or video evidence is missing. Make sure to include one if it affects the UI.

This branch has not been deployed

No deployments
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.

Exception is thrown during Jest test when using Paper components.

1 participant