Skip to content

Instantly share code, notes, and snippets.

@mattpocock
Created June 20, 2019 16:14
Show Gist options
  • Save mattpocock/7dde8a79e401cc34f39ed0a1be498755 to your computer and use it in GitHub Desktop.
Save mattpocock/7dde8a79e401cc34f39ed0a1be498755 to your computer and use it in GitHub Desktop.
import React, { useState } from 'react';
import {
getStorybookUI,
configure,
addDecorator,
} from '@storybook/react-native';
import ThemeProvider from '../theme/ThemeProvider';
import './stories/Split.stories.tsx';
import { themesAsObject } from '../test-utils/testAllThemes';
import { View } from 'react-native';
const ThemeProviderWithButtons = ({ children }) => {
const [themeKey, setThemeKey] = useState('banijay');
const theme = themesAsObject[themeKey];
return <ThemeProvider customTheme={theme}>{children}</ThemeProvider>;
};
addDecorator(storyFn => {
return (
<>
<View style={{ height: 20 }}></View>
<ThemeProvider>{storyFn()}</ThemeProvider>
</>
);
});
// import stories
configure(() => {}, module);
// Refer to https://github.com/storybookjs/storybook/tree/master/app/react-native#start-command-parameters
// To find allowed options for getStorybookUI
const StorybookUIRoot = getStorybookUI({});
export default StorybookUIRoot;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment