Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -858,7 +858,7 @@ public void removeListeners(Integer count) {
public ReactHostDelegate getReactHostDelegate(ReactHostImpl reactHostImpl) {
try {
Class<?> clazz = reactHostImpl.getClass();
Field field = clazz.getDeclaredField("mReactHostDelegate");
Field field = clazz.getDeclaredField("reactHostDelegate");
field.setAccessible(true);

// Get the value of the field for the provided instance
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,46 +4,38 @@ import android.app.Application
import com.facebook.react.PackageList
import com.facebook.react.ReactApplication
import com.facebook.react.ReactHost
import com.facebook.react.ReactNativeApplicationEntryPoint.loadReactNative
import com.facebook.react.ReactNativeHost
import com.facebook.react.ReactPackage
import com.facebook.react.common.annotations.UnstableReactNativeAPI
import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint.load
import com.facebook.react.defaults.DefaultReactHost.getDefaultReactHost
import com.facebook.react.defaults.DefaultReactNativeHost
import com.facebook.react.soloader.OpenSourceMergedSoMapping
import com.facebook.soloader.SoLoader

import com.microsoft.codepush.react.CodePush

@OptIn(UnstableReactNativeAPI::class)
class MainApplication : Application(), ReactApplication {

override val reactNativeHost: ReactNativeHost =
override val reactNativeHost: ReactNativeHost =
object : DefaultReactNativeHost(this) {
override fun getPackages(): List<ReactPackage> {
val packages = PackageList(this).packages
// Packages that cannot be autolinked yet can be added manually here, for example:
// packages.add(new MyReactNativePackage());
return packages
}

override fun getPackages(): List<ReactPackage> =
PackageList(this).packages.apply {
// Packages that cannot be autolinked yet can be added manually here, for example:
// add(MyReactNativePackage())
}

override fun getJSMainModuleName(): String = "index"
override fun getJSBundleFile(): String = CodePush.getJSBundleFile()

override fun getUseDeveloperSupport(): Boolean = BuildConfig.DEBUG

override val isNewArchEnabled: Boolean = BuildConfig.IS_NEW_ARCHITECTURE_ENABLED
override val isHermesEnabled: Boolean = BuildConfig.IS_HERMES_ENABLED
}

override val reactHost: ReactHost get() = getDefaultReactHost(this, reactNativeHost)
override val reactHost: ReactHost
get() = getDefaultReactHost(applicationContext, reactNativeHost)

override fun onCreate() {
super.onCreate()
SoLoader.init(this, OpenSourceMergedSoMapping)
if (BuildConfig.IS_NEW_ARCHITECTURE_ENABLED) {
// If you opted-in for the New Architecture, we load the native entry point for this app.
load()
}
loadReactNative(this)
}

}
}
6 changes: 3 additions & 3 deletions test/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ class RNAndroid extends Platform.Android implements RNPlatform {
// we use hard-coded deployment key and server url in app.json
return Q.Promise<void>((resolve, reject) => {
TestUtil.replaceString(androidMainActivityPath, "\"main\"", `"${TestConfig.TestAppName}"`);
TestUtil.replaceString(AndroidManifest, "android:allowBackup=\"true\"", "android:allowBackup=\"true\"" + "\n\t" + "android:usesCleartextTraffic=\"true\"");
TestUtil.replaceString(AndroidManifest, "\\${usesCleartextTraffic}", "true");
resolve(null);
});
}
Expand Down Expand Up @@ -117,7 +117,7 @@ class RNAndroid extends Platform.Android implements RNPlatform {
const string = path.join(innerprojectDirectory, "android", "app", "src", "main", "res", "values", "strings.xml");
TestUtil.replaceString(string, TestUtil.SERVER_URL_PLACEHOLDER, this.getServerUrl());
TestUtil.replaceString(string, TestUtil.ANDROID_KEY_PLACEHOLDER, this.getDefaultDeploymentKey());
TestUtil.replaceString(AndroidManifest, "android:allowBackup=\"false\"", "android:allowBackup=\"false\"" + "\n\t" + "android:usesCleartextTraffic=\"true\"");
TestUtil.replaceString(AndroidManifest, "\\${usesCleartextTraffic}", "true");


return Q<void>(null);
Expand Down Expand Up @@ -342,7 +342,7 @@ class RNProjectManager extends ProjectManager {
.then(TestUtil.getProcessOutput.bind(undefined, `npx expo prebuild --clean`, { cwd: path.join(projectDirectory, TestConfig.TestAppName) }))
.then(() => { return null; });
} else {
return TestUtil.getProcessOutput("npx @react-native-community/cli init " + appName + " --version 0.80.1 --install-pods", { cwd: projectDirectory, timeout: 30 * 60 * 1000 })
return TestUtil.getProcessOutput("npx @react-native-community/cli init " + appName + " --version 0.81.5 --install-pods", { cwd: projectDirectory, timeout: 30 * 60 * 1000 })
.then((e) => { console.log(`"npx @react-native-community/cli init ${appName}" success. cwd=${projectDirectory}`); return e; })
.then(this.copyTemplate.bind(this, templatePath, projectDirectory))
.then<void>(TestUtil.getProcessOutput.bind(undefined, TestConfig.thisPluginInstallString, { cwd: path.join(projectDirectory, TestConfig.TestAppName) }))
Expand Down
Loading