Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Moving to newer versions of react native #32

Open
Kemsa opened this issue Dec 6, 2022 · 2 comments
Open

Moving to newer versions of react native #32

Kemsa opened this issue Dec 6, 2022 · 2 comments

Comments

@Kemsa
Copy link

Kemsa commented Dec 6, 2022

Hi! 👋

Firstly, thanks for your work on this project! 🙂

Today I used patch-package to patch [email protected] 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.

Alwinator added a commit to Alwinator/react-native-http-bridge-refurbished that referenced this issue Jan 28, 2023
@ScreamZ
Copy link

ScreamZ commented Feb 7, 2023

Thanks

@Alwinator
Copy link

@Kemsa @ScreamZ Feel free to checkout: react-native-http-bridge-refurbished.

It is meant to be a maintained version of this repo.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants