diff --git a/packages/components/src/index.native.js b/packages/components/src/index.native.js index 431aa41027700d..c2c52ba08f0e58 100644 --- a/packages/components/src/index.native.js +++ b/packages/components/src/index.native.js @@ -32,4 +32,3 @@ export { default as KeyboardAvoidingView } from './mobile/keyboard-avoiding-view export { default as KeyboardAwareFlatList } from './mobile/keyboard-aware-flat-list'; export { default as Picker } from './mobile/picker'; export { default as ReadableContentView } from './mobile/readable-content-view'; -export * from './mobile/dark-mode'; diff --git a/packages/components/src/mobile/dark-mode/index.native.js b/packages/components/src/mobile/dark-mode/index.native.js deleted file mode 100644 index 44ff4c38a8f644..00000000000000 --- a/packages/components/src/mobile/dark-mode/index.native.js +++ /dev/null @@ -1,58 +0,0 @@ -/** - * External dependencies - */ -import { eventEmitter, initialMode } from 'react-native-dark-mode'; -import React from 'react'; - -// Conditional needed to pass UI Tests on CI -if ( eventEmitter.setMaxListeners ) { - eventEmitter.setMaxListeners( 150 ); -} - -export function withTheme( WrappedComponent ) { - return class extends React.Component { - constructor( props ) { - super( props ); - - this.onModeChanged = this.onModeChanged.bind( this ); - this.useStyle = this.useStyle.bind( this ); - - this.state = { - mode: initialMode, - }; - } - - onModeChanged( newMode ) { - this.setState( { mode: newMode } ); - } - - componentDidMount() { - this.subscription = eventEmitter.on( 'currentModeChanged', this.onModeChanged ); - } - - componentWillUnmount() { - // Conditional needed to pass UI Tests on CI - if ( eventEmitter.removeListener ) { - eventEmitter.removeListener( 'currentModeChanged', this.onModeChanged ); - } - } - - useStyle( light, dark ) { - const isDarkMode = this.state.mode === 'dark'; - const finalDark = { - ...light, - ...dark, - }; - - return isDarkMode ? finalDark : light; - } - - render() { - return ; - } - }; -}