react-native-test-app
Version:
react-native-test-app provides a test app for all supported platforms as a package
32 lines (28 loc) • 928 B
JavaScript
// @ts-check
;
const fs = require("fs");
const path = require("path");
try {
const nativeModulesScript = path.join(
path.dirname(
require.resolve(
"@react-native-community/cli-platform-android/package.json",
{ paths: [process.cwd()] }
)
),
"native_modules.gradle"
);
const script = fs.readFileSync(nativeModulesScript, { encoding: "utf-8" });
// TODO: Remove when `@react-native-community/cli` 6.0+ is required. See also
// https://github.com/react-native-community/cli/commit/fa0d09b2c9be144bbdff526bb14f171d7ddca88e
const patched = script.replace(
"ArrayList<HashMap<String, String>>[] packages = this.reactNativeModules",
"ArrayList<HashMap<String, String>> packages = this.reactNativeModules"
);
if (patched !== script) {
fs.writeFileSync(nativeModulesScript, patched);
}
} catch (_) {
// Ignore if we cannot patch
}