diff --git a/Libraries/Modal/__tests__/Modal-test.js b/Libraries/Modal/__tests__/Modal-test.js
index 33cbb19dd50af8..7c27e70b200af3 100644
--- a/Libraries/Modal/__tests__/Modal-test.js
+++ b/Libraries/Modal/__tests__/Modal-test.js
@@ -27,6 +27,15 @@ describe('', () => {
expect(instance).toMatchSnapshot();
});
+ it('should not render its children when mocked with visible=false', () => {
+ const instance = render.create(
+
+
+ ,
+ );
+ expect(instance.root.findAllByProps({testID: 'child'})).toHaveLength(0);
+ });
+
it('should shallow render as when mocked', () => {
const output = render.shallow(
diff --git a/Libraries/Modal/__tests__/__snapshots__/Modal-test.js.snap b/Libraries/Modal/__tests__/__snapshots__/Modal-test.js.snap
index b8afa443934ab0..2bd414e07c8c0a 100644
--- a/Libraries/Modal/__tests__/__snapshots__/Modal-test.js.snap
+++ b/Libraries/Modal/__tests__/__snapshots__/Modal-test.js.snap
@@ -13,7 +13,7 @@ exports[` should render as when not mocked 1`] = `
{
+ return (
+
+ {this.props.visible !== true ? null : this.props.children}
+
+ );
+ }
+ }
+ return ModalMock;
+}
+
+module.exports = (mockModal: $FlowFixMe);
diff --git a/jest/setup.js b/jest/setup.js
index 912b5f78dcee58..778778859da0ce 100644
--- a/jest/setup.js
+++ b/jest/setup.js
@@ -110,9 +110,11 @@ jest
getNativeRef: jest.fn(),
}),
)
- .mock('../Libraries/Modal/Modal', () =>
- mockComponent('../Libraries/Modal/Modal'),
- )
+ .mock('../Libraries/Modal/Modal', () => {
+ const baseComponent = mockComponent('../Libraries/Modal/Modal');
+ const mockModal = jest.requireActual('./mockModal');
+ return mockModal(baseComponent);
+ })
.mock('../Libraries/Components/View/View', () =>
mockComponent('../Libraries/Components/View/View', MockNativeMethods),
)