Преглед изворни кода

Make example app easier to run

Janic Duplessis пре 4 година
родитељ
комит
05bdb89f95
9 измењених фајлова са 7271 додато и 198 уклоњено
  1. 1
    2
      example/App.tsx
  2. 1
    1
      example/app.json
  3. 12
    0
      example/babel.config.js
  4. 1
    1
      example/ios/SafeAreaViewExample.xcodeproj/project.pbxproj
  5. 10
    0
      example/package.json
  6. 0
    17
      metro.config.js
  7. 5
    1
      package.json
  8. 5
    1
      tsconfig.json
  9. 7236
    175
      yarn.lock

+ 1
- 2
example/App.tsx Прегледај датотеку

1
 import * as React from 'react';
1
 import * as React from 'react';
2
 import { View, Text, StatusBar, ScrollView } from 'react-native';
2
 import { View, Text, StatusBar, ScrollView } from 'react-native';
3
 
3
 
4
-// import { SafeAreaProvider, useSafeArea } from 'react-native-safe-area-context'; in your app.
5
 import {
4
 import {
6
   SafeAreaProvider,
5
   SafeAreaProvider,
7
   useSafeAreaInsets,
6
   useSafeAreaInsets,
8
   initialWindowMetrics,
7
   initialWindowMetrics,
9
   useSafeAreaFrame,
8
   useSafeAreaFrame,
10
-} from '../src';
9
+} from 'react-native-safe-area-context';
11
 
10
 
12
 const DataView = ({ data }: { data: object | null | undefined }) => (
11
 const DataView = ({ data }: { data: object | null | undefined }) => (
13
   <Text style={{ fontSize: 16, lineHeight: 24, color: '#292929' }}>
12
   <Text style={{ fontSize: 16, lineHeight: 24, color: '#292929' }}>

+ 1
- 1
example/app.json Прегледај датотеку

2
   "name": "SafeAreaViewExample",
2
   "name": "SafeAreaViewExample",
3
   "displayName": "SafeAreaViewExample",
3
   "displayName": "SafeAreaViewExample",
4
   "expo": {
4
   "expo": {
5
-    "entryPoint": "./example/index",
5
+    "entryPoint": "./example/index.expo",
6
     "name": "react-native-safe-area-context",
6
     "name": "react-native-safe-area-context",
7
     "slug": "react-native-safe-area-context",
7
     "slug": "react-native-safe-area-context",
8
     "version": "0.1.0",
8
     "version": "0.1.0",

+ 12
- 0
example/babel.config.js Прегледај датотеку

1
+module.exports = {
2
+  plugins: [
3
+    [
4
+      'module-resolver',
5
+      {
6
+        alias: {
7
+          'react-native-safe-area-context': './src',
8
+        },
9
+      },
10
+    ],
11
+  ],
12
+};

+ 1
- 1
example/ios/SafeAreaViewExample.xcodeproj/project.pbxproj Прегледај датотеку

248
 			);
248
 			);
249
 			runOnlyForDeploymentPostprocessing = 0;
249
 			runOnlyForDeploymentPostprocessing = 0;
250
 			shellPath = /bin/sh;
250
 			shellPath = /bin/sh;
251
-			shellScript = "export RCT_METRO_PORT=\"${RCT_METRO_PORT:=8081}\"\necho \"export RCT_METRO_PORT=${RCT_METRO_PORT}\" > \"${SRCROOT}/../../node_modules/react-native/scripts/.packager.env\"\nif [ -z \"${RCT_NO_LAUNCH_PACKAGER+xxx}\" ] ; then\n  if nc -w 5 -z localhost ${RCT_METRO_PORT} ; then\n    if ! curl -s \"http://localhost:${RCT_METRO_PORT}/status\" | grep -q \"packager-status:running\" ; then\n      echo \"Port ${RCT_METRO_PORT} already in use, packager is either not running or not running correctly\"\n      exit 2\n    fi\n  else\n    open \"$SRCROOT/../node_modules/react-native/scripts/launchPackager.command\" || echo \"Can't start packager automatically\"\n  fi\nfi\n";
251
+			shellScript = "export RCT_METRO_PORT=\"${RCT_METRO_PORT:=8081}\"\necho \"export RCT_METRO_PORT=${RCT_METRO_PORT}\" > \"${SRCROOT}/../../node_modules/react-native/scripts/.packager.env\"\nif [ -z \"${RCT_NO_LAUNCH_PACKAGER+xxx}\" ] ; then\n  if nc -w 5 -z localhost ${RCT_METRO_PORT} ; then\n    if ! curl -s \"http://localhost:${RCT_METRO_PORT}/status\" | grep -q \"packager-status:running\" ; then\n      echo \"Port ${RCT_METRO_PORT} already in use, packager is either not running or not running correctly\"\n      exit 2\n    fi\n  else\n    open \"$SRCROOT/../../node_modules/react-native/scripts/launchPackager.command\" || echo \"Can't start packager automatically\"\n  fi\nfi\n";
252
 			showEnvVarsInLog = 0;
252
 			showEnvVarsInLog = 0;
253
 		};
253
 		};
254
 /* End PBXShellScriptBuildPhase section */
254
 /* End PBXShellScriptBuildPhase section */

+ 10
- 0
example/package.json Прегледај датотеку

1
+{
2
+  "name": "example",
3
+  "dependencies": {
4
+    "expo": "^37.0.8",
5
+    "react": "^16.13.1",
6
+    "react-dom": "^16.13.1",
7
+    "react-native": "^0.63.0-rc.0",
8
+    "react-native-web": "^0.12.2"
9
+  }
10
+}

+ 0
- 17
metro.config.js Прегледај датотеку

1
-/**
2
- * Metro configuration for React Native
3
- * https://github.com/facebook/react-native
4
- *
5
- * @format
6
- */
7
-
8
-module.exports = {
9
-  transformer: {
10
-    getTransformOptions: async () => ({
11
-      transform: {
12
-        experimentalImportSupport: false,
13
-        inlineRequires: false,
14
-      },
15
-    }),
16
-  },
17
-};

+ 5
- 1
package.json Прегледај датотеку

28
     "validate:prettier": "prettier \"src/**/*.{js,ts,tsx}\" \"example/**/*.{js,ts,tsx}\" --check",
28
     "validate:prettier": "prettier \"src/**/*.{js,ts,tsx}\" \"example/**/*.{js,ts,tsx}\" --check",
29
     "validate:jest": "jest",
29
     "validate:jest": "jest",
30
     "prepare": "bob build",
30
     "prepare": "bob build",
31
-    "example:ios": "cd example && react-native run-ios"
31
+    "example:ios": "cd ./example && react-native run-ios",
32
+    "example:android": "cd ./example && react-native run-android --no-jetifier",
33
+    "example:expo": "expo start --config example/app.json"
32
   },
34
   },
33
   "keywords": [
35
   "keywords": [
34
     "react-native",
36
     "react-native",
53
     "@types/react-test-renderer": "^16.9.2",
55
     "@types/react-test-renderer": "^16.9.2",
54
     "@typescript-eslint/eslint-plugin": "^2.30.0",
56
     "@typescript-eslint/eslint-plugin": "^2.30.0",
55
     "@typescript-eslint/parser": "^2.30.0",
57
     "@typescript-eslint/parser": "^2.30.0",
58
+    "babel-plugin-module-resolver": "^4.0.0",
56
     "eslint": "6.8.0",
59
     "eslint": "6.8.0",
57
     "eslint-config-prettier": "^6.11.0",
60
     "eslint-config-prettier": "^6.11.0",
58
     "eslint-plugin-prettier": "3.1.3",
61
     "eslint-plugin-prettier": "3.1.3",
59
     "expo": "^37.0.8",
62
     "expo": "^37.0.8",
63
+    "expo-cli": "^3.20.1",
60
     "jest": "^25.5.4",
64
     "jest": "^25.5.4",
61
     "metro-react-native-babel-preset": "^0.59.0",
65
     "metro-react-native-babel-preset": "^0.59.0",
62
     "prettier": "^2.0.5",
66
     "prettier": "^2.0.5",

+ 5
- 1
tsconfig.json Прегледај датотеку

12
     "moduleResolution": "node",
12
     "moduleResolution": "node",
13
     "skipLibCheck": true,
13
     "skipLibCheck": true,
14
     "lib": ["dom", "es2015", "es2016", "esnext"],
14
     "lib": ["dom", "es2015", "es2016", "esnext"],
15
-    "jsx": "react-native"
15
+    "jsx": "react-native",
16
+    "baseUrl": ".",
17
+    "paths": {
18
+      "react-native-safe-area-context": ["./src"]
19
+    }
16
   },
20
   },
17
   "exclude": ["node_modules"]
21
   "exclude": ["node_modules"]
18
 }
22
 }

+ 7236
- 175
yarn.lock
Разлика између датотеке није приказан због своје велике величине
Прегледај датотеку