aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/examples/with-react-native-web/packages
diff options
context:
space:
mode:
author简律纯 <hsiangnianian@outlook.com>2023-04-28 01:47:57 +0800
committer简律纯 <hsiangnianian@outlook.com>2023-04-28 01:47:57 +0800
commit8b2c4a38a461ff5ecc95972291bc711e2c5dec9a (patch)
tree29f552e3df949073e21bf5c76d7abc3044830ec6 /examples/with-react-native-web/packages
parentfc8c5fdce62fb229202659408798a7b6c98f6e8b (diff)
downloadHydroRoll-8b2c4a38a461ff5ecc95972291bc711e2c5dec9a.tar.gz
HydroRoll-8b2c4a38a461ff5ecc95972291bc711e2c5dec9a.zip
Diffstat (limited to 'examples/with-react-native-web/packages')
-rw-r--r--examples/with-react-native-web/packages/tsconfig/base.json20
-rw-r--r--examples/with-react-native-web/packages/tsconfig/nextjs.json20
-rw-r--r--examples/with-react-native-web/packages/tsconfig/package.json9
-rw-r--r--examples/with-react-native-web/packages/tsconfig/react-native-library.json13
-rw-r--r--examples/with-react-native-web/packages/ui/.gitignore28
-rw-r--r--examples/with-react-native-web/packages/ui/package.json22
-rw-r--r--examples/with-react-native-web/packages/ui/src/button.tsx37
-rw-r--r--examples/with-react-native-web/packages/ui/src/index.tsx1
-rw-r--r--examples/with-react-native-web/packages/ui/tsconfig.json8
9 files changed, 158 insertions, 0 deletions
diff --git a/examples/with-react-native-web/packages/tsconfig/base.json b/examples/with-react-native-web/packages/tsconfig/base.json
new file mode 100644
index 0000000..d72a9f3
--- /dev/null
+++ b/examples/with-react-native-web/packages/tsconfig/base.json
@@ -0,0 +1,20 @@
+{
+ "$schema": "https://json.schemastore.org/tsconfig",
+ "display": "Default",
+ "compilerOptions": {
+ "composite": false,
+ "declaration": true,
+ "declarationMap": true,
+ "esModuleInterop": true,
+ "forceConsistentCasingInFileNames": true,
+ "inlineSources": false,
+ "isolatedModules": true,
+ "moduleResolution": "node",
+ "noUnusedLocals": false,
+ "noUnusedParameters": false,
+ "preserveWatchOutput": true,
+ "skipLibCheck": true,
+ "strict": true
+ },
+ "exclude": ["node_modules"]
+}
diff --git a/examples/with-react-native-web/packages/tsconfig/nextjs.json b/examples/with-react-native-web/packages/tsconfig/nextjs.json
new file mode 100644
index 0000000..e45500d
--- /dev/null
+++ b/examples/with-react-native-web/packages/tsconfig/nextjs.json
@@ -0,0 +1,20 @@
+{
+ "$schema": "https://json.schemastore.org/tsconfig",
+ "display": "Next.js",
+ "extends": "./base.json",
+ "compilerOptions": {
+ "allowJs": true,
+ "declaration": false,
+ "declarationMap": false,
+ "incremental": true,
+ "jsx": "preserve",
+ "lib": ["dom", "dom.iterable", "esnext"],
+ "module": "esnext",
+ "noEmit": true,
+ "resolveJsonModule": true,
+ "strict": false,
+ "target": "es5"
+ },
+ "include": ["src", "next-env.d.ts"],
+ "exclude": ["node_modules"]
+}
diff --git a/examples/with-react-native-web/packages/tsconfig/package.json b/examples/with-react-native-web/packages/tsconfig/package.json
new file mode 100644
index 0000000..6efb83e
--- /dev/null
+++ b/examples/with-react-native-web/packages/tsconfig/package.json
@@ -0,0 +1,9 @@
+{
+ "name": "tsconfig",
+ "version": "0.0.0",
+ "private": true,
+ "license": "MIT",
+ "publishConfig": {
+ "access": "public"
+ }
+}
diff --git a/examples/with-react-native-web/packages/tsconfig/react-native-library.json b/examples/with-react-native-web/packages/tsconfig/react-native-library.json
new file mode 100644
index 0000000..d03da4b
--- /dev/null
+++ b/examples/with-react-native-web/packages/tsconfig/react-native-library.json
@@ -0,0 +1,13 @@
+{
+ "$schema": "https://json.schemastore.org/tsconfig",
+ "display": "React Native Library",
+ "extends": "./base.json",
+ "compilerOptions": {
+ "allowJs": true,
+ "jsx": "react",
+ "lib": ["DOM", "ESNext"],
+ "noEmit": true,
+ "resolveJsonModule": true,
+ "target": "ESNext"
+ }
+}
diff --git a/examples/with-react-native-web/packages/ui/.gitignore b/examples/with-react-native-web/packages/ui/.gitignore
new file mode 100644
index 0000000..cf309c2
--- /dev/null
+++ b/examples/with-react-native-web/packages/ui/.gitignore
@@ -0,0 +1,28 @@
+# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
+
+# dependencies
+node_modules
+.pnp
+.pnp.js
+
+
+# misc
+.DS_Store
+*.pem
+
+# build
+dist
+
+# debug
+npm-debug.log*
+yarn-debug.log*
+yarn-error.log*
+
+# local env files
+.env.local
+.env.development.local
+.env.test.local
+.env.production.local
+
+# turbo
+.turbo \ No newline at end of file
diff --git a/examples/with-react-native-web/packages/ui/package.json b/examples/with-react-native-web/packages/ui/package.json
new file mode 100644
index 0000000..1915593
--- /dev/null
+++ b/examples/with-react-native-web/packages/ui/package.json
@@ -0,0 +1,22 @@
+{
+ "name": "ui",
+ "version": "0.0.0",
+ "main": "./dist/index.js",
+ "types": "./dist/index.d.ts",
+ "scripts": {
+ "build": "tsup src/index.tsx --format esm,cjs --dts --external react",
+ "dev": "tsup src/index.tsx --format esm,cjs --watch --dts --external react",
+ "clean": "rm -rf dist"
+ },
+ "devDependencies": {
+ "@types/react": "^18.0.22",
+ "@types/react-native": "^0.69.15",
+ "tsconfig": "*",
+ "tsup": "^6.0.1",
+ "typescript": "^4.7.4"
+ },
+ "dependencies": {
+ "react": "^18.1.0",
+ "react-native": "^0.70.3"
+ }
+}
diff --git a/examples/with-react-native-web/packages/ui/src/button.tsx b/examples/with-react-native-web/packages/ui/src/button.tsx
new file mode 100644
index 0000000..a94f4ec
--- /dev/null
+++ b/examples/with-react-native-web/packages/ui/src/button.tsx
@@ -0,0 +1,37 @@
+import * as React from "react";
+import {
+ TouchableOpacity,
+ StyleSheet,
+ GestureResponderEvent,
+ Text,
+} from "react-native";
+
+export interface ButtonProps {
+ text: string;
+ onClick?: (event: GestureResponderEvent) => void;
+}
+
+export function Button({ text, onClick }: ButtonProps) {
+ return (
+ <TouchableOpacity style={styles.button} onPress={onClick}>
+ <Text style={styles.text}>{text}</Text>
+ </TouchableOpacity>
+ );
+}
+
+const styles = StyleSheet.create({
+ button: {
+ maxWidth: 200,
+ textAlign: "center",
+ borderRadius: 10,
+ paddingTop: 14,
+ paddingBottom: 14,
+ paddingLeft: 30,
+ paddingRight: 30,
+ fontSize: "15px",
+ backgroundColor: "#2f80ed",
+ },
+ text: {
+ color: "white",
+ },
+});
diff --git a/examples/with-react-native-web/packages/ui/src/index.tsx b/examples/with-react-native-web/packages/ui/src/index.tsx
new file mode 100644
index 0000000..f4ea832
--- /dev/null
+++ b/examples/with-react-native-web/packages/ui/src/index.tsx
@@ -0,0 +1 @@
+export { Button, type ButtonProps } from "./button";
diff --git a/examples/with-react-native-web/packages/ui/tsconfig.json b/examples/with-react-native-web/packages/ui/tsconfig.json
new file mode 100644
index 0000000..f0455ac
--- /dev/null
+++ b/examples/with-react-native-web/packages/ui/tsconfig.json
@@ -0,0 +1,8 @@
+{
+ "extends": "tsconfig/react-native-library",
+ "include": ["."],
+ "exclude": ["dist", "build", "node_modules"],
+ "compilerOptions": {
+ "strict": true
+ }
+}