Skip to content

Commit

Permalink
feat: openStorybook method & remove async storage & add expo dev me…
Browse files Browse the repository at this point in the history
…nu item (#3)
  • Loading branch information
michalziolkowski authored Mar 22, 2024
1 parent 52c8bbc commit fbb61ed
Show file tree
Hide file tree
Showing 25 changed files with 2,108 additions and 2,076 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ To integrate Sherlo with your React Native app and run tests via CLI or GitHub A
1. **Install `@sherlo/react-native-storybook`** to enable Sherlo's visual testing with Storybook in your React Native application.

```bash
yarn add @sherlo/react-native-storybook @react-native-async-storage/async-storage
yarn add @sherlo/react-native-storybook
```

2. **Wrap Your Application with `withStorybook`** to toggle between your app and Storybook based on Sherlo's testing environment.
Expand Down
2 changes: 1 addition & 1 deletion examples/expo-example/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ node_modules/
.expo/
dist/
web-build/
builds/sherloexpoexample.app
sherloexpoexample.app

# Native
*.orig.*
Expand Down
35 changes: 21 additions & 14 deletions examples/expo-example/App.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Storybook from './.storybook';

import { useCallback } from 'react';
import { View, Text, StyleSheet } from 'react-native';
import { View, Text, StyleSheet, Button } from 'react-native';
import {
useFonts,
Urbanist_400Regular,
Expand All @@ -10,7 +10,7 @@ import {
Urbanist_700Bold,
} from '@expo-google-fonts/urbanist';
import * as SplashScreen from 'expo-splash-screen';
import { withStorybook } from '@sherlo/react-native-storybook';
import { withStorybook, useSherlo } from '@sherlo/react-native-storybook';

SplashScreen.preventAutoHideAsync();

Expand All @@ -33,18 +33,25 @@ export default function App() {
}

// eslint-disable-next-line react/no-unstable-nested-components
const App = () => (
<View
style={{
flex: 1,
backgroundColor: '#fff',
alignItems: 'center',
justifyContent: 'center',
}}
>
<Text>Open dev menu and toggle storybook</Text>
</View>
);
const App = () => {
const { openStorybook } = useSherlo();

return (
<View
style={{
flex: 1,
backgroundColor: '#fff',
alignItems: 'center',
justifyContent: 'center',
}}
>
<Text style={{ textAlign: 'center' }}>
{'Open Dev Menu and select "Toggle Storybook" \nor click the button below'}
</Text>
<Button title="Open Storybook" onPress={openStorybook} />
</View>
);
};

const AppWithStorybook = withStorybook(App, Storybook);

Expand Down
Binary file modified examples/expo-example/builds/preview/android.apk
Binary file not shown.
Binary file modified examples/expo-example/builds/preview/ios.tar.gz
Binary file not shown.
1 change: 0 additions & 1 deletion examples/expo-example/sherlo.config.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{
"projectToken": "<YOUR_PROJECT_TOKEN>",
"android": {
"path": "builds/preview/android.apk",
"packageName": "com.sherlo.example",
Expand Down
Loading

0 comments on commit fbb61ed

Please sign in to comment.