Skip to content

Instantly share code, notes, and snippets.

@usrbowe
Last active November 10, 2018 11:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save usrbowe/6d347037587bb02dd719d9009fbdd963 to your computer and use it in GitHub Desktop.
Save usrbowe/6d347037587bb02dd719d9009fbdd963 to your computer and use it in GitHub Desktop.
React Native Profiler
import React, {Component} from "react"
import {Text, View} from "react-native"
const Profiler = React.unstable_Profiler
export default class App extends Component {
logMeasurement = async (id, phase, actualDuration, baseDuration) => {
// see output during DEV
if (__DEV__) console.log({id, phase, actualDuration, baseDuration})
}
render() {
return (
<Profiler id={"HomeScreen"} onRender={this.logMeasurement}>
<View>
<Text>Welcome to React Native!</Text>
</View>
</Profiler>
)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment