Giter VIP home page Giter VIP logo

react-native-countdown-timer's Introduction

Countdown Timer for React Native

A package which is a port of @uken's react-countdown-timer for React Native with animations (coming soon).

Quick Start

Due to my lack of knowledge in npm, the only current way is to add the files directory to your project. Any guidance in publishing to npm properly would be much appreciated.

Example

export default class YourComponent extends Component {
  constructor(props) {
    super(props)
  }

  _onTick() {
    console.log(`_onTick`)
  }

  _onFinish() {
    console.log(`_onFinish`)
  }

  render() {
  	let till = new Date('5/14/2016 13:56:00')
    return (
      <View>
        <CountdownTimer
          till={till}
          renderTick={(data) => <TimeLabel {...data} />}
          onTick={this._onTick.bind(this)}
          onFinish={this._onFinish.bind(this)}
        />
      </View>
    )
  }
}

class TimeLabel extends Component {
  render() {
    return (
      <View>
        <Text>
          {this.props.hours} : {this.props.minutes} : {this.props.seconds}
        </Text>
      </View>
    )
  }
}

Props

Props name Type Description Default
till* Date A Date object of the datetime end
onTick Function Callback on timer tick
onFinish Function Callback when countdown has finished
renderTick* Function Callback to render ticks with data

*required

Todo (PRs welcome!)

  • Add animations
  • Handle passed dates, etc.

react-native-countdown-timer's People

Contributors

naoto-ida avatar

Watchers

 avatar

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.