question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[0.65.x] AppState wrong typings

See original GitHub issue

Description

Wrong typings in AppState, since react-native changed the way listeners work it seems that the typings were not updated.

React Native version:

0.65.1

Steps To Reproduce

Provide a detailed list of steps that reproduce the issue.

  1. Install 0.65.x and use AppState with Typescript (in my case 4.3.5) like in official example

Expected Results

Update typings Screenshot 2021-08-20 at 1 46 29 PM

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:6
  • Comments:5

github_iconTop GitHub Comments

4reactions
efstathiosntonascommented, Aug 27, 2021

Here’s a patch-package just in case someone can’t wait for the release:

@types+react-native+0.64.13.patch

diff --git a/node_modules/@types/react-native/index.d.ts b/node_modules/@types/react-native/index.d.ts
index 27c9b21..d0cfeb0 100755
--- a/node_modules/@types/react-native/index.d.ts
+++ b/node_modules/@types/react-native/index.d.ts
@@ -7396,12 +7396,7 @@ export interface AppStateStatic {
      * Add a handler to AppState changes by listening to the change event
      * type and providing the handler
      */
-    addEventListener(type: AppStateEvent, listener: (state: AppStateStatus) => void): void;
-
-    /**
-     * Remove a handler by passing the change event type and the handler
-     */
-    removeEventListener(type: AppStateEvent, listener: (state: AppStateStatus) => void): void;
+    addEventListener(type: AppStateEvent, listener: (state: AppStateStatus) => void): EmitterSubscription;
 }
 
 /**
2reactions
tido64commented, Aug 25, 2021

Please leave a comment in the PR where the types are being updated: https://github.com/DefinitelyTyped/DefinitelyTyped/pull/55354

Read more comments on GitHub >

github_iconTop Results From Across the Web

releases/CHANGELOG.md at master · react-native ... - GitHub
This release fixes an issue caused by a wrongly reverted merge commit, that caused a short timeframe of commits to not actually be...
Read more >
Release Notes - FastAPI
FastAPI framework, high performance, easy to learn, fast to code, ready for production.
Read more >
App State Online | Online College Degrees and Certificates
App State Online offers flexible, nationally ranked online bachelor's degrees and graduate programs in education, health and business. Learn more.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found