简体   繁体   中英

(react-native) How to detect the battery level in react native?

I need to get the battery level. If the level is low based upon that i have to show the optimised components. Is there a way to detect the battery level like network connection ?

I think you're going to need to use a plugin or write a native module for this.

https://github.com/oojr/react-native-battery is an example.

The list of available react native API's are on the left hand side at the bottom of the dock, it looks like none expose any power or battery for now.

https://facebook.github.io/react-native/docs/actionsheetios.html

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM