Created
January 21, 2025 19:52
-
-
Save vanGalilea/59c149a6c11c78082a4f4aaaae4fc993 to your computer and use it in GitHub Desktop.
A custom Expo plugin to make the Adyen React Native library compatible with Expo SDK 52.
This file contains hidden or 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
const { withMainActivity } = require("@expo/config-plugins"); | |
/** | |
* A custom Expo plugin to make the Adyen React Native library compatible with Expo SDK 52. | |
* | |
* The Adyen library currently defines the `onNewIntent` method in Kotlin with a nullable | |
* `Intent?` parameter, which is incorrect according to Android's API specifications. | |
* This mismatch causes build failures during the `:app:compileDebugKotlin` task. | |
* | |
* The plugin resolves this issue by replacing the nullable `Intent?` parameter in the | |
* `onNewIntent` method with a non-nullable `Intent` parameter in the generated `MainActivity` file. | |
* | |
* This is a temporary fix while waiting for an official update to the Adyen library | |
* that addresses this issue. | |
* | |
* @see https://github.com/Adyen/adyen-react-native/pull/564 | |
*/ | |
module.exports = (config) => { | |
return withMainActivity(config, (newConfig) => { | |
const mainActivity = newConfig.modResults; | |
mainActivity.contents = mainActivity.contents.replace( | |
"override fun onNewIntent(intent: Intent?) {", | |
"override fun onNewIntent(intent: Intent) {", | |
); | |
return newConfig; | |
}); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Make sure to add this to your app.json / app.config.js under plugins and make sure it's the 1st plugin in the array