Skip to content

ChromeQ/react-native-flip-countdown-timer

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

0d35efc · Jul 10, 2023

History

38 Commits
Mar 7, 2019
Jul 10, 2023
Jul 21, 2019
Jul 10, 2023
Mar 7, 2019
Mar 7, 2019
Jun 28, 2023
Mar 7, 2019
Mar 7, 2019
Mar 7, 2019
Mar 7, 2019
Apr 6, 2019
Jul 10, 2023
Mar 7, 2019
Jun 24, 2023

Repository files navigation

react-native-flip-countdown-timer Build Status CodeFactor Maintainability Test Coverage npm version npm downloads module formats: umd, cjs, esm

A Flip timer implementation in React Native

For a Normal Timer application you can checkout react-native-flip-timer repository.

Show Cases

IOS Android
IOS Android

Getting Started

Installation

$ npm i react-native-flip-countdown-timer --save

Basic Usage

import React, { Component } from 'react';
import {
  StyleSheet, View, TouchableOpacity, Text,
} from 'react-native';
import { CountdownTimer, FlipNumber } from 'react-native-flip-countdown-timer';

export default class App extends Component {
  state = {
    play: true,
  }

  play = () => {
    this.setState(({ play }) => ({ play: !play }));
  }

  render() {
    const { play } = this.state;
    return (
      <View style={styles.container}>
        <CountdownTimer time={500} play={play} />
        <TouchableOpacity style={styles.button} onPress={this.play}>
          <Text style={styles.text}>{play ? 'Pause' : 'Play'}</Text>
        </TouchableOpacity>
      </View>
    );
  }
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    backgroundColor: 'white',
    alignItems: 'center',
    justifyContent: 'center',
  },
  button: {
    height: 40,
    backgroundColor: '#333333',
    width: 120,
    alignItems: 'center',
    justifyContent: 'center',
  },
  text: {
    fontSize: 16,
    fontWeight: 'bold',
    color: '#cccccc',
  },
});

Properties

CountdownTimer Props

Prop Default Type Description
time required string / number Time (in seconds)
play true bool Play the timer
wrapperStyle {} object Wrapper for the CountdownTimer
flipNumberProps {...} defaults Flip Number Props

Flip Number Props

Prop Default Type Description
number required string / number Number Input
unit seconds hours / minutes / seconds Number Input Unit
size number deviceWidth / 6 Size of the card
perspective 250 number Perspective
numberWrapperStyle {} object Wrapper Style
cardStyle {} object Card Style
flipCardStyle {} object Flip Card Style
numberStyle {} object Number Style

Todos

  • Full Coverage Tests for the Components
  • Support for Labels

Contribution

Questions

Feel free to contact me or create an issue

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 86.4%
  • Objective-C 7.2%
  • Starlark 3.8%
  • Java 2.6%