You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix: do not render mocked Modal when visible=false (#39157)
Summary:
Note: this PR is related only to testing mocks provided by RN, and does not affect runtime code.
When building new Jest matchers for React Native Testing Library (callstack/react-native-testing-library#1468) I've noticed that when rendering React Native in Jest using React Test Renderer the mocked `Modal` component renders host `Modal` element when `visible={false}`.
This seems to be incorrect as only visible modal should render any host elements. Not visible one should not render any host element even empty ones. Current mock implementation also contradicts the behaviour of non-mocked `Modal` which does not render `RCTModalHostView` in such case.
## Changelog:
[General] [Fixed] - Do not render mocked <Modal /> when `visible=false`
Pull Request resolved: #39157
Test Plan:
I've added test showing that non-mocked Modal renders to `null` and modifies the existing tests so that mocked Modal also renders to `null.`
Luna: I've updated relevant snapshots
Reviewed By: NickGerleman
Differential Revision: D48728277
Pulled By: lunaleaps
fbshipit-source-id: cf06495ad959e2d9549241b57f46f75d7beb9eae
0 commit comments