Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[iOS] Use react native 0.62 hook for dark mode #21455

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,18 +1,13 @@
/**
* External dependencies
*/
import { useDarkModeContext, eventEmitter } from 'react-native-dark-mode';

// Conditional needed to pass UI Tests on CI
if ( eventEmitter.setMaxListeners ) {
eventEmitter.setMaxListeners( 150 );
}
import { useColorScheme } from 'react-native';

/**
* Returns the color scheme value when it changes. Possible values: [ 'light', 'dark' ]
*
* @return {string} return current color scheme.
*/
const usePreferredColorScheme = useDarkModeContext;
const usePreferredColorScheme = useColorScheme;

export default usePreferredColorScheme;
10 changes: 0 additions & 10 deletions test/native/setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,6 @@ jest.mock( 'react-native-gutenberg-bridge', () => {
};
} );

jest.mock( 'react-native-dark-mode', () => {
return {
initialMode: 'light',
eventEmitter: {
on: jest.fn(),
},
useDarkModeContext: () => 'light',
};
} );

jest.mock( 'react-native-modal', () => () => 'Modal' );

jest.mock( 'react-native-hr', () => () => 'Hr' );
Expand Down