Socket
Socket
Sign inDemoInstall

react-native-web-linear-gradient

Package Overview
Dependencies
32
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.1.1 to 1.1.2

2

dist/index.js

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

Object.defineProperty(exports,"__esModule",{value:true});var _extends=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source){if(Object.prototype.hasOwnProperty.call(source,key)){target[key]=source[key];}}}return target;};var _jsxFileName='src/index.js';var _createClass=function(){function defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,descriptor.key,descriptor);}}return function(Constructor,protoProps,staticProps){if(protoProps)defineProperties(Constructor.prototype,protoProps);if(staticProps)defineProperties(Constructor,staticProps);return Constructor;};}();var _react=require('react');var _react2=_interopRequireDefault(_react);var _reactNative=require('react-native');function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj};}function _objectWithoutProperties(obj,keys){var target={};for(var i in obj){if(keys.indexOf(i)>=0)continue;if(!Object.prototype.hasOwnProperty.call(obj,i))continue;target[i]=obj[i];}return target;}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}}function _possibleConstructorReturn(self,call){if(!self){throw new ReferenceError("this hasn't been initialised - super() hasn't been called");}return call&&(typeof call==="object"||typeof call==="function")?call:self;}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function, not "+typeof superClass);}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:false,writable:true,configurable:true}});if(superClass)Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass;}var LinearGradient=function(_PureComponent){_inherits(LinearGradient,_PureComponent);function LinearGradient(){var _ref;var _temp,_this,_ret;_classCallCheck(this,LinearGradient);for(var _len=arguments.length,args=Array(_len),_key=0;_key<_len;_key++){args[_key]=arguments[_key];}return _ret=(_temp=(_this=_possibleConstructorReturn(this,(_ref=LinearGradient.__proto__||Object.getPrototypeOf(LinearGradient)).call.apply(_ref,[this].concat(args))),_this),_this.state={width:1,height:1},_this.measure=function(_ref2){var nativeEvent=_ref2.nativeEvent;return _this.setState({width:nativeEvent.layout.width,height:nativeEvent.layout.height});},_this.getAngle=function(){if(_this.props.useAngle){return _this.props.angle+'deg';}var angle=Math.atan2(_this.state.width*(_this.props.end.y-_this.props.start.y),_this.state.height*(_this.props.end.x-_this.props.start.x))+Math.PI/2;return angle+'rad';},_this.getColors=function(){return _this.props.colors.map(function(color,index){var location=_this.props.locations[index];var locationStyle='';if(location){locationStyle=' '+location*100+'%';}return color+locationStyle;}).join(',');},_temp),_possibleConstructorReturn(_this,_ret);}_createClass(LinearGradient,[{key:'render',value:function render(){var _props=this.props,start=_props.start,end=_props.end,colors=_props.colors,locations=_props.locations,useAngle=_props.useAngle,angleCenter=_props.angleCenter,angle=_props.angle,style=_props.style,children=_props.children,otherProps=_objectWithoutProperties(_props,['start','end','colors','locations','useAngle','angleCenter','angle','style','children']);return _react2.default.createElement(_reactNative.View,_extends({},otherProps,{style:[style,{backgroundImage:'linear-gradient('+this.getAngle()+','+this.getColors()+')'}],onLayout:this.measure,__source:{fileName:_jsxFileName,lineNumber:72}}),children);}}]);return LinearGradient;}(_react.PureComponent);LinearGradient.defaultProps={start:{x:0.5,y:0},end:{x:0.5,y:1},locations:[],colors:[],useAngle:false,angle:0};exports.default=LinearGradient;
Object.defineProperty(exports,"__esModule",{value:true});var _extends=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source){if(Object.prototype.hasOwnProperty.call(source,key)){target[key]=source[key];}}}return target;};var _jsxFileName='src/index.js';var _createClass=function(){function defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,descriptor.key,descriptor);}}return function(Constructor,protoProps,staticProps){if(protoProps)defineProperties(Constructor.prototype,protoProps);if(staticProps)defineProperties(Constructor,staticProps);return Constructor;};}();var _react=require('react');var _react2=_interopRequireDefault(_react);var _reactNative=require('react-native');function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj};}function _objectWithoutProperties(obj,keys){var target={};for(var i in obj){if(keys.indexOf(i)>=0)continue;if(!Object.prototype.hasOwnProperty.call(obj,i))continue;target[i]=obj[i];}return target;}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}}function _possibleConstructorReturn(self,call){if(!self){throw new ReferenceError("this hasn't been initialised - super() hasn't been called");}return call&&(typeof call==="object"||typeof call==="function")?call:self;}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function, not "+typeof superClass);}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:false,writable:true,configurable:true}});if(superClass)Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass;}var LinearGradient=function(_PureComponent){_inherits(LinearGradient,_PureComponent);function LinearGradient(){var _ref;var _temp,_this,_ret;_classCallCheck(this,LinearGradient);for(var _len=arguments.length,args=Array(_len),_key=0;_key<_len;_key++){args[_key]=arguments[_key];}return _ret=(_temp=(_this=_possibleConstructorReturn(this,(_ref=LinearGradient.__proto__||Object.getPrototypeOf(LinearGradient)).call.apply(_ref,[this].concat(args))),_this),_this.state={width:1,height:1},_this.measure=function(event){_this.setState({width:event.nativeEvent.layout.width,height:event.nativeEvent.layout.height});if(_this.props.onLayout){_this.props.onLayout(event);}},_this.getAngle=function(){if(_this.props.useAngle){return _this.props.angle+'deg';}var angle=Math.atan2(_this.state.width*(_this.props.end.y-_this.props.start.y),_this.state.height*(_this.props.end.x-_this.props.start.x))+Math.PI/2;return angle+'rad';},_this.getColors=function(){return _this.props.colors.map(function(color,index){var location=_this.props.locations[index];var locationStyle='';if(location){locationStyle=' '+location*100+'%';}return color+locationStyle;}).join(',');},_temp),_possibleConstructorReturn(_this,_ret);}_createClass(LinearGradient,[{key:'render',value:function render(){var _props=this.props,start=_props.start,end=_props.end,colors=_props.colors,locations=_props.locations,useAngle=_props.useAngle,angleCenter=_props.angleCenter,angle=_props.angle,style=_props.style,children=_props.children,otherProps=_objectWithoutProperties(_props,['start','end','colors','locations','useAngle','angleCenter','angle','style','children']);return _react2.default.createElement(_reactNative.View,_extends({},otherProps,{style:[style,{backgroundImage:'linear-gradient('+this.getAngle()+','+this.getColors()+')'}],onLayout:this.measure,__source:{fileName:_jsxFileName,lineNumber:76}}),children);}}]);return LinearGradient;}(_react.PureComponent);LinearGradient.defaultProps={start:{x:0.5,y:0},end:{x:0.5,y:1},locations:[],colors:[],useAngle:false,angle:0};exports.default=LinearGradient;
{
"name": "react-native-web-linear-gradient",
"version": "1.1.1",
"version": "1.1.2",
"description": "React Native for Web implementation of react-native-linear-gradient",

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

@@ -25,7 +25,11 @@ import React, { PureComponent } from 'react';

measure = ({ nativeEvent }) =>
measure = (event) => {
this.setState({
width: nativeEvent.layout.width,
height: nativeEvent.layout.height,
width: event.nativeEvent.layout.width,
height: event.nativeEvent.layout.height,
});
if (this.props.onLayout) {
this.props.onLayout(event);
}
}

@@ -32,0 +36,0 @@ getAngle = () => {

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc