patch react-native-notifications for RN 0.84 and improve android:clean

This commit is contained in:
myxmaster
2026-02-25 10:51:50 -05:00
committed by Evan Kaloudis
parent bb09f99c11
commit c7b6d21231
2 changed files with 20 additions and 1 deletions
+1 -1
View File
@@ -39,7 +39,7 @@
"prettier-write": "prettier --check --write \"**/*.ts*\"",
"gen-proto": "pbjs -t static-module --keep-case -w es6 --force-long -o proto/lightning.js proto/*.proto proto/*/*.proto && pbts -o proto/lightning.d.ts proto/lightning.js",
"gradlew": "cd android && ./gradlew",
"android:clean": "yarn gradlew clean",
"android:clean": "yarn gradlew clean && rm -rf android/build",
"fetch-libraries": "bash fetch-libraries.sh",
"fix-all": "yarn prettier-write && yarn lint-fix",
"lint-fix": "eslint . --fix"
@@ -139,4 +139,23 @@ public class FcmToken implements IFcmToken {
fs.writeFileSync(fcmTokenPath, fcmTokenContent);
console.log(' - Patched FcmToken.java for New Architecture support');
// Fix autolinking config for RN 0.84+
// The library's react-native.config.js uses reactNativeHost.getApplication()
// but in RN 0.84, PackageList(Application) sets reactNativeHost to null.
// Change to use the application field directly.
const configPath =
'./node_modules/react-native-notifications/react-native.config.js';
if (fs.existsSync(configPath)) {
let configContent = fs.readFileSync(configPath, 'utf8');
if (configContent.includes('reactNativeHost.getApplication()')) {
configContent = configContent.replace(
'reactNativeHost.getApplication()',
'application'
);
fs.writeFileSync(configPath, configContent);
console.log(' - Patched react-native.config.js for RN 0.84 compatibility');
}
}
}