Git Product home page Git Product logo

react-native-flip-countdown-timer's Introduction

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

react-native-flip-countdown-timer's People

Contributors

dependabot[bot] avatar pritishvaidya avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

react-native-flip-countdown-timer's Issues

Count timer and norml timer has the same problem: init time doesn't work

I have the code as below:
<CountdownTimer time={this.state.timer} play={play} flipNumberProps={{unit:"seconds"}}/>
Whatever time value I set, the countdown timer view ALWAYS count down from 59:xx:xx. I meant the latter 4 numbers were correct but the first two numbers were alwasy 59 that should be 00 in my guess.

Hope you great guys could fix this problem.

Regards,
Wing Light

display more than 2 digits or less than 2?

It seems we are limited to have 2 digits displayed. Is there a way to display a single digit or to specify how many digits we want displayed?
I'm trying to use this flipper for numbers outside the range 0-60. eg. 0-100

Always wrong countdown

Hi,
Unfortunatelly countdown always count wrong.
Example:

  • 600 seconds will produce 23:10:00 and then 23:09:59 and then 23:08:57 and then ok.
    As i can see calculating time is done properly but then in flip-number/index.js calculation is wrong.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.