facebook / react-native

A framework for building native applications using React
https://reactnative.dev
MIT License
119.17k stars 24.32k forks source link

requestIdleCallback may never fire again after app is backgrounded #17645

Closed berickson1 closed 6 years ago

berickson1 commented 6 years ago

Is this a bug report?

Yes

Have you read the Contributing Guidelines?

Yes

Environment

Latest Expo App: SDK 24 Target Platform: Android 7.0

Steps to Reproduce

  1. Run Expo Sample https://snack.expo.io/r1HW4J0EG
  2. Background Expo Sample
  3. Foreground Expo Sample

This occurs if I always maintain at least one setIdleCallback queued at the time the app is backgrounded.

Expected Behavior

Counter continues to increment

Actual Behavior

Counter stops running

Reproducible Demo

https://snack.expo.io/r1HW4J0EG

export default class App extends Component {
  doIdleWork() {
    requestIdleCallback(() => {
      this.setState({number: this.state ? this.state.number +1 : 0 });
      // setup another requestIdleCallback before we're done
      this.doIdleWork();
    });
  }
  componentDidMount() {
    this.state = { number:1 };
    this.doIdleWork();
  }
  render() {
    return (
      <View style={styles.container}>
        <Text style={styles.paragraph}>
         {this.state ? this.state.number : 0 }
        </Text>
        <Card title="Local Modules">
          <AssetExample />
        </Card>
      </View>
    );
  }
}
berickson1 commented 6 years ago

Still occurring on ReactNative 25 Update expo link: https://snack.expo.io/BkvefsqUM

react-native-bot commented 6 years ago

Thanks for posting this! It looks like you may not be using the latest version of React Native, v0.53.0, released on January 2018. Can you make sure this issue can still be reproduced in the latest version?

I am going to close this, but please feel free to open a new issue if you are able to confirm that this is still a problem in v0.53.0 or newer.

How to ContributeWhat to Expect from Maintainers

salmanwaheed commented 6 years ago

This message was created automatically by mail delivery software.

A message that you sent could not be delivered to one or more of its recipients. This is a temporary error. The following address(es) deferred:

mkdirenv@gmail.com Domain salmanwaheed.info has exceeded the max emails per hour (163/150 (108%)) allowed. Message will be reattempted later

------- This is a copy of the message, including all the headers. ------ Received: from o11.sgmail.github.com ([167.89.101.202]:33170) by box1177.bluehost.com with esmtps (TLSv1.2:ECDHE-RSA-AES128-GCM-SHA256:128) (Exim 4.89_1) (envelope-from bounces+848413-a7b0-hello=salmanwaheed.info@sgmail.github.com) id 1epQUx-003Izf-KN for hello@salmanwaheed.info; Fri, 23 Feb 2018 20:27:43 -0700 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=github.com; h=from:reply-to:to:cc:in-reply-to:references:subject:mime-version:content-type:content-transfer-encoding:list-id:list-archive:list-post:list-unsubscribe; s=s20150108; bh=dpNAb6RcmQ96p6E+7fIPiG1tRtc=; b=JiUynVzWpGJh3iUP 15HODa/eGk2C8l4OSZcBeIUJbX/fT30LHH0wWP5nIfrinWCOjvJs2HmfD94H/OGt vdj+3VlleeWjaTaRZR2JJq2i+6PiFmMxwVLEZ3jXjrNX1xbiwRiFAvZUfqXQergH ISJBsh/V6hhY0PDLZ18POBBViYA= Received: by filter0356p1iad2.sendgrid.net with SMTP id filter0356p1iad2-30970-5A90DBA3-A 2018-02-24 03:27:31.367314674 +0000 UTC Received: from github-smtp2a-ext-cp1-prd.iad.github.net (github-smtp2a-ext-cp1-prd.iad.github.net [192.30.253.16]) by ismtpd0003p1iad2.sendgrid.net (SG) with ESMTP id wctYrSN5SwS6UFvEKhdxXg for hello@salmanwaheed.info; Sat, 24 Feb 2018 03:27:31.345 +0000 (UTC) Date: Sat, 24 Feb 2018 03:27:31 +0000 (UTC) From: React Native Bot notifications@github.com Reply-To: facebook/react-native reply@reply.github.com To: facebook/react-native react-native@noreply.github.com Cc: Subscribed subscribed@noreply.github.com Message-ID: facebook/react-native/issue/17645/issue_event/1490267653@github.com In-Reply-To: facebook/react-native/issues/17645@github.com References: facebook/react-native/issues/17645@github.com Subject: Re: [facebook/react-native] requestIdleCallback may never fire again after app is backgrounded (#17645) Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="--==_mimepart_5a90daaa3e8d9_df93fcb0fa92f30259860"; charset=UTF-8 Content-Transfer-Encoding: 7bit Precedence: list X-GitHub-Sender: react-native-bot X-GitHub-Recipient: salmanwaheed X-GitHub-Reason: subscribed List-ID: facebook/react-native List-Archive: https://github.com/facebook/react-native List-Post: mailto:reply@reply.github.com List-Unsubscribe: mailto:unsub+00ef1b38cac280686ab5328275a27451f158bbd2520147b292cf0000000116a89caa92a169ce11424bd7@reply.github.com, https://github.com/notifications/unsubscribe/AO8bOLJqeMNg214RlXqjherC8--E9eEPks5tX4CqgaJpZM4RinUq X-Auto-Response-Suppress: All X-GitHub-Recipient-Address: hello@salmanwaheed.info X-SG-EID: 92ws1MVnlto3blxqXlf5goB0ee0kdDGWR6vcWx8d64/j1/58XwchqjUEi9t4dNbXfVt35xFN+Y3AeO HQU5f/+WiMgLLtYSc5SYtY60bpaKox//6OnBXW3IORbHQGs89BPjKRVRgmm0ca/eZ/TaeXq4cWHovE ZIs+iUvyL0xCDLRqUbFdSZG24SYc7Es0CSNszEhaNShrcbeKaAfHWqZt10A9DPUCS3/adFP9bPh+k9 c= X-Spam-Status: No, score=0.8 X-Spam-Score: 8 X-Spam-Bar: / X-Ham-Report: Spam detection software, running on the system "box1177.bluehost.com", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see root\@localhost for details.

Content preview: Closed #17645. -- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/facebook/react-native/issues/17645#event-1490267653 [...]

Content analysis details: (0.8 points, 5.0 required)

pts rule name description


0.0 URIBL_BLOCKED ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [URIs: github.com] -0.5 SPF_PASS SPF: sender matches SPF record -0.0 T_RP_MATCHES_RCVD Envelope sender domain matches handover relay domain 1.3 HTML_IMAGE_ONLY_24 BODY: HTML: images with 2000-2400 bytes of words 0.0 HTML_MESSAGE BODY: HTML included in message 2.5 DCC_CHECK No description available. -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -2.3 AWL AWL: Adjusted score from AWL reputation of From: address X-Spam-Flag: NO

----==_mimepart_5a90daaa3e8d9_df93fcb0fa92f30259860 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit

Closed #17645.

-- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/facebook/react-native/issues/17645#event-1490267653 ----==_mimepart_5a90daaa3e8d9_df93fcb0fa92f30259860 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 7bit

Closed #17645.


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or mute the thread.

----==_mimepart_5a90daaa3e8d9_df93fcb0fa92f30259860--