diff --git a/test/native/setup.js b/test/native/setup.js index 2df7fb1889b293..a3e0561024b341 100644 --- a/test/native/setup.js +++ b/test/native/setup.js @@ -178,3 +178,14 @@ jest.mock( } ) ), } ) ); + +// Silences the warning: dispatchCommand was called with a ref that isn't a native +// component. Use React.forwardRef to get access to the underlying native component. +// This is a known bug of react-native-testing-library package: +// https://github.com/callstack/react-native-testing-library/issues/329#issuecomment-737307473 +jest.mock( 'react-native/Libraries/Components/Switch/Switch', () => { + const jestMockComponent = require( 'react-native/jest/mockComponent' ); + return jestMockComponent( + 'react-native/Libraries/Components/Switch/Switch' + ); +} );