Last active
November 10, 2018 11:37
-
-
Save usrbowe/6d347037587bb02dd719d9009fbdd963 to your computer and use it in GitHub Desktop.
React Native Profiler
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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