Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
module.exports = {
presets: ['module:metro-react-native-babel-preset'],
plugins: [
[
'module-resolver',
{
extensions: ['.js', '.jsx', '.ts', '.tsx', '.ios.js', '.android.js'],
alias: {
'@components': './components',
'@styles': './styles',
},
},
],
],
};
2 changes: 1 addition & 1 deletion components/Button/Button.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import React from 'react';
import {ComponentMeta, ComponentStory} from '@storybook/react';

import {MyButton} from './Button';
import {MyButton} from '@components';

export default {
title: 'components/MyButton',
Expand Down
23 changes: 2 additions & 21 deletions components/Button/Button.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import React from 'react';
import {StyleSheet, Text, TouchableOpacity, View} from 'react-native';
import {Text, TouchableOpacity, View} from 'react-native';
import {styles} from '@styles';

export type ButtonProps = {
onPress: () => void;
Expand All @@ -8,26 +9,6 @@ export type ButtonProps = {
textColor?: string;
};

const styles = StyleSheet.create({
button: {
paddingVertical: 8,
paddingHorizontal: 16,
borderRadius: 4,
alignSelf: 'flex-start',
flexGrow: 0,
backgroundColor: 'purple',
},
buttonText: {
color: 'white',
fontSize: 16,
fontWeight: 'bold',
},
buttonContainer: {
alignItems: 'flex-start',
flex: 1,
},
});

export const MyButton = ({text, onPress, color, textColor}: ButtonProps) => (
<View style={styles.buttonContainer}>
<TouchableOpacity
Expand Down
1 change: 1 addition & 0 deletions components/Button/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './Button';
1 change: 1 addition & 0 deletions components/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './Button';
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@
"@react-native-async-storage/async-storage": "^1.17.3",
"@react-native-community/datetimepicker": "^6.1.2",
"@react-native-community/slider": "^4.2.1",
"react-native": "0.68.0",
"react": "17.0.2",
"react-dom": "^17.0.0",
"react-native": "0.68.0",
"react-native-web": "^0.17.7"
},
"devDependencies": {
Expand All @@ -36,8 +36,8 @@
"@storybook/addon-ondevice-controls": "^6.0.1-beta.5",
"@storybook/addon-ondevice-notes": "^6.0.1-beta.5",
"@storybook/addon-react-native-web": "^0.0.18",
"@storybook/react-native": "^6.0.1-beta.5",
"@storybook/react": "6.3",
"@storybook/react-native": "^6.0.1-beta.5",
"@storybook/testing-library": "^0.0.9",
"@types/jest": "^26.0.23",
"@types/react-native": "^0.67.3",
Expand All @@ -46,6 +46,7 @@
"@typescript-eslint/parser": "^5.17.0",
"babel-jest": "^26.6.3",
"babel-loader": "^8.2.4",
"babel-plugin-module-resolver": "^4.1.0",
"babel-plugin-react-native-web": "^0.17.7",
"eslint": "^7.32.0",
"jest": "^26.6.3",
Expand Down
21 changes: 21 additions & 0 deletions styles/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import {StyleSheet} from 'react-native';

export const styles = StyleSheet.create({
button: {
paddingVertical: 8,
paddingHorizontal: 16,
borderRadius: 4,
alignSelf: 'flex-start',
flexGrow: 0,
backgroundColor: 'purple',
},
buttonText: {
color: 'white',
fontSize: 16,
fontWeight: 'bold',
},
buttonContainer: {
alignItems: 'flex-start',
flex: 1,
},
});
9 changes: 7 additions & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,13 @@

/* Module Resolution Options */
"moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */
// "baseUrl": "./", /* Base directory to resolve non-absolute module names. */
// "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */
"baseUrl": ".",
"paths": {
"@components/*": ["components/*"],
"@components": ["components"],
"@styles/*": ["styles/*"],
"@styles": ["styles"],
},
// "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */
// "typeRoots": [], /* List of folders to include type definitions from. */
// "types": [], /* Type declaration files to be included in compilation. */
Expand Down
33 changes: 31 additions & 2 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4137,6 +4137,17 @@ babel-plugin-macros@^3.0.1:
cosmiconfig "^7.0.0"
resolve "^1.19.0"

babel-plugin-module-resolver@^4.1.0:
version "4.1.0"
resolved "https://registry.yarnpkg.com/babel-plugin-module-resolver/-/babel-plugin-module-resolver-4.1.0.tgz#22a4f32f7441727ec1fbf4967b863e1e3e9f33e2"
integrity sha512-MlX10UDheRr3lb3P0WcaIdtCSRlxdQsB1sBqL7W0raF070bGl1HQQq5K3T2vf2XAYie+ww+5AKC/WrkjRO2knA==
dependencies:
find-babel-config "^1.2.0"
glob "^7.1.6"
pkg-up "^3.1.0"
reselect "^4.0.0"
resolve "^1.13.1"

babel-plugin-named-asset-import@^0.3.1:
version "0.3.8"
resolved "https://registry.yarnpkg.com/babel-plugin-named-asset-import/-/babel-plugin-named-asset-import-0.3.8.tgz#6b7fa43c59229685368683c28bc9734f24524cc2"
Expand Down Expand Up @@ -6575,6 +6586,14 @@ finalhandler@1.1.2, finalhandler@~1.1.2:
statuses "~1.5.0"
unpipe "~1.0.0"

find-babel-config@^1.2.0:
version "1.2.0"
resolved "https://registry.yarnpkg.com/find-babel-config/-/find-babel-config-1.2.0.tgz#a9b7b317eb5b9860cda9d54740a8c8337a2283a2"
integrity sha512-jB2CHJeqy6a820ssiqwrKMeyC6nNdmrcgkKWJWmpoxpE8RKciYJXCcXRq1h2AzCo5I5BJeN2tkGEO3hLTuePRA==
dependencies:
json5 "^0.5.1"
path-exists "^3.0.0"

find-cache-dir@^2.0.0, find-cache-dir@^2.1.0:
version "2.1.0"
resolved "https://registry.yarnpkg.com/find-cache-dir/-/find-cache-dir-2.1.0.tgz#8d0f94cd13fe43c6c7c261a0d86115ca918c05f7"
Expand Down Expand Up @@ -8665,6 +8684,11 @@ json-stable-stringify-without-jsonify@^1.0.1:
resolved "https://registry.yarnpkg.com/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz#9db7b59496ad3f3cfef30a75142d2d930ad72651"
integrity sha1-nbe1lJatPzz+8wp1FC0tkwrXJlE=

json5@^0.5.1:
version "0.5.1"
resolved "https://registry.yarnpkg.com/json5/-/json5-0.5.1.tgz#1eade7acc012034ad84e2396767ead9fa5495821"
integrity sha1-Hq3nrMASA0rYTiOWdn6tn6VJWCE=

json5@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/json5/-/json5-1.0.1.tgz#779fb0018604fa854eacbf6252180d83543e3dbe"
Expand Down Expand Up @@ -10349,7 +10373,7 @@ pkg-dir@^5.0.0:
dependencies:
find-up "^5.0.0"

pkg-up@3.1.0:
pkg-up@3.1.0, pkg-up@^3.1.0:
version "3.1.0"
resolved "https://registry.yarnpkg.com/pkg-up/-/pkg-up-3.1.0.tgz#100ec235cc150e4fd42519412596a28512a0def5"
integrity sha512-nDywThFk1i4BQK4twPQ6TA4RT8bDY96yeuCVBWL3ePARCiEKDRSrNGbFIgUJpLp+XeIR65v8ra7WuJOFUBtkMA==
Expand Down Expand Up @@ -11370,6 +11394,11 @@ require-main-filename@^2.0.0:
resolved "https://registry.yarnpkg.com/require-main-filename/-/require-main-filename-2.0.0.tgz#d0b329ecc7cc0f61649f62215be69af54aa8989b"
integrity sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg==

reselect@^4.0.0:
version "4.1.5"
resolved "https://registry.yarnpkg.com/reselect/-/reselect-4.1.5.tgz#852c361247198da6756d07d9296c2b51eddb79f6"
integrity sha512-uVdlz8J7OO+ASpBYoz1Zypgx0KasCY20H+N8JD13oUMtPvSHQuscrHop4KbXrbsBcdB9Ds7lVK7eRkBIfO43vQ==

resolve-cwd@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/resolve-cwd/-/resolve-cwd-3.0.0.tgz#0f0075f1bb2544766cf73ba6a6e2adfebcb13f2d"
Expand Down Expand Up @@ -11397,7 +11426,7 @@ resolve-url@^0.2.1:
resolved "https://registry.yarnpkg.com/resolve-url/-/resolve-url-0.2.1.tgz#2c637fe77c893afd2a663fe21aa9080068e2052a"
integrity sha1-LGN/53yJOv0qZj/iGqkIAGjiBSo=

resolve@^1.10.0, resolve@^1.12.0, resolve@^1.14.2, resolve@^1.18.1, resolve@^1.19.0, resolve@^1.3.2:
resolve@^1.10.0, resolve@^1.12.0, resolve@^1.13.1, resolve@^1.14.2, resolve@^1.18.1, resolve@^1.19.0, resolve@^1.3.2:
version "1.22.0"
resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.22.0.tgz#5e0b8c67c15df57a89bdbabe603a002f21731198"
integrity sha512-Hhtrw0nLeSrFQ7phPp4OOcVjLPIeMnRlr5mcnVuMe7M/7eBn98A3hmFRLoFo3DLZkivSYwhRUJTyPyWAk56WLw==
Expand Down