necolas / react-native-web

Cross-platform React UI packages
https://necolas.github.io/react-native-web
MIT License
21.6k stars 1.79k forks source link

`AppState.isAvailable` is a string instead of a boolean #2673

Open mozzius opened 4 months ago

mozzius commented 4 months ago

Is there an existing issue for this?

Describe the issue

AppState.isAvailable should just be a boolean, as documented here:

https://necolas.github.io/react-native-web/docs/app-state/#static-properties

However, since the check does not coerce document[VISIBILITY_STATE_PROPERTY] to a boolean, it ends up being a string such as "visible"

Expected behavior

AppState.isAvailable should be a bool

Steps to reproduce

  1. Log AppState.isAvailable to console
  2. It should be a string instead of a bool

Test case

https://codesandbox.io/p/sandbox/interesting-dream-fq6q93

Additional comments

No response