Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
* @module components/background
*/
const React = require('react');
const getDimensions = require('../lib/getDimensions');
const Svg = React.createFactory(require('react-native-svg').Svg);
const Defs = React.createFactory(require('react-native-svg').Defs);
const Stop = React.createFactory(require('react-native-svg').Stop);
const connect = require('react-redux').connect;
const getColorByTemp = require('../lib/temperature-color');
const getDataPoints = require('../lib/getDataPoints');
const {interpolate} = require('d3-interpolate');
const LinearGradient = React.createFactory(
require('react-native-svg').LinearGradient
);
const Rect = React.createFactory(require('react-native-svg').Rect);
/**
* @param {ForecastDataBlock[]} hourly
* @param {number[]} hourRange
* @param {number|null} index when need to show only one column
* @returns {string[][]} colors
*/
function getStops(hourly, hourRange, index) {
let dataBlocks = hourly;
if (typeof index === 'number') {
dataBlocks = [hourly[index]];
}
let stops = dataBlocks.map((dataBlock) => {
const points = getDataPoints(dataBlock);
if (points) {
let targetTempAr = points.map(
const legend = React.createFactory(require('./legend'));
const connect = require('react-redux').connect;
const store = require('../reducers/main');
const touchableOpacity = React.createFactory(
require('react-native').TouchableOpacity
);
const scrollView = React.createFactory(require('react-native').ScrollView);
const linearGradient = React.createFactory(
require('react-native-svg').LinearGradient
);
const svg = React.createFactory(
require('react-native-svg').Svg
);
const defs = React.createFactory(require('react-native-svg').Defs);
const stop = React.createFactory(require('react-native-svg').Stop);
const rect = React.createFactory(require('react-native-svg').Rect);
const {ShareDialog, MessageDialog, AppEventsLogger} = require('react-native-fbsdk');
const linkObj = {
contentType: 'link',
contentUrl: 'http://zowni.com'
};
const reportError = require('../lib/reportError');
module.exports = connect(
function mapStateToProps(state) {
return {
temperatureFormat: state.temperatureFormat,
forecastApiRequests: state.forecastApiRequests,
forecastApiLimit: state.forecastApiLimit
}
}
)(React.createClass({
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); }
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance"); }
function _iterableToArray(iter) { if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter); }
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } }
var svgObjectMap = {
"svg": _reactNativeSvg.Svg,
"path": _reactNativeSvg.Path,
"rect": _reactNativeSvg.Rect,
"defs": _reactNativeSvg.Defs,
"mask": _reactNativeSvg.Mask,
"g": _reactNativeSvg.G,
"clipPath": _reactNativeSvg.ClipPath
};
function convert(createElement, element) {
var extraProps = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
if (typeof element === 'string') {
return element;
}
var children = (element.children || []).map(function (child) {
return convert(createElement, child);
});