Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

idea-native-clock

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

idea-native-clock - npm Package Compare versions

Comparing version 1.0.1 to 1.0.2

58

index.js
import * as React from 'react';
import { Text, View, StyleSheet } from 'react-native';
import {Text, View, StyleSheet} from 'react-native';
import PropTypes from 'prop-types';
export default class AnalogClock extends React.Component {
constructor(props) {
super(props);
let d = new Date();
this.state = {
hour: d.getHours(),
minutes: d.getMinutes(),
seconds: d.getSeconds(),
};
}
componentDidMount() {
this.timer = setInterval(() => {
let d = new Date();
this.setState({
hour: d.getHours(),
minutes: d.getMinutes(),
seconds: d.getSeconds(),
});
}, 1000);
}
componentWillUnmount() {
clearInterval(this.timer);
}
render() {

@@ -15,6 +38,5 @@ let {

colorSeconds,
hour,
minutes,
seconds,
} = this.props;
let {hour, minutes, seconds} = this.state;
var date = new Date();

@@ -25,9 +47,8 @@ if (!hour) hour = date.getHours();

minutes = minutes / 5;
if(!seconds) seconds = date.getSeconds();
seconds = seconds/5;
if (!seconds) seconds = date.getSeconds();
seconds = seconds / 5;
var lanHour = size / 5;
var lanMinutes = size / 3.75;
var lanSeconds = size/3.75;
var lanSeconds = size / 3.75;

@@ -51,6 +72,3 @@ return (

position: 'absolute',
transform: [
{ rotate: a + 'deg' },
{ translateX: size / 2 - 15 },
],
transform: [{rotate: a + 'deg'}, {translateX: size / 2 - 15}],
}}>

@@ -62,3 +80,3 @@ <Text

fontWeight: 'bold',
transform: [{ rotate: b + 'deg' }],
transform: [{rotate: b + 'deg'}],
}}>

@@ -87,4 +105,4 @@ {i + 1}

transform: [
{ rotate: -90 + hour * 30 + 'deg' },
{ translateX: lanHour / 2 },
{rotate: -90 + hour * 30 + 'deg'},
{translateX: lanHour / 2},
],

@@ -101,4 +119,4 @@ }}

transform: [
{ rotate: -90 + minutes * 30 + 'deg' },
{ translateX: lanMinutes / 2 },
{rotate: -90 + minutes * 30 + 'deg'},
{translateX: lanMinutes / 2},
],

@@ -115,4 +133,4 @@ }}

transform: [
{ rotate: -90 + seconds *30 + 'deg' },
{ translateX: lanSeconds / 2 },
{rotate: -90 + seconds * 30 + 'deg'},
{translateX: lanSeconds / 2},
],

@@ -144,3 +162,3 @@ }}

colorMinutes: '#f00',
colorSeconds:'#fff'
colorSeconds: '#fff',
};
{
"name": "idea-native-clock",
"version": "1.0.1",
"version": "1.0.2",
"description": "Analog Clock for React Native",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -1,2 +0,2 @@

# React Native: react-native-clock-analog
# React Native: idea-native-clock

@@ -11,3 +11,2 @@ [![GitHub package version](https://img.shields.io/github/package-json/v/kishor98100/idea-native-analog-clock)](https://github.com/kishor98100/idea-native-analog-clock)

<!-- <img src="https://github.com/gaetanozappi/react-native-clock-analog/raw/master/screenshot/react-native-clock-analog.png" /> -->

@@ -14,0 +13,0 @@ - [Usage](#-usage)

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc