电池组件

更新时间:2021-11-18 03:30:32下载pdf

Battery

电池组件,包含电池电量、充电中、离线三种状态。

电池组件

组件Props

字段名 类型 描述 默认值
themeColor String 可选,主题色 #72E19A
total Number 必填,电池电量 0
chargeState Boolean 必填 false
deviceOnline Boolean 必填 false

使用

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;