Battery

Last Updated on : 2021-11-19 08:42:54download

Battery

The battery component is used to show the battery level and the charging or offline status.

Battery

Properties

Field name Type Description Default value
themeColor String Optional, the theme color. #72E19A
total Number Required, the battery level. 0
chargeState Boolean Required false
deviceOnline Boolean Required false

Example

import React from 'react';
import { View } from 'react-native';
import { Battery } from '@tuya/tuya-panel-outdoor-sdk';

const BatteryView = () => {
  return (
    <View
      style={{
        flexDirection: 'row',
        paddingTop: 30,
        paddingLeft: 30
      }}
    >
      <Battery themeColor="#72E19A" total={80} chargeState deviceOnline />
      <Battery themeColor="#72E19A" total={100} chargeState={false} deviceOnline />
    </View>
  );
};
export default BatteryView;