Skip to content

Moving to newer versions of react native#32

Description

@Kemsa

Hi! 馃憢

Firstly, thanks for your work on this project! 馃檪

Today I used patch-package to patch react-native-http-bridge@0.6.1 for the project I'm working on.

I work with the latest react native (0.70) with a recent gradle version, here are the steps I did to make it compatible. (essentially changed compile to implementation and migrate android lib to androidx lib).

Here is the diff that solved my problem:

diff --git a/node_modules/react-native-http-bridge/android/build.gradle b/node_modules/react-native-http-bridge/android/build.gradle
index 9417a5f..21a7664 100644
--- a/node_modules/react-native-http-bridge/android/build.gradle
+++ b/node_modules/react-native-http-bridge/android/build.gradle
@@ -34,7 +34,7 @@ android {
 }
 
 dependencies {
-    compile 'com.facebook.react:react-native:+'
-    compile 'com.google.android.gms:play-services-gcm:+'
-    compile 'org.nanohttpd:nanohttpd:2.3.1'
+    implementation  'com.facebook.react:react-native:+'
+    implementation  'com.google.android.gms:play-services-gcm:+'
+    implementation  'org.nanohttpd:nanohttpd:2.3.1'
 }
diff --git a/node_modules/react-native-http-bridge/android/src/main/java/me/alwx/HttpServer/Server.java b/node_modules/react-native-http-bridge/android/src/main/java/me/alwx/HttpServer/Server.java
index decf9f2..24f1500 100644
--- a/node_modules/react-native-http-bridge/android/src/main/java/me/alwx/HttpServer/Server.java
+++ b/node_modules/react-native-http-bridge/android/src/main/java/me/alwx/HttpServer/Server.java
@@ -14,7 +14,7 @@ import java.util.Set;
 import java.util.HashMap;
 import java.util.Random;
 
-import android.support.annotation.Nullable;
+import androidx.annotation.Nullable;
 import android.util.Log;
 
 public class Server extends NanoHTTPD {
@@ -44,8 +44,7 @@ public class Server extends NanoHTTPD {
             request = fillRequestMap(session, requestId);
         } catch (Exception e) {
             return newFixedLengthResponse(
-                    Response.Status.INTERNAL_ERROR, MIME_PLAINTEXT, e.getMessage()
-            );
+                    Response.Status.INTERNAL_ERROR, MIME_PLAINTEXT, e.getMessage());
         }
 
         this.sendEvent(reactContext, SERVER_EVENT_ID, request);
@@ -76,7 +75,7 @@ public class Server extends NanoHTTPD {
         Map<String, String> files = new HashMap<>();
         session.parseBody(files);
         if (files.size() > 0) {
-          request.putString("postData", files.get("postData"));
+            request.putString("postData", files.get("postData"));
         }
 
         return request;

This issue body was partially generated by patch-package.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions