Bläddra i källkod

react-navigation 설치 및 환경설정

goodboy 6 år sedan
förälder
incheckning
b6ada27820
2 ändrade filer med 18 tillägg och 3 borttagningar
  1. 13 1
      android/app/src/main/java/com/emptyapp/MainActivity.java
  2. 5 2
      package.json

+ 13 - 1
android/app/src/main/java/com/emptyapp/MainActivity.java

@@ -1,7 +1,9 @@
 package com.emptyapp;
 
 import com.facebook.react.ReactActivity;
-
+import com.facebook.react.ReactActivityDelegate;
+import com.facebook.react.ReactRootView; 
+import com.swmansion.gesturehandler.react.RNGestureHandlerEnabledRootView;
 public class MainActivity extends ReactActivity {
 
     /**
@@ -12,4 +14,14 @@ public class MainActivity extends ReactActivity {
     protected String getMainComponentName() {
         return "emptyapp";
     }
+
+    @Override
+    protected ReactActivityDelegate createReactActivityDelegate() {
+        return new ReactActivityDelegate(this, getMainComponentName()) {
+            @Override
+            protected ReactRootView createRootView() {
+                return new RNGestureHandlerEnabledRootView(MainActivity.this);
+            }
+        };
+    }    
 }

+ 5 - 2
package.json

@@ -5,16 +5,18 @@
   "scripts": {
     "start": "react-native start",
     "test": "jest",
-    "lint": "eslint ."
+    "lint": "eslint .",
+    "postinstall": "jetify"
   },
   "dependencies": {
     "i18n-js": "^3.3.0",
     "react": "16.8.6",
     "react-native": "0.60.3",
     "react-native-elements": "^1.1.0",
+    "react-native-gesture-handler": "^1.3.0",
     "react-native-keep-awake": "^4.0.0",
-    "react-native-router-flux": "^4.0.6",
     "react-native-vector-icons": "^6.6.0",
+    "react-navigation": "^3.11.1",
     "rn-class": "^1.0.20"
   },
   "devDependencies": {
@@ -24,6 +26,7 @@
     "babel-jest": "^24.8.0",
     "eslint": "^6.0.1",
     "jest": "^24.8.0",
+    "jetifier": "^1.6.3",
     "metro-react-native-babel-preset": "^0.55.0",
     "react-test-renderer": "16.8.6"
   },