Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import React, {useState} from 'react';
import {Dimensions, StyleSheet, View, Text} from 'react-native';
import Svg, {Defs, LinearGradient, Stop, Path} from 'react-native-svg';
import Animated from 'react-native-reanimated';
import {useSpring} from '../hooks';
import PoliceCar from '../../assets/svgs/police-car.svg';
import Warning from '../../assets/svgs/warning.svg';
import Camera from '../../assets/svgs/cctv.svg';
const {interpolate, multiply, useCode, call, round} = Animated;
const {width} = Dimensions.get('window');
const size = width - 32;
const strokeWidth = 20;
const AnimatedPath = Animated.createAnimatedComponent(Path);
const {PI, cos, sin} = Math;
const r = (size - strokeWidth) / 2;
const cx = size / 2;
const cy = size / 2;
const A = PI + PI * 0.6;
const startAngle = PI + PI * 0.3;
const endAngle = 2 * PI - PI * 0.3;
// A rx ry x-axis-rotation large-arc-flag sweep-flag x y
const x1 = cx - r * cos(startAngle);
const y1 = -r * sin(startAngle) + cy;
const x2 = cx - r * cos(endAngle);
const y2 = -r * sin(endAngle) + cy;
const d = `M ${x1} ${y1} A ${r} ${r} 0 1 0 ${x2} ${y2}`;
const circumference = r * A;
const Counter = ({progress}) => {
import * as React from 'react';
import { Keyboard } from 'react-native';
import ViewPager from '@react-native-community/viewpager';
import Animated from 'react-native-reanimated';
import { PanGestureHandler } from 'react-native-gesture-handler';
import {
Layout,
NavigationState,
Route,
Listener,
PagerCommonProps,
EventEmitterProps,
} from './types';
const AnimatedViewPager = Animated.createAnimatedComponent(ViewPager);
type Props = PagerCommonProps & {
onIndexChange: (index: number) => void;
navigationState: NavigationState;
layout: Layout;
// Clip unfocused views to improve memory usage
// Don't enable this on iOS where this is buggy and views don't re-appear
removeClippedSubviews?: boolean;
children: (
props: EventEmitterProps & {
// Animated value which represents the state of current index
// It can include fractional digits as it represents the intermediate value
position: Animated.Node;
// Function to actually render the content of the pager
// The parent component takes care of rendering
render: (children: React.ReactNode) => React.ReactNode;
import * as React from "react";
import { TextInput, TextStyle } from "react-native";
import Animated from "react-native-reanimated";
const AnimatedTextInput = Animated.createAnimatedComponent(TextInput);
interface TextProps {
text: Animated.Node;
style?: TextStyle;
}
export default (props: TextProps) => {
const { text, style } = { style: {}, ...props };
return (
);
};
const MaybeScreen = ({
enabled,
active,
...rest
}: ViewProps & {
enabled: boolean;
active: number | Animated.Node;
children: React.ReactNode;
}) => {
if (Platform.OS !== 'ios' && enabled && Screens.screensEnabled()) {
AnimatedScreen =
AnimatedScreen || Animated.createAnimatedComponent(Screens.NativeScreen);
return ;
}
return
import React, {PureComponent} from 'react'
import * as Flow from '../util/flow'
import {FlatList, View} from 'react-native'
import * as Styles from '../styles'
import {smallHeight, largeHeight} from './list-item2'
import Animated from 'react-native-reanimated'
import {Props} from './list2'
const AnimatedFlatList = Animated.createAnimatedComponent(FlatList)
class List2 extends PureComponent> {
static defaultProps = {
keyboardShouldPersistTaps: 'handled',
}
_itemRender = ({item, index}: {item: T; index: number}) => {
return this.props.renderItem(index, item)
}
_getItemLayout = (data: Array | null, index: number) => {
switch (this.props.itemHeight.type) {
case 'fixed':
return {index, length: this.props.itemHeight.height, offset: this.props.itemHeight.height * index}
case 'fixedListItem2Auto': {
const itemHeight = this.props.itemHeight.sizeType === 'Large' ? largeHeight : smallHeight
positionDiff,
componentWidths[1] +
(componentWidths[0] > componentWidths[2] ? positionDiff : 0) -
centerDiff,
];
const springConfig = {
damping: 38,
mass: 1,
overshootClamping: false,
restDisplacementThreshold: 0.001,
restSpeedThreshold: 0.001,
stiffness: 600,
};
const AnimatedShadowStack = Animated.createAnimatedComponent(ShadowStack);
const MiniCoinIcon = styled(CoinIcon).attrs({
alignSelf: 'center',
size: 26,
})`
margin-left: 7px;
`;
const CoinButtonShadow = [
[0, 0, 9, colors.shadowGrey, 0.1],
[0, 5, 15, colors.shadowGrey, 0.12],
[0, 10, 30, colors.shadowGrey, 0.06],
];
const CoinText = styled(Text)`
color: ${colors.alpha(colors.blueGreyDark, 0.5)};
TapGestureHandler,
} from 'react-native-gesture-handler';
import Animated, { Easing } from 'react-native-reanimated';
import Spline from 'cubic-spline';
import { contains, timing, delay } from 'react-native-redash';
import { View } from 'react-native';
import { data1, data2, data3, data4 } from './data';
import ValueText from './ValueText';
import { deviceUtils } from '../../utils';
import { colors } from '../../styles';
import TimestampText from './TimestampText';
import TimespanSelector from './TimespanSelector';
import ActivityIndicator from '../ActivityIndicator';
const amountOfPathPoints = 288;
const AnimatedPath = Animated.createAnimatedComponent(Path);
const {
and,
or,
eq,
add,
sub,
onChange,
Value,
Clock,
block,
event,
concat,
cond,
call,
set,
import { CoinRow } from '../coin-row';
import { ColumnWithMargins, Row, RowWithMargins } from '../layout';
const {
block,
Clock,
cond,
interpolate,
set,
startClock,
stopClock,
timing,
Value,
} = Animated;
const AnimatedLinearGradient = Animated.createAnimatedComponent(LinearGradient);
const Container = styled.View`
height: ${CoinRow.height};
opacity: ${({ descendingOpacity, index }) => (1 - (0.2 * (descendingOpacity ? index : 0)))};
width: 100%;
`;
const FakeAvatar = styled.View`
${position.size(40)};
background-color: ${colors.skeleton};
border-radius: 20;
`;
const FakeRow = withProps({
align: 'center',
flex: 0,
import React, {PureComponent} from 'react'
import {FlatList, View} from 'react-native'
import * as Styles from '../styles'
import {Props} from './list'
import Animated from 'react-native-reanimated'
const AnimatedFlatList = Animated.createAnimatedComponent(FlatList)
class List extends PureComponent> {
static defaultProps = {
keyboardShouldPersistTaps: 'handled',
}
_itemRender = ({item, index}: {item: Item; index: number}) => {
return this.props.renderItem(index, item)
}
_getItemLayout = (_: Array | null, index: number) => ({
index,
length: this.props.fixedHeight || 0,
offset: (this.props.fixedHeight || 0) * index,
})
_keyExtractor = (item: Item, index: number) => {
toClass,
} from 'recompact';
import SvgPrimitive from 'svgs';
import { reduceArrayToObject } from '../../utils';
const BlacklistedSVGProps = ['direction'];
const Svg = compose(
omitProps(...BlacklistedSVGProps),
mapProps(({ style, ...props }) => ({
...props,
style: reduceArrayToObject(style),
})),
)(SvgPrimitive);
export const AnimatedSvg = Animated.createAnimatedComponent(toClass(Svg));
export default Svg;