-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[expo-dev-menu] Make internal runtime undebuggable (#19269)
# Why Takes advantage of facebook/react-native#34489. It'll improve our integration with Hermes inspector - users don't have to reload their app anymore to see correct sources. # How Set `enable debugger` on internal runtimes. # Test Plan I couldn't test it properly because our basic template crashes with RN `0.70`.
- Loading branch information
Showing
6 changed files
with
44 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
packages/expo-dev-menu/android/src/main/java/expo/modules/devmenu/react/DevMenuHostHelper.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package expo.modules.devmenu.react | ||
|
||
import android.app.Application | ||
import com.facebook.hermes.reactexecutor.HermesExecutorFactory | ||
import com.facebook.react.bridge.JavaScriptExecutorFactory | ||
import com.facebook.react.jscexecutor.JSCExecutorFactory | ||
import com.facebook.react.modules.systeminfo.AndroidInfoHelpers | ||
import com.facebook.soloader.SoLoader | ||
|
||
fun createNonDebuggableJavaScriptExecutorFactory(application: Application): JavaScriptExecutorFactory { | ||
SoLoader.init(application.applicationContext, /* native exopackage */ false) | ||
if (SoLoader.getLibraryPath("libjsc.so") != null) { | ||
return JSCExecutorFactory(application.packageName, AndroidInfoHelpers.getFriendlyDeviceName()) | ||
} | ||
return HermesExecutorFactory().also { | ||
try { | ||
HermesExecutorFactory::class.java | ||
.getMethod("setEnableDebugger", Boolean::class.java) | ||
.invoke(it, false) | ||
} catch (_: Throwable) { | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters