0.0.7 • Published 7 years ago

react-native-another-analog-clock v0.0.7

Weekly downloads
24
License
-
Repository
-
Last release
7 years ago

Language Platforms Donate

React Native Analog Clock

React native analog clock using setInterval and Javascript styling.

Install

This component is built with React Native 0.39+ and works for Android and iOS.

Import AnalogClock.js

import AnalogClock from './AnalogClock';

Usage

Basic Usage

import React, { Component } from 'react';
import { View } from 'react-native';
import AnalogClock from './AnalogClock';

export default class ClockContainer extends Component {

  render() {
    return (
      <View style={{flex: 1, justifyContent: 'center', alignItems: 'center'}}>

        <AnalogClock
          minuteHandLength={110}
        />

      </View>
    )
  }
}

Add a background image

Uncomment the following in the AnalogClock.js render function and change image source to path to your image.

<Image
  style={{width: this.props.clockSize - this.props.clockBorderWidth*2,
    height: this.props.clockSize - this.props.clockBorderWidth*2}}
  resizeMode='stretch'
  source={require('./img/clockBack.png')}
/>

Properties

Property nameTypeDefaultDescription
clockSizenumber270The size of the clock frame
clockBorderColorstring'black'The color of the frame border
clockBorderWidthnumber7The width of the frame border
clockCentreColorstring'black'The color of the clock centre
clockCentreSizenumber15The size of the clock centre
hourHandColorstring'black'The color of the hour hand
hourHandCurvedbooleantrueCurved hour hand tip
hourHandLengthnumber70The length of the hour hand
hourHandWidthnumber5.5The width of the hour hand
hourHandOffsetnumber0Hour hand offset from the centre
minuteHandColorstring'black'The color of the minute hand
minuteHandCurvedbooleantrueCurved minute hand tip
minuteHandLengthnumber100The length of the minute hand
minuteHandWidthnumber5The width of the minute hand
minuteHandOffsetnumber0Minute hand offset from the centre
secondHandColorstring'black'The color of the second hand
secondHandCurvedbooleanfalseCurved hour second tip
secondHandLengthnumber120The length of the second hand
secondHandWidthnumber2The width of the second hand
secondHandOffsetnumber0Second hand offset from the centre

License

GNU General Public License v3.0

0.0.7

7 years ago

0.0.6

7 years ago

0.0.5

7 years ago

0.0.4

7 years ago

0.0.3

7 years ago

0.0.2

7 years ago