npm.io
1.0.56 • Published 1 year ago

@os-design-mobile/theming

Licence
UNLICENSED
Version
1.0.56
Deps
1
Size
60 kB
Vulns
0
Weekly
0

@os-design-mobile/theming NPM version BundlePhobia

Before you start using the os-design-mobile components, you need to add the ThemeProvider that will apply the theme to all the components used.

Installation

Step 1. Install the package

Install the package using the following command:

yarn add @os-design-mobile/theming

Also make sure that you have the @emotion/native and @react-native-async-storage/async-storage packages installed.

Step 2. Redefine the emotion theme

Create the emotion.d.ts file with the following content:

import '@emotion/react';
import { Theme as BaseTheme } from '@os-design-mobile/theming';

declare module '@emotion/react' {
  // eslint-disable-next-line @typescript-eslint/no-empty-interface
  export interface Theme extends BaseTheme {}
}
Step 3. Wrap your app in ThemeProvider

For example:

import React from 'react';
import { ThemeProvider } from '@os-design-mobile/theming';
import AppNavigator from './AppNavigator';

const App: React.FC = () => (
  <ThemeProvider>
    <AppNavigator />
  </ThemeProvider>
);

export default App;

See all theming features in the os-design's Storybook.