codemotionapps/react-native-dark-mode

Wrapping in App.js

Closed this issue · 2 comments

How would I go about wrapping my entire app with this? I'm using a UI theme that takes a theme in app.js, and changes all the views. See below...

const App = () => (
  <React.Fragment>
    <IconRegistry icons={EvaIconsPack} />
    <ApplicationProvider mapping={mapping} theme={theme}>
      <ApplicationContent />
    </ApplicationProvider>
  </React.Fragment>
);

This should work:

const App = () => {
  const theme = useDarkModeContext()
  return <React.Fragment>
    <IconRegistry icons={EvaIconsPack} />
    <ApplicationProvider mapping={mapping} theme={theme}>
      <ApplicationContent />
    </ApplicationProvider>
  </React.Fragment>
}

Hmm can't get that exact thing to work, but I get the idea. Thanks!!