Skip to content

Instantly share code, notes, and snippets.

@vanGalilea
Created January 21, 2025 19:52
Show Gist options
  • Save vanGalilea/59c149a6c11c78082a4f4aaaae4fc993 to your computer and use it in GitHub Desktop.
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.
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;
});
};
@vanGalilea
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment