bamlab / react-native-flipper-performance-monitor

An attempt to have a lighthouse for React Native. Flipper plugin to show a graph of the React Native performance monitor
MIT License
584 stars 17 forks source link

Flipper plugin getting failed on android #67

Open AdityaPahilwani opened 2 years ago

AdityaPahilwani commented 2 years ago

The Flipper plugin was getting failed on android, when I tried to debug it I could see somehow the plugin which sets the reactContext is getting null, I couldn't draw any more points beyond that. can you folks please help me to solve this?

debug log

android config

// build details
versions.compileSdkVersion = 28
versions.buildToolsVersion = '30.0.3'
versions.minSdkVersion = 21
versions.targetSdkVersion = 31
versions.flipper = '0.125.0'

RN deps

"react": "17.0.2",
"react-native": "0.66.4",
"react-native-flipper": "0.125.0",
"react-native-flipper-performance-plugin": "^0.3.1",
Almouro commented 2 years ago

Good debugging skills! Interesting that the Flipper plugin instance is null here, we added a weird hack for Expo projects to pass the React Context from the bridge (https://github.com/bamlab/react-native-flipper-performance-monitor/pull/56)

Basically this plugin is also a native RN module, which is automatically linked and pass the react context to the current Flipper plugin when instantiated. So that's why I had removed the line to pass in the reactInstanceManager

But in your case, the bridge seems to be instantiated before the Flipper plugin, so safer to change the doc like you did!

Thanks for the PR!

AdityaPahilwani commented 2 years ago

Actually, even after reactInstanceManager as param. the flipper plugin is getting null. so it's still not solved for me. though reactInstanceManager is passed correctly still the flipper plugin gets null. can you help me with where to look at?

Almouro commented 2 years ago

Oh my bad for closing then! Yeah I've just realized passing reactInstanceManager doesn't actually do anything anymore

Can you try version 0.2.1 of the plugin?

AdityaPahilwani commented 2 years ago

Sorry I was sick, couldn't try it. I will try this on Monday and will update soon

AdityaPahilwani commented 2 years ago

I tried it, but it didn't work.

we create our react context in the background, with createReactContextInBackground can that cause any issue?

Almouro commented 2 years ago

Hey @AdityaPahilwani, hope you're feeling better!!

Ah indeed that might be the cause! There's a simple example on the repo https://github.com/bamlab/react-native-flipper-performance-monitor/tree/master/example, if you have time, would you be able to check if it works if we use createReactContextInBackground? That could at least make for a minimal reproduction example if it doesn't

AdityaPahilwani commented 2 years ago

I am really really sorry, recently moved to a new city so was busy with some problems here. I will check this asap

Almouro commented 2 years ago

Hey @AdityaPahilwani no worries of course! ☺️ it's open source (and it's not even your repo), you don't have to feel obligated to do anything! I also didn't have the bandwidth to try it out

Hope you settle in well in your new environment then! ☺️