0.0.2 • Published 7 years ago

react-native-pure-timer v0.0.2

Weekly downloads
2
License
MIT
Repository
github
Last release
7 years ago

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

PropertyTypeDefaultDescription
startTextstringStarttext on start button
stopTextstringStoptext on stop button
resetTextstringResettext on reset button
passSecondsToParentfunction()=>{}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',
  }
});