Last Updated on : 2021-08-27 11:08:38download
The countdown hooks useCountDown
applies to the quick implementation of a countdown timer.
import React from 'react';
import { View, StyleSheet } from 'react-native';
import { Utils, TYText } from 'tuya-panel-kit';
import { hooks } from '@tuya/tuya-panel-health-sdk';
import Section from '../Section';
const { useCountDown } = hooks;
const { convertX: cx } = Utils.RatioUtils;
const CountDown = () => {
const onEnd = () => {
console.log('countdown end');
};
const [countdown] = useCountDown({
targetCount: 3000,
onEnd: onEnd,
});
return (
<View style={{ flex: 1, padding: cx(20) }}>
<Section title={getLang('dsc_default')}>
<TYText>{countdown}</TYText>
</Section>
</View>
);
};
export default CountDown;
const styles = StyleSheet.create({});
Is this page helpful?
YesFeedbackIs this page helpful?
YesFeedback