React : 15.1.0
react-native : 0.29.0
react-addons-perf : 15.1.0
Is react-addons-perf supported in react-native? I am trying to find where in my JS we have a very expensive task, and cannot get react-addons-perf to print anything to the console.
Furthermore, how would one use either react-addons-perf or the built in perf monitor ui while not in dev mode? Should these tools be trusted in dev mode?
Thank you!
@facebook-github-bot stack-overflow
Hey @kristojorg and thanks for posting this! @DanielMSchmidt tells me this issue looks like a question that would be best asked on StackOverflow. StackOverflow is amazing for Q&A: it has a reputation system, voting, the ability to mark a question as answered. Because of the reputation system it is likely the community will see and answer your question there. This also helps us use the GitHub bug tracker for bugs only. Will close this as this is really a question that should be asked on SO.
Where's the answer? I see @DanielMSchmidt sent the @facebook-github-bot to suggest the question be asked on Stack Overflow, but that's it. I would like to leverage react-addons-perf but having no luck enabling in a React Native project.
You can use RCTRenderingPerf.js instead of react-addons-perf.
import PrefMonitor from 'react-native/Libraries/Performance/RCTRenderingPerf';
componentDidMount() {
PrefMonitor.toggle();
PrefMonitor.start();
setTimeout(() => {
PrefMonitor.stop();
},5000);
}
@24ark I tried out you suggestion but there is no printExclusive method. How am I supposed to use this? Just starting and stopping doesn't really accomplish a whole lot.
Nevermind, I just read the code. It actually calls print exclusive in its stop method.
There seem to be several documentation bugs here. The original asker probably submitted the question to get a sense of whether Facebook _intends_ for react-addons-perf to be used with react-native.
The following React Native documentation points the reader to react-addons-perf:
https://facebook.github.io/react-native/docs/performance.html#profiling
But then importing the module results in the message: "Unable to resolve module react-dom/lib/ReactPerf"
Also, as you can see, the StackOverflow question he submitted turned out to be unhelpful. This is really a question about whether react-addons-perf should be viewed as a supported addon for react-native or not.
https://stackoverflow.com/questions/42023456/using-react-addons-perf-with-react-native
It turns out this comment includes a solution, but the solution is not part of the React-Native performance docs:
https://github.com/facebook/react-native/issues/10944#issuecomment-277434482
By referring the comment of @24ark , I got the following error

RCTRenderingPerf do exist in the lib, the way we use it might related to the error.
This issue is closed but we still have no answer, do we?
I get the same error as @kevinleeTCA
setTimout(() =>{PrefMonitor.toggle(); ....}, 0) helps. @baba43 @keithnorm
Most helpful comment
You can use RCTRenderingPerf.js instead of
react-addons-perf.