react-native-pure-timer

0.0.2 • Public • Published

REACT NATIVE TIMER - PURE JS

Timer for React Native written in pure js using Async Storage.

Works in background. To be honest it should work even when you turn off your phone (it just writes timestamps to async storage).

this is how it looks

Usage

        <Timer btnStart={styles.btn} passSecondsToParent={this.getSeconds}  />

Props

Property Type Default Description
startText string Start text on start button
stopText string Stop text on stop button
resetText string Reset text on reset button
passSecondsToParent function ()=>{} function to pass time to parent container

Styles

Default style object (you can overwrite it all and pass it via props):

const styles = StyleSheet.create({
  container: {
    flex: 1,
    flexDirection: 'row',
    justifyContent: 'space-between',
    width: '90%',
  },
  containerStart: {
    flex: 1,
    justifyContent: 'center',
    alignItems: 'center',
    height: 30,
    marginRight: 5,
    backgroundColor: 'green',
    borderRadius: 5,
  },
  containerStop: {
    flex: 1,
    justifyContent: 'center',
    alignItems: 'center',
    height: 30,
    marginRight: 5,
    backgroundColor: 'crimson',
    borderRadius: 5,
  },
  containerReset: {
    flex: 1,
    justifyContent: 'center',
    alignItems: 'center',
    height: 30,
    marginRight: 5,
    backgroundColor: 'orange',
    borderRadius: 5,
  },
  containerDisabled: {
    flex: 1,
    justifyContent: 'center',
    alignItems: 'center',
    height: 30,
    marginRight: 5,
    backgroundColor: 'grey',
    borderRadius: 5,
  },
  containerTime: {
    flex: 1,
    justifyContent: 'center',
    alignItems: 'center',
    height: 30,
  },
  btnStart: {
    color: 'white',
  },
  btnStop: {
    color: 'white',
  },
  btnReset: {
    color: 'white',
  }
});

/react-native-pure-timer/

    Package Sidebar

    Install

    npm i react-native-pure-timer

    Weekly Downloads

    0

    Version

    0.0.2

    License

    MIT

    Last publish

    Collaborators

    • fbialek