-
Notifications
You must be signed in to change notification settings - Fork 44
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(expo-config-plugin): create config plugin for react-native-performance #145
Conversation
6aec4c5
to
e334543
Compare
e334543
to
f6fb98c
Compare
f722e88
to
4aaf951
Compare
return withAppDelegate(expoConfig, iosConfig => { | ||
if (!['objc', 'objcpp'].includes(iosConfig.modResults.language)) { | ||
throw new Error( | ||
"react-native-google-cast config plugin does not support AppDelegate' that aren't Objective-C(++) yet.", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"react-native-google-cast config plugin does not support AppDelegate' that aren't Objective-C(++) yet.", | |
"react-native-performance config plugin does not support AppDelegate' that aren't Objective-C(++) yet.", |
copy pasta error 🍝
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for pointing this out. I'll rename both errors 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for your work on this, I really appreciate it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No problem! I am currently working with the team in charge of this to try and take the next steps to get it merged.
const newLine = ' ReactNativePerformance.onAppStarted();\n'; | ||
return withMainApplication(expoConfig, async androidConfig => { | ||
if (androidConfig.modResults.language !== 'java') { | ||
throw new Error('react-native-google-cast config plugin does not support kotlin MainActivity yet.'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
throw new Error('react-native-google-cast config plugin does not support kotlin MainActivity yet.'); | |
throw new Error('react-native-performance config plugin does not support kotlin MainActivity yet.'); |
01f0051
to
be04ca9
Compare
be04ca9
to
54ae7f1
Compare
Can we get an update on this? I'd like to use this library in my Expo app |
Is this suggesting the package is compatible with expo? |
any plans to merge it? |
@friyiajr Is this ready to be merged? |
@friyiajr I was able to get this config plugin working with expo sdk 50 (which uses kotlin files now in their prebuild) const withRequiredAndroidMainApplicationSetup: ConfigPlugin = (expoConfig) => {
const importStatement =
'com.shopify.reactnativeperformance.ReactNativePerformance';
return withMainApplication(expoConfig, async (androidConfig) => {
const isJava = androidConfig.modResults.language === 'java';
const newLine = ` ReactNativePerformance.onAppStarted()${
isJava ? ';' : ''
}\n`;
const srcWithNewImport = addImports(
androidConfig.modResults.contents,
[importStatement],
isJava
);
androidConfig.modResults.contents = mergeContents({
tag: 'react-native-performance-onCreate-android',
src: srcWithNewImport,
newSrc: newLine,
anchor: MATCH_ON_CREATE,
offset: 0,
comment: '//',
}).contents;
return androidConfig;
});
}; |
Motivation
Expo is becoming an increasingly popular way of building React-Native projects. It is important that we support their ecosystem in order to keep this library relevant in the RN Community.
NOTE: Reverted the import change found here because it seemed to be breaking builds in Vanilla RN and Expo Projects. Please double check this fix works on your end @ElviraBurchik.
Description
Fixes N/A
This Pull request adds a plugin folder to the library that has the code for the Expo Config-Plugin. No other code was touched. The purpose of the Config plugin is just to update the code on the library consumer's end
Test plan
yarn
to install all dependanciesyarn build
to build the config plugin locallycd
into theExpoFixture
and runyarn
again to install it's dependanciesnpx expo prebuild
to do all native code setupFor iOS:
For Android:
Checklist