-
Notifications
You must be signed in to change notification settings - Fork 24.4k
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
componentWillMount, componentWillReceiveProps and render being called twice times #16806
Labels
Resolution: Locked
This issue was locked by the bot.
Comments
The log just appears twice. App.jslet i = 0;
export default class App extends PureComponent<{}> {
componentWillMount() {
console.log('componentWillMount', i++);
}
componentDidMount() {
console.log('componentDidMount', i++);
}
componentWillReceiveProps() {
console.log('componentWillReceiveProps', i++);
}
render() {
console.log('render', i++);
return (
<View style={styles.container}>
<Text style={styles.welcome}>NOT a bug in React Native!</Text>
</View>
);
}
} Output
|
@Sommerfeld thanks |
@hramos we can close this issue |
Why does the log appear twice? What is the best way to prevent this? |
OK, i face this problem right now, and i found that because our android developer change some native code, seems android developer code new another Activity!!!! |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Is this a bug report?
Yes
Bug
I created new app with react-native-init ,
and i added log to know it's a bug from react-native or from my code ;
This is the result of log :
Environment
OS: macOS Sierra 10.12.6
Node: 6.11.2
Yarn: 1.3.2
npm: 5.5.1
Watchman: 4.7.0
Xcode: Xcode 9.1 Build version 9B55
Android Studio: 2.3 AI-162.4069837
Packages: (wanted => installed)
react: 16.0.0 => 16.0.0
react-native: 0.50.3 => 0.50.3
Target Platform: iOS (10.3)
The text was updated successfully, but these errors were encountered: