openreplay/tracker/tracker-reactnative/app.plugin.js
Shekar Siri 9a37ba0739
feat(react-native): expo support (#2850)
* change(react-native): android version jump

* change(react-native): updates to support expo

* change(react-native): swipe event fix

* change(react-native): version jump

* change(react-native): include plugin file and version jump
2024-12-11 09:41:16 +01:00

22 lines
758 B
JavaScript

const { withMainApplication } = require('@expo/config-plugins');
function addPackageToMainApplication(src) {
console.log('Adding OpenReplay package to MainApplication.java', src);
// Insert `packages.add(new ReactNativePackage());` before return packages;
if (src.includes('packages.add(new ReactNativePackage())')) {
return src;
}
return src.replace(
'return packages;',
`packages.add(new com.openreplay.reactnative.ReactNativePackage());\n return packages;`
);
}
module.exports = function configPlugin(config) {
return withMainApplication(config, (config) => {
if (config.modResults.contents) {
config.modResults.contents = addPackageToMainApplication(config.modResults.contents);
}
return config;
});
};