Skip to content

Commit 9d0b95c

Browse files
author
Daniel
committed
init
0 parents  commit 9d0b95c

21 files changed

+7721
-0
lines changed

.expo-shared/assets.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"12bb71342c6255bbf50437ec8f4441c083f47cdb74bd89160c15e4f43e52a1cb": true,
3+
"40b842e832070c58deac6aa9e08fa459302ee3f9da492c7e77d93d2fbf4a56fd": true
4+
}

.gitignore

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
node_modules/**/*
2+
.expo/*
3+
npm-debug.*
4+
*.jks
5+
*.p8
6+
*.p12
7+
*.key
8+
*.mobileprovision
9+
*.orig.*
10+
web-build/
11+
12+
# macOS
13+
.DS_Store

.npmignore

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
*.jks
2+
*.key
3+
*.mobileprovision
4+
*.p12
5+
*.p8
6+
.DS_Store
7+
.expo
8+
.npmignore
9+
.vscode
10+
package-lock.json
11+
yarn.lock
12+
yarn-error.log
13+
yarn-debug.log*
14+
npm-debug.log*

.ondevice/Storybook.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import { getStorybookUI } from '@storybook/react-native';
2+
import './storybook.requires';
3+
const StorybookUIRoot = getStorybookUI({});
4+
export default StorybookUIRoot;

.ondevice/main.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
module.exports = {
2+
stories: [
3+
'../components/**/*.stories.?(ts|tsx|js|jsx)'
4+
],
5+
addons: [
6+
'@storybook/addon-ondevice-notes',
7+
'@storybook/addon-ondevice-controls',
8+
'@storybook/addon-ondevice-backgrounds',
9+
'@storybook/addon-ondevice-actions',
10+
],
11+
};

.ondevice/preview.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import {withBackgrounds} from '@storybook/addon-ondevice-backgrounds';
2+
export const decorators = [withBackgrounds];
3+
export const parameters = {
4+
backgrounds: [
5+
{name: 'plain', value: 'white', default: true},
6+
{name: 'warm', value: 'hotpink'},
7+
{name: 'cool', value: 'deepskyblue'},
8+
],
9+
};

.ondevice/storybook.requires.js

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
/* do not change this file, it is auto generated by storybook. */
2+
3+
import {
4+
configure,
5+
addDecorator,
6+
addParameters,
7+
addArgsEnhancer,
8+
} from "@storybook/react-native";
9+
10+
import "@storybook/addon-ondevice-notes/register";
11+
import "@storybook/addon-ondevice-controls/register";
12+
import "@storybook/addon-ondevice-backgrounds/register";
13+
import "@storybook/addon-ondevice-actions/register";
14+
15+
import { argsEnhancers } from "@storybook/addon-actions/dist/modern/preset/addArgs";
16+
17+
import { decorators, parameters } from "./preview";
18+
19+
if (decorators) {
20+
decorators.forEach((decorator) => addDecorator(decorator));
21+
}
22+
23+
if (parameters) {
24+
addParameters(parameters);
25+
}
26+
27+
argsEnhancers.forEach((enhancer) => addArgsEnhancer(enhancer));
28+
29+
const getStories = () => {
30+
return [require("../components/Button/Button.stories.tsx")];
31+
};
32+
33+
configure(getStories, module, false);

App.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
import StorybookUIRoot from "./.ondevice/Storybook";
2+
export { StorybookUIRoot as default };

app.json

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{
2+
"expo": {
3+
"name": "HelloWorld",
4+
"slug": "expo-template-blank-typescript",
5+
"version": "1.0.0",
6+
"orientation": "portrait",
7+
"icon": "./assets/icon.png",
8+
"splash": {
9+
"image": "./assets/splash.png",
10+
"resizeMode": "contain",
11+
"backgroundColor": "#ffffff"
12+
},
13+
"updates": {
14+
"fallbackToCacheTimeout": 0
15+
},
16+
"assetBundlePatterns": ["**/*"],
17+
"ios": {
18+
"supportsTablet": true
19+
},
20+
"android": {
21+
"adaptiveIcon": {
22+
"foregroundImage": "./assets/adaptive-icon.png",
23+
"backgroundColor": "#FFFFFF"
24+
}
25+
},
26+
"web": {
27+
"favicon": "./assets/favicon.png"
28+
}
29+
}
30+
}

assets/adaptive-icon.png

17.1 KB
Loading

assets/favicon.png

1.43 KB
Loading

assets/icon.png

21.9 KB
Loading

assets/splash.png

46.2 KB
Loading

babel.config.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
module.exports = function(api) {
2+
api.cache(true);
3+
return {
4+
presets: ['babel-preset-expo'],
5+
};
6+
};

components/Button/Button.stories.tsx

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import React from 'react';
2+
import {ComponentStory, ComponentMeta} from '@storybook/react-native';
3+
import {MyButton} from './Button';
4+
const MyButtonMeta: ComponentMeta<typeof MyButton> = {
5+
title: 'MyButton',
6+
component: MyButton,
7+
argTypes: {
8+
onPress: {action: 'pressed the button'},
9+
},
10+
args: {
11+
text: 'Hello world',
12+
},
13+
};
14+
export default MyButtonMeta;
15+
type MyButtonStory = ComponentStory<typeof MyButton>;
16+
export const Basic: MyButtonStory = args => <MyButton {...args} />;
17+

components/Button/Button.tsx

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import React from 'react';
2+
import {TouchableOpacity, Text, StyleSheet} from 'react-native';
3+
interface MyButtonProps {
4+
onPress: () => void;
5+
text: string;
6+
}
7+
export const MyButton = ({onPress, text}: MyButtonProps) => {
8+
return (
9+
<TouchableOpacity style={styles.container} onPress={onPress}>
10+
<Text style={styles.text}>{text}</Text>
11+
</TouchableOpacity>
12+
);
13+
};
14+
const styles = StyleSheet.create({
15+
container: {
16+
paddingHorizontal: 16,
17+
paddingVertical: 8,
18+
backgroundColor: 'violet',
19+
},
20+
text: {color: 'black'},
21+
});
22+

gitignore

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
node_modules/
2+
.expo/
3+
dist/
4+
npm-debug.*
5+
*.jks
6+
*.p8
7+
*.p12
8+
*.key
9+
*.mobileprovision
10+
*.orig.*
11+
web-build/
12+
13+
# macOS
14+
.DS_Store

metro.config.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
const { getDefaultConfig } = require("expo/metro-config");
2+
3+
const defaultConfig = getDefaultConfig(__dirname);
4+
5+
defaultConfig.resolver.resolverMainFields = [
6+
"sbmodern",
7+
...defaultConfig.resolver.resolverMainFields,
8+
];
9+
10+
defaultConfig.transformer.getTransformOptions = async () => ({
11+
transform: {
12+
experimentalImportSupport: false,
13+
inlineRequires: false,
14+
},
15+
});
16+
17+
defaultConfig.watchFolders = [...defaultConfig.watchFolders, "./.ondevice"];
18+
19+
module.exports = defaultConfig;

package.json

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
{
2+
"name": "expo-template-storybook",
3+
"description": "template for react native storybook 6 and react native web",
4+
"version": "44.0.4",
5+
"main": "node_modules/expo/AppEntry.js",
6+
"scripts": {
7+
"start": "expo start",
8+
"android": "expo start --android",
9+
"ios": "expo start --ios",
10+
"web": "expo start --web",
11+
"eject": "expo eject",
12+
"update-stories": "sb-rn-get-stories --config-path .ondevice",
13+
"prestart": "yarn update-stories",
14+
"storybook-watcher": "sb-rn-watcher --config-path .ondevice"
15+
},
16+
"dependencies": {
17+
"@react-native-async-storage/async-storage": "~1.15.0",
18+
"@react-native-community/datetimepicker": "4.0.0",
19+
"@react-native-community/slider": "4.1.12",
20+
"@storybook/addon-actions": "6.3",
21+
"@storybook/addon-controls": "6.3",
22+
"@storybook/addon-ondevice-actions": "^6.0.1-alpha.7",
23+
"@storybook/addon-ondevice-backgrounds": "^6.0.1-alpha.7",
24+
"@storybook/addon-ondevice-controls": "^6.0.1-alpha.7",
25+
"@storybook/addon-ondevice-notes": "^6.0.1-alpha.7",
26+
"@storybook/react-native": "^6.0.1-alpha.7",
27+
"expo": "~44.0.0",
28+
"expo-status-bar": "~1.2.0",
29+
"react": "17.0.1",
30+
"react-dom": "17.0.1",
31+
"react-native": "0.64.3",
32+
"react-native-web": "0.17.1"
33+
},
34+
"devDependencies": {
35+
"@babel/core": "^7.12.9",
36+
"@types/react": "~17.0.21",
37+
"@types/react-native": "~0.64.12",
38+
"typescript": "~4.3.5"
39+
}
40+
}

tsconfig.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"extends": "expo/tsconfig.base",
3+
"compilerOptions": {
4+
"strict": true
5+
}
6+
}

0 commit comments

Comments
 (0)