diff --git a/metro.config.js b/metro.config.js
index aac31b65..86e486ea 100644
--- a/metro.config.js
+++ b/metro.config.js
@@ -1,7 +1,7 @@
const path = require("path");
const pathToMobile = path.resolve(__dirname, "packages", "mobile");
-
+const { getDefaultConfig } = require("metro-config");
/**
* Metro config must be in the root
* of the project. Ideally, it should
@@ -10,16 +10,30 @@ const pathToMobile = path.resolve(__dirname, "packages", "mobile");
* This issue is tracked already.
* [link to issue](https://github.com/facebook/metro/issues/588)
*/
-module.exports = {
- watchFolders: [path.resolve(__dirname)],
- projectRoot: pathToMobile,
- transformer: {
- getTransformOptions: async () => ({
- transform: {
- experimentalImportSupport: false,
- inlineRequires: true,
- assetRegistryPath: pathToMobile,
- },
- }),
- },
-};
+
+module.exports = (async () => {
+ const {
+ resolver: { sourceExts },
+ } = await getDefaultConfig();
+ return {
+ watchFolders: [
+ path.resolve(__dirname),
+ path.resolve(__dirname, "node_modules", "@paperpod", "frontend"),
+ path.resolve(__dirname, "node_modules", "@paperpod", "common"),
+ ],
+ projectRoot: pathToMobile,
+ resolver: {
+ // Add cjs extension so stitches will load.
+ sourceExts: [...sourceExts, "cjs"],
+ },
+ transformer: {
+ getTransformOptions: async () => ({
+ transform: {
+ experimentalImportSupport: false,
+ inlineRequires: true,
+ assetRegistryPath: pathToMobile,
+ },
+ }),
+ },
+ };
+})();
diff --git a/package.json b/package.json
index 48ddc278..2ba706c0 100644
--- a/package.json
+++ b/package.json
@@ -19,7 +19,8 @@
"frontend": "yarn workspace @paperpod/frontend",
"infrastructure": "yarn workspace @paperpod/infrastructure",
"docs": "yarn workspace @paperpod/docs",
- "mobile": "yarn workspace @paperpod/mobile"
+ "mobile": "yarn workspace @paperpod/mobile",
+ "mobile:generate:symlinks": "metro-with-symlinks"
},
"resolutions": {
"**/react": "^17.0.2",
@@ -31,9 +32,9 @@
"react-native": "^0.64.2"
},
"devDependencies": {
+ "metro-with-symlinks": "^1.4.0",
"@react-native-community/cli": "^5.0.1",
"husky": "^5.2.0",
- "metro-config": "^0.66.2",
"prettier": "^2.2.1",
"pretty-quick": "^3.1.0",
"react": "^17.0.2",
diff --git a/packages/mobile/App.tsx b/packages/mobile/App.tsx
index aa1d64e7..9aa81fc1 100644
--- a/packages/mobile/App.tsx
+++ b/packages/mobile/App.tsx
@@ -1,15 +1,37 @@
import React from "react";
-import { SafeAreaView, ScrollView, Text, View } from "react-native";
+import {
+ SafeAreaView,
+ ScrollView,
+ View,
+ Image,
+ StyleSheet,
+} from "react-native";
+import { authentication } from "@paperpod/frontend";
+import { Login } from "./src/Login/Login";
+
+const styles = StyleSheet.create({
+ logo: {
+ width: 100,
+ height: 50,
+ },
+});
const App = () => {
return (
-
-
-
- Hello updated
-
-
-
+
+
+
+
+
+
+
+
+
+
);
};
diff --git a/packages/mobile/babel.config.js b/packages/mobile/babel.config.js
index f842b77f..31a821a1 100644
--- a/packages/mobile/babel.config.js
+++ b/packages/mobile/babel.config.js
@@ -1,3 +1,8 @@
module.exports = {
- presets: ['module:metro-react-native-babel-preset'],
+ presets: ["module:metro-react-native-babel-preset"],
+
+ plugins: [
+ "@babel/plugin-proposal-export-namespace-from",
+ ["@babel/plugin-transform-typescript", { allowNamespaces: true }],
+ ],
};
diff --git a/packages/mobile/package.json b/packages/mobile/package.json
index f364abda..8ad84f5f 100644
--- a/packages/mobile/package.json
+++ b/packages/mobile/package.json
@@ -13,21 +13,22 @@
"react-native": "^0.64.2"
},
"devDependencies": {
- "@babel/core": "^7.12.9",
+ "@babel/core": "^7.15.0",
+ "@babel/plugin-proposal-export-namespace-from": "^7.14.5",
"@babel/runtime": "^7.12.5",
- "@react-native-community/eslint-config": "^2.0.0",
- "babel-jest": "^26.6.3",
- "eslint": "7.14.0",
- "jest": "^26.6.3",
- "metro-react-native-babel-preset": "^0.64.0",
- "react-test-renderer": "17.0.1",
"@react-native-community/cli": "^5.0.1",
+ "@react-native-community/eslint-config": "^2.0.0",
"@types/jest": "^26.0.23",
"@types/react-native": "^0.64.5",
"@types/react-test-renderer": "^16.9.2",
+ "babel-jest": "^26.6.3",
+ "eslint": "7.14.0",
"install": "^0.13.0",
+ "jest": "^26.6.3",
"metro-config": "^0.66.2",
+ "metro-react-native-babel-preset": "^0.64.0",
"pod-install": "^0.1.23",
+ "react-test-renderer": "17.0.1",
"typescript": "^3.8.3"
},
"resolutions": {
@@ -44,4 +45,4 @@
"node"
]
}
-}
\ No newline at end of file
+}
diff --git a/packages/mobile/src/Login/Login.tsx b/packages/mobile/src/Login/Login.tsx
new file mode 100644
index 00000000..bdd2e16f
--- /dev/null
+++ b/packages/mobile/src/Login/Login.tsx
@@ -0,0 +1,52 @@
+import React, { useContext } from "react";
+import { authentication } from "@paperpod/frontend";
+
+import { Button, TextInput, View, StyleSheet, Text } from "react-native";
+
+const styles = StyleSheet.create({
+ input: {
+ color: "#000",
+ paddingRight: 5,
+ paddingLeft: 5,
+ fontSize: 18,
+ lineHeight: 23,
+ flex: 2,
+ },
+});
+
+export const Login = () => {
+ const { user } = React.useContext(authentication.UserContext);
+ const [email, setEmail] = React.useState("");
+ const [password, setPassword] = React.useState("");
+
+ console.log("user", user);
+
+ return (
+
+
+
+
+
+ {email} - {password}
+
+
+
+ );
+};
diff --git a/rn-cli.config.js b/rn-cli.config.js
new file mode 100644
index 00000000..f7a8c95f
--- /dev/null
+++ b/rn-cli.config.js
@@ -0,0 +1,32 @@
+const path = require("path");
+
+const extraNodeModules = {};
+const blacklistRegexes = [];
+const watchFolders = [];
+/**
+ * NOTE: SHOULD THIS BE METRO CONFIG?
+ * https://github.com/MrLoh/metro-with-symlinks/issues/21
+ */
+
+const metroVersion = require("metro/package.json").version;
+const metroVersionComponents = metroVersion.match(/^(\d+)\.(\d+)\.(\d+)/);
+if (
+ metroVersionComponents[1] === "0" &&
+ parseInt(metroVersionComponents[2], 10) >= 43
+) {
+ module.exports = {
+ resolver: {
+ extraNodeModules,
+ blacklistRE: require("metro-config/src/defaults/blacklist")(
+ blacklistRegexes
+ ),
+ },
+ watchFolders,
+ };
+} else {
+ module.exports = {
+ extraNodeModules,
+ getBlacklistRE: () => require("metro/src/blacklist")(blacklistRegexes),
+ getProjectRoots: () => [path.resolve(__dirname)].concat(watchFolders),
+ };
+}
diff --git a/yarn.lock b/yarn.lock
index 9e7e286f..5455b1ec 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -926,6 +926,11 @@
resolved "https://registry.yarnpkg.com/@babel/compat-data/-/compat-data-7.14.9.tgz#ac7996ceaafcf8f410119c8af0d1db4cf914a210"
integrity sha512-p3QjZmMGHDGdpcwEYYWu7i7oJShJvtgMjJeb0W95PPhSm++3lm8YXYOh45Y6iCN9PkZLTZ7CIX5nFrp7pw7TXw==
+"@babel/compat-data@^7.15.0":
+ version "7.15.0"
+ resolved "https://registry.yarnpkg.com/@babel/compat-data/-/compat-data-7.15.0.tgz#2dbaf8b85334796cafbb0f5793a90a2fc010b176"
+ integrity sha512-0NqAC1IJE0S0+lL1SWFMxMkz1pKCNCjI4tr2Zx4LJSXxCLAdr6KyArnY+sno5m3yH9g737ygOyPABDsnXkpxiA==
+
"@babel/core@7.7.7":
version "7.7.7"
resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.7.7.tgz#ee155d2e12300bcc0cff6a8ad46f2af5063803e9"
@@ -946,7 +951,7 @@
semver "^5.4.1"
source-map "^0.5.0"
-"@babel/core@^7.0.0", "@babel/core@^7.1.0", "@babel/core@^7.1.6", "@babel/core@^7.12.9", "@babel/core@^7.14.0", "@babel/core@^7.14.3", "@babel/core@^7.4.4", "@babel/core@^7.7.5":
+"@babel/core@^7.0.0", "@babel/core@^7.1.0", "@babel/core@^7.1.6", "@babel/core@^7.14.0", "@babel/core@^7.14.3", "@babel/core@^7.4.4", "@babel/core@^7.7.5":
version "7.14.8"
resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.14.8.tgz#20cdf7c84b5d86d83fac8710a8bc605a7ba3f010"
integrity sha512-/AtaeEhT6ErpDhInbXmjHcUQXH0L0TEgscfcxk1qbOvLuKCa5aZT0SOOtDKFY96/CLROwbLSKyFor6idgNaU4Q==
@@ -967,6 +972,27 @@
semver "^6.3.0"
source-map "^0.5.0"
+"@babel/core@^7.15.0":
+ version "7.15.0"
+ resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.15.0.tgz#749e57c68778b73ad8082775561f67f5196aafa8"
+ integrity sha512-tXtmTminrze5HEUPn/a0JtOzzfp0nk+UEXQ/tqIJo3WDGypl/2OFQEMll/zSFU8f/lfmfLXvTaORHF3cfXIQMw==
+ dependencies:
+ "@babel/code-frame" "^7.14.5"
+ "@babel/generator" "^7.15.0"
+ "@babel/helper-compilation-targets" "^7.15.0"
+ "@babel/helper-module-transforms" "^7.15.0"
+ "@babel/helpers" "^7.14.8"
+ "@babel/parser" "^7.15.0"
+ "@babel/template" "^7.14.5"
+ "@babel/traverse" "^7.15.0"
+ "@babel/types" "^7.15.0"
+ convert-source-map "^1.7.0"
+ debug "^4.1.0"
+ gensync "^1.0.0-beta.2"
+ json5 "^2.1.2"
+ semver "^6.3.0"
+ source-map "^0.5.0"
+
"@babel/generator@^7.14.0", "@babel/generator@^7.14.8", "@babel/generator@^7.14.9", "@babel/generator@^7.4.4", "@babel/generator@^7.5.0", "@babel/generator@^7.7.7":
version "7.14.9"
resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.14.9.tgz#23b19c597d38b4f7dc2e3fe42a69c88d9ecfaa16"
@@ -976,6 +1002,15 @@
jsesc "^2.5.1"
source-map "^0.5.0"
+"@babel/generator@^7.15.0":
+ version "7.15.0"
+ resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.15.0.tgz#a7d0c172e0d814974bad5aa77ace543b97917f15"
+ integrity sha512-eKl4XdMrbpYvuB505KTta4AV9g+wWzmVBW69tX0H2NwKVKd2YJbKgyK6M8j/rgLbmHOYJn6rUklV677nOyJrEQ==
+ dependencies:
+ "@babel/types" "^7.15.0"
+ jsesc "^2.5.1"
+ source-map "^0.5.0"
+
"@babel/helper-annotate-as-pure@^7.0.0", "@babel/helper-annotate-as-pure@^7.14.5":
version "7.14.5"
resolved "https://registry.yarnpkg.com/@babel/helper-annotate-as-pure/-/helper-annotate-as-pure-7.14.5.tgz#7bf478ec3b71726d56a8ca5775b046fc29879e61"
@@ -1001,6 +1036,16 @@
browserslist "^4.16.6"
semver "^6.3.0"
+"@babel/helper-compilation-targets@^7.15.0":
+ version "7.15.0"
+ resolved "https://registry.yarnpkg.com/@babel/helper-compilation-targets/-/helper-compilation-targets-7.15.0.tgz#973df8cbd025515f3ff25db0c05efc704fa79818"
+ integrity sha512-h+/9t0ncd4jfZ8wsdAsoIxSa61qhBYlycXiHWqJaQBCXAhDCMbPRSMTGnZIkkmt1u4ag+UQmuqcILwqKzZ4N2A==
+ dependencies:
+ "@babel/compat-data" "^7.15.0"
+ "@babel/helper-validator-option" "^7.14.5"
+ browserslist "^4.16.6"
+ semver "^6.3.0"
+
"@babel/helper-create-class-features-plugin@^7.10.4", "@babel/helper-create-class-features-plugin@^7.14.5", "@babel/helper-create-class-features-plugin@^7.14.6":
version "7.14.8"
resolved "https://registry.yarnpkg.com/@babel/helper-create-class-features-plugin/-/helper-create-class-features-plugin-7.14.8.tgz#a6f8c3de208b1e5629424a9a63567f56501955fc"
@@ -1072,6 +1117,13 @@
dependencies:
"@babel/types" "^7.14.5"
+"@babel/helper-member-expression-to-functions@^7.15.0":
+ version "7.15.0"
+ resolved "https://registry.yarnpkg.com/@babel/helper-member-expression-to-functions/-/helper-member-expression-to-functions-7.15.0.tgz#0ddaf5299c8179f27f37327936553e9bba60990b"
+ integrity sha512-Jq8H8U2kYiafuj2xMTPQwkTBnEEdGKpT35lJEQsRRjnG0LW3neucsaMWLgKcwu3OHKNeYugfw+Z20BXBSEs2Lg==
+ dependencies:
+ "@babel/types" "^7.15.0"
+
"@babel/helper-module-imports@^7.0.0", "@babel/helper-module-imports@^7.10.4", "@babel/helper-module-imports@^7.12.13", "@babel/helper-module-imports@^7.14.5":
version "7.14.5"
resolved "https://registry.yarnpkg.com/@babel/helper-module-imports/-/helper-module-imports-7.14.5.tgz#6d1a44df6a38c957aa7c312da076429f11b422f3"
@@ -1093,6 +1145,20 @@
"@babel/traverse" "^7.14.8"
"@babel/types" "^7.14.8"
+"@babel/helper-module-transforms@^7.15.0":
+ version "7.15.0"
+ resolved "https://registry.yarnpkg.com/@babel/helper-module-transforms/-/helper-module-transforms-7.15.0.tgz#679275581ea056373eddbe360e1419ef23783b08"
+ integrity sha512-RkGiW5Rer7fpXv9m1B3iHIFDZdItnO2/BLfWVW/9q7+KqQSDY5kUfQEbzdXM1MVhJGcugKV7kRrNVzNxmk7NBg==
+ dependencies:
+ "@babel/helper-module-imports" "^7.14.5"
+ "@babel/helper-replace-supers" "^7.15.0"
+ "@babel/helper-simple-access" "^7.14.8"
+ "@babel/helper-split-export-declaration" "^7.14.5"
+ "@babel/helper-validator-identifier" "^7.14.9"
+ "@babel/template" "^7.14.5"
+ "@babel/traverse" "^7.15.0"
+ "@babel/types" "^7.15.0"
+
"@babel/helper-optimise-call-expression@^7.14.5":
version "7.14.5"
resolved "https://registry.yarnpkg.com/@babel/helper-optimise-call-expression/-/helper-optimise-call-expression-7.14.5.tgz#f27395a8619e0665b3f0364cddb41c25d71b499c"
@@ -1124,6 +1190,16 @@
"@babel/traverse" "^7.14.5"
"@babel/types" "^7.14.5"
+"@babel/helper-replace-supers@^7.15.0":
+ version "7.15.0"
+ resolved "https://registry.yarnpkg.com/@babel/helper-replace-supers/-/helper-replace-supers-7.15.0.tgz#ace07708f5bf746bf2e6ba99572cce79b5d4e7f4"
+ integrity sha512-6O+eWrhx+HEra/uJnifCwhwMd6Bp5+ZfZeJwbqUTuqkhIT6YcRhiZCOOFChRypOIe0cV46kFrRBlm+t5vHCEaA==
+ dependencies:
+ "@babel/helper-member-expression-to-functions" "^7.15.0"
+ "@babel/helper-optimise-call-expression" "^7.14.5"
+ "@babel/traverse" "^7.15.0"
+ "@babel/types" "^7.15.0"
+
"@babel/helper-simple-access@^7.10.4", "@babel/helper-simple-access@^7.14.5", "@babel/helper-simple-access@^7.14.8":
version "7.14.8"
resolved "https://registry.yarnpkg.com/@babel/helper-simple-access/-/helper-simple-access-7.14.8.tgz#82e1fec0644a7e775c74d305f212c39f8fe73924"
@@ -1188,6 +1264,11 @@
resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.14.9.tgz#596c1ad67608070058ebf8df50c1eaf65db895a4"
integrity sha512-RdUTOseXJ8POjjOeEBEvNMIZU/nm4yu2rufRkcibzkkg7DmQvXU8v3M4Xk9G7uuI86CDGkKcuDWgioqZm+mScQ==
+"@babel/parser@^7.15.0":
+ version "7.15.3"
+ resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.15.3.tgz#3416d9bea748052cfcb63dbcc27368105b1ed862"
+ integrity sha512-O0L6v/HvqbdJawj0iBEfVQMc3/6WP+AeOsovsIgBFyJaG+W2w7eqvZB7puddATmWuARlm1SX7DwxJ/JJUnDpEA==
+
"@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining@^7.14.5":
version "7.14.5"
resolved "https://registry.yarnpkg.com/@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining/-/plugin-bugfix-v8-spread-parameters-in-optional-chaining-7.14.5.tgz#4b467302e1548ed3b1be43beae2cc9cf45e0bb7e"
@@ -2136,6 +2217,21 @@
debug "^4.1.0"
globals "^11.1.0"
+"@babel/traverse@^7.15.0":
+ version "7.15.0"
+ resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.15.0.tgz#4cca838fd1b2a03283c1f38e141f639d60b3fc98"
+ integrity sha512-392d8BN0C9eVxVWd8H6x9WfipgVH5IaIoLp23334Sc1vbKKWINnvwRpb4us0xtPaCumlwbTtIYNA0Dv/32sVFw==
+ dependencies:
+ "@babel/code-frame" "^7.14.5"
+ "@babel/generator" "^7.15.0"
+ "@babel/helper-function-name" "^7.14.5"
+ "@babel/helper-hoist-variables" "^7.14.5"
+ "@babel/helper-split-export-declaration" "^7.14.5"
+ "@babel/parser" "^7.15.0"
+ "@babel/types" "^7.15.0"
+ debug "^4.1.0"
+ globals "^11.1.0"
+
"@babel/types@7.11.5":
version "7.11.5"
resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.11.5.tgz#d9de577d01252d77c6800cee039ee64faf75662d"
@@ -2162,6 +2258,14 @@
"@babel/helper-validator-identifier" "^7.14.9"
to-fast-properties "^2.0.0"
+"@babel/types@^7.15.0":
+ version "7.15.0"
+ resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.15.0.tgz#61af11f2286c4e9c69ca8deb5f4375a73c72dcbd"
+ integrity sha512-OBvfqnllOIdX4ojTHpwZbpvz4j3EWyjkZEdmjH0/cgsd6QOdSgU8rLSk6ard/pcW7rlmjdVSX/AWOaORR1uNOQ==
+ dependencies:
+ "@babel/helper-validator-identifier" "^7.14.9"
+ to-fast-properties "^2.0.0"
+
"@bcoe/v8-coverage@^0.2.3":
version "0.2.3"
resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39"
@@ -3138,19 +3242,10 @@
dependencies:
"@types/react" "^16"
-"@types/react@*", "@types/react@^17.0.2", "@types/react@^17.0.6":
- version "17.0.15"
- resolved "https://registry.yarnpkg.com/@types/react/-/react-17.0.15.tgz#c7533dc38025677e312606502df7656a6ea626d0"
- integrity sha512-uTKHDK9STXFHLaKv6IMnwp52fm0hwU+N89w/p9grdUqcFA6WuqDyPhaWopbNyE1k/VhgzmHl8pu1L4wITtmlLw==
- dependencies:
- "@types/prop-types" "*"
- "@types/scheduler" "*"
- csstype "^3.0.2"
-
-"@types/react@^16":
- version "16.14.11"
- resolved "https://registry.yarnpkg.com/@types/react/-/react-16.14.11.tgz#992a0cd4b66b9f27315042b5d96e976717368f04"
- integrity sha512-Don0MtsZZ3fjwTJ2BsoqkyOy7e176KplEAKOpr/4XDdzinlyJBn9yfsKn5mcSgn4kh1B22+3tBnzBC1z63ybtQ==
+"@types/react@*", "@types/react@^16", "@types/react@^17", "@types/react@^17.0.2", "@types/react@^17.0.6":
+ version "17.0.19"
+ resolved "https://registry.yarnpkg.com/@types/react/-/react-17.0.19.tgz#8f2a85e8180a43b57966b237d26a29481dacc991"
+ integrity sha512-sX1HisdB1/ZESixMTGnMxH9TDe8Sk709734fEQZzCV/4lSu9kJCPbo2PbTRoZM+53Pp0P10hYVyReUueGwUi4A==
dependencies:
"@types/prop-types" "*"
"@types/scheduler" "*"
@@ -5632,6 +5727,11 @@ decode-uri-component@^0.2.0:
resolved "https://registry.yarnpkg.com/decode-uri-component/-/decode-uri-component-0.2.0.tgz#eb3913333458775cb84cd1a1fae062106bb87545"
integrity sha1-6zkTMzRYd1y4TNGh+uBiEGu4dUU=
+dedent-js@^1.0.1:
+ version "1.0.1"
+ resolved "https://registry.yarnpkg.com/dedent-js/-/dedent-js-1.0.1.tgz#bee5fb7c9e727d85dffa24590d10ec1ab1255305"
+ integrity sha1-vuX7fJ5yfYXf+iRZDRDsGrElUwU=
+
deep-is@^0.1.3, deep-is@~0.1.3:
version "0.1.3"
resolved "https://registry.yarnpkg.com/deep-is/-/deep-is-0.1.3.tgz#b369d6fb5dbc13eecf524f91b070feedc357cf34"
@@ -9496,6 +9596,13 @@ metro-transform-worker@0.66.2:
metro-transform-plugins "0.66.2"
nullthrows "^1.1.1"
+metro-with-symlinks@^1.4.0:
+ version "1.4.0"
+ resolved "https://registry.yarnpkg.com/metro-with-symlinks/-/metro-with-symlinks-1.4.0.tgz#bc6fb9079c2f49f1f554b8d351a62b3d84ebebe1"
+ integrity sha512-OgO7+On+GADaTlHVBPeZHEGaJeOK776DpLVT90Tq5b9LeGANPJPdVQTj73tY1Jce3c9g0HRz6Rvjpg95cVHDzw==
+ dependencies:
+ dedent-js "^1.0.1"
+
metro@0.64.0, metro@^0.64.0:
version "0.64.0"
resolved "https://registry.yarnpkg.com/metro/-/metro-0.64.0.tgz#0091a856cfbcc94dd576da563eee466e96186195"