To install and save in your package.json dependencies, run:
# with npm
npm install @growth-ui/native
# with yarn
yarn add @growth-ui/native
Please note that react-native-svg >= 12.1.1 is peer dependency.
import { Button } from '@growth-ui/native';
const App = () => (
<Button color='primary'>
Hello Growth UI Native
</Button>
);
You can enable dark mode both automatically and manually.
/**
* If you don't wrap your App component with ThemeProvider,
* it will use "light" mode by default.
*/
import { ThemeProvider } from '@growth-ui/native';
// Automatically updates color scheme,
// either through direct user action (e.g. theme selection in device settings)
// or on a schedule (e.g. light and dark themes that follow the day/night cycle).
const App = () => (
<ThemeProvider mode='auto'>
<AppComponent />
</ThemeProvider>
)
// Or manually
const App = () => (
<ThemeProvider mode='light'>
<AppComponent />
</ThemeProvider>
)
const App = () => (
<ThemeProvider mode='dark'>
<AppComponent />
</ThemeProvider>
)