1.1.4 • Published 6 months ago

react-native-analog-watch-face v1.1.4

Weekly downloads
-
License
MIT
Repository
github
Last release
6 months ago

Component preview Component preview

AnalogClock React Native Component

A highly customizable analog clock component for React Native. This component allows you to customize various aspects of the clock, including its hands, hour markers, background, and more.

Installation

npm install react-native-analog-watch-face

or using yarn:

yarn add react-native-analog-watch-face

Usage

import React from 'react';
import { View } from 'react-native';
import AnalogClock from 'react-native-analog-watch-face';

const App = () => {
  return (
    <View>
      <AnalogClock
        backgroundImage={{ uri: 'https://i.pinimg.com/736x/f1/e6/8e/f1e68ef9e34b3f0c2dcde5dcffbf580b.jpg'}}
        hourTextStyle={{
          color: '#f9f9f9'
        }}
        date={new Date(2025,0,31,4,18,18)}
        showDate={true}
        dateStyle={{
          backgroundColor: '#fff',
          borderRadius: 5,
        }}
        dateTextStyle={{
          fontWeight: 'bold'
        }}
        blurRadius={4}
        hourHandStyle={{
          backgroundColor: '#dcdcdc'
        }}
      />
    </View>
  );
};

export default App;

Props

PropTypeDefaultDescription
dateDatenew Date()The initial date and time for the clock.
dateStyleViewStyle{}Style for the date container.
dateTextStyleTextStyle{}Style for the date text.
pausebooleanfalseWhether the clock should pause ticking.
intervalnumber1000The interval in milliseconds for the clock update.
stepsnumber1000The step increment in milliseconds when updating time.
showDatebooleanfalseWhether to show the date on the clock.
backgroundImageImageSourceundefinedimage object as the clock's background.
blurRadiusnumber0The blur effect applied to the background image.
minutesLineStyleViewStyle{}Style for the minute tick marks.
hourMarkerComponent(hour: number) => ReactNodeundefinedCustom component for the hour markers.
hourTextStyleTextStyle{}Style for the hour marker text.
clockFaceStyleViewStyle{}Style for the clock face container.
minuteHandStyleViewStyle{}Style for the minute hand.
secondsHandStyleViewStyle{}Style for the second hand.
hourHandStyleViewStyle{}Style for the hour hand.
centerDotStyleViewStyle{}Style for the center dot of the clock.

Example Customization

<AnalogClock
  showDate={true}
  clockFaceStyle={{ borderWidth: 10, borderColor: 'black', backgroundColor: 'white' }}
  hourHandStyle={{ backgroundColor: 'blue' }}
  minuteHandStyle={{ backgroundColor: 'green' }}
  secondsHandStyle={{ backgroundColor: 'red' }}
  centerDotStyle={{ backgroundColor: 'black' }}
  hourMarkerComponent={(hour) => <Text style={{ color: 'blue' }}>{hour === 0 ? 12 : hour}</Text>}
/>

License

MIT

1.1.4

6 months ago

1.1.3

6 months ago

1.1.2

6 months ago

1.1.1

6 months ago

1.0.0

6 months ago