akveo / react-native-ui-kitten

:boom: React Native UI Library based on Eva Design System :new_moon_with_face::sparkles:Dark Mode
https://akveo.github.io/react-native-ui-kitten/
MIT License
10.32k stars 953 forks source link

docs(guide): theme usage typo #440

Closed skryl closed 5 years ago

skryl commented 5 years ago

https://akveo.github.io/react-native-ui-kitten/docs/guides/add-into-existing-project

Configure Application Root

import React from 'react';
import {
  mapping,
  theme,
} from '@eva-design/eva';
import { ApplicationProvider } from 'react-native-ui-kitten';
import { Application } from './path-to/root.component';

export default class App extends React.Component {

   public render(): React.ReactNode {
     return (
       <ApplicationProvider
         mapping={mapping}
         theme={theme}>
         <Application/>
       </ApplicationProvider>
     );
   }
}

should actually be

import React from 'react';
import {
  mapping,
  light as theme, // select light or dark theme
} from '@eva-design/eva';
import { ApplicationProvider } from 'react-native-ui-kitten';
import { Application } from './path-to/root.component';

export default class App extends React.Component {

   public render(): React.ReactNode {
     return (
       <ApplicationProvider
         mapping={mapping}
         theme={theme}>
         <Application/>
       </ApplicationProvider>
     );
   }
}
skryl commented 5 years ago

https://github.com/eva-design/eva/blob/master/packages/eva/index.ts

export const mapping = require('./mapping.json');
export const light = require('./themes/light.json');
export const dark = require('./themes/dark.json');

Seems like eva only exports light and dark, using theme causes an obscure error deep down in styleConsumer.

artyorsh commented 5 years ago

Thanks for report @skryl

Yes. With Eva you can now use light and dark themes with following code:

import { mapping, light as theme } from '@eva-design/eva'; 

or to use Dark Theme

import { mapping, dark as theme } from '@eva-design/eva'; 

Looks like, it should be fixed everywhere