react-native-countdown-text

Tiny React Native component that formats a timestamp (of a date in the future) to a readable countdown to that time

Usage no npm install needed!

<script type="module">
  import reactNativeCountdownText from 'https://cdn.skypack.dev/react-native-countdown-text';
</script>

README

react-native-countdown-text

npm version

A React Native component that converts a timestamp of a future date to a readable countdown clock, based on Moment.js since version 1.0.4.

Installation

npm install --save react-native-countdown-text

Usage

import React, { Component } from 'react';
import { Countdown } from 'react-native-countdown-text';

export default class App extends Component {
    render() {
        return <Countdown finishTime={1543622400} />
    }
}

Properties

Name Type Default Description
format string d:kk:mm:ss The format that will be applied to the milliseconds
finishTime number REQUIRED The future date timestamp
onFinish func Will run when it's the finish time
textStyle object The style that will be applied to the countdown text

For more on formats see docs about formats in Moment.js

What's new in the latest version

Version: 1.0.4

Release date: 28/02/2020

  • Moment.js integration
  • onFinish function that will run on finish