-
Notifications
You must be signed in to change notification settings - Fork 24.5k
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
[iOS] setInterval/setTimeout causes the app to crash, May be the problem with RCTTiming.m #26995
Labels
Comments
I can't reproduce this issue. |
import React, {PureComponent} from 'react';
import {
SafeAreaView,
ScrollView,
View,
Text,
StatusBar,
} from 'react-native';
class App extends PureComponent {
constructor(props) {
super(props);
this.state = {
num: 0
}
}
componentDidMount(): * {
this.timer = setInterval(() => {
this.setState({
num: this.state.num + 1
})
}, 1000)
}
render(): boolean | number | string | React$Element<*> | React$Portal | Iterable | null {
return (
<>
<StatusBar barStyle="dark-content"/>
<SafeAreaView>
<ScrollView
contentInsetAdjustmentBehavior="automatic"
>
<View>
<Text>{this.state.num}</Text>
</View>
</ScrollView>
</SafeAreaView>
</>
)
}
}
export default App;
|
bashen1
changed the title
setInterval/setTimeout causes the app to crash
【iOS】setInterval/setTimeout causes the app to crash, May be the problem with RCTTiming.m
Oct 31, 2019
bashen1
referenced
this issue
Oct 31, 2019
Summary: Related #23674, in that PR, we imported background timer support, but it's not sufficient, I think the reason that works is because it enable the `Background Modes` and do some background tasks, for the users who don't enable it, timer would pause immediately before goes into background. To fix it, we can mark a background task when goes into background, it can keep app active for minutes, try best to support timing when in background. cc. cpojer . ## Changelog [iOS] [Fixed] - Timing: Fixes timer when app get into background Pull Request resolved: #24649 Differential Revision: D15554451 Pulled By: cpojer fbshipit-source-id: a33f7afe6b63d1a4fefcb7098459aee0c09145da
Duplicate of #26696 |
radko93
changed the title
【iOS】setInterval/setTimeout causes the app to crash, May be the problem with RCTTiming.m
[iOS] setInterval/setTimeout causes the app to crash, May be the problem with RCTTiming.m
Oct 31, 2019
radko93
added a commit
that referenced
this issue
Oct 31, 2019
radko93
added a commit
that referenced
this issue
Oct 31, 2019
facebook-github-bot
pushed a commit
that referenced
this issue
Nov 5, 2019
…27073) Summary: This PR reverts commit 3382984 that is causing #26696 #26995. > app would be closed immediately after going to background on iOS 13.1/13.2 and was investigated by minhtc #26696 (comment). The commit that is being reverted is apparently causing the app to be closed immediately. This has to be reverted in master separately as the file differs there. Similar PR for 0.61. branch #27065 ## Changelog [iOS] [Fixed] - Fix apps crashing on iOS 13.x when running timer in the background Pull Request resolved: #27073 Test Plan: Try [this](3382984#commitcomment-35745287) snippet on iOS 13.1/13.2, the app should not crash anymore Differential Revision: D18323679 Pulled By: cpojer fbshipit-source-id: 3af7036a0e1d3811924e581c649b16e5a4667e83
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
React Native version:
System:
OS: macOS 10.15
CPU: (4) x64 Intel(R) Core(TM) i5-5257U CPU @ 2.70GHz
Memory: 63.55 MB / 8.00 GB
Shell: 3.2.57 - /bin/bash
Binaries:
Node: 12.10.0 - /usr/local/bin/node
Yarn: 1.17.3 - /usr/local/bin/yarn
npm: 6.12.0 - /usr/local/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
SDKs:
iOS SDK:
Platforms: iOS 12.4, macOS 10.14, tvOS 12.4, watchOS 5.3
Android SDK:
API Levels: 23, 25, 26, 27, 28, 29
Build Tools: 25.0.2, 27.0.3, 28.0.3, 29.0.1, 29.0.2
IDEs:
Android Studio: 3.5 AI-191.8026.42.35.5900203
Xcode: 10.3/10G8 - /usr/bin/xcodebuild
npmPackages:
react: 16.9.0 => 16.9.0
react-native: 0.61.2 => 0.61.2
npmGlobalPackages:
react-native-cli: 2.0.1
Steps To Reproduce
LOG
The text was updated successfully, but these errors were encountered: