Search code examples
reactjsreact-nativereact-native-ui-kitten

How to switch to material design in Ui Kitten?


I would like to use UI Kitten. I have seen in the documentation examples of components using Material Design and Eva Design. I would like to know how to switch to different styles. But I didn't find anything on how to do it.

enter image description here

enter image description here

But I didn't find anything in the documentation on how to do it.


Solution

  • You need to use ApplicationProvider and provide @eva-design/eva or @eva-design/material theme property. Here an example:

    import React, {useState} from 'react';
    import { ApplicationProvider, Layout, Text } from '@ui-kitten/components';
    import * as eva from '@eva-design/eva';
    import * as material from '@eva-design/material';
    
    export default () => (
      const [theme, setTheme] = useState()
      <ApplicationProvider {...eva} theme={eva.light}>
        <Layout>
          <Button onPress={() => setTheme(material.light)}>
            Siwtch to material
          </Button>
        </Layout>
      </ApplicationProvider>
    );