Socket
Socket
Sign inDemoInstall

@logisticinfotech/react-native-circular-animation

Package Overview
Dependencies
Maintainers
5
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@logisticinfotech/react-native-circular-animation

circle animation


Version published
Maintainers
5
Created
Source

npm version

Preview

Example 1                      Example 2

VerticalAnimation    Flip Animation

@logisticinfotech/react-native-circular-animation

Getting started

$ npm i @logisticinfotech/react-native-circular-animation

Requirements

Before installing @logisticinfotech/react-native-circular-animation, it is necessary to install its dependent libraries.

Steps:

Below are the dependency for this package that you'll need to add to your project. To install, run the following commands:

  1. npm i react-native-gesture-handler react-native-reanimated @shopify/flash-list react-native-reanimated-carousel
  2. Add into babel.config.js file: plugins: ['react-native-reanimated/plugin']
  3. cd ios && pod install

Usage

Vertical circle-animation-list

import CircleAnimationList from '@logisticinfotech/react-native-circular-animation';

  const renderHorizontalSlider = (item, index) => {
    return (
      <View style={styles.container}>
        <View style={styles.circle}>
          <Image style={styles.circle} source={{uri: item.img}} />
        </View>
      </View>
    );
  };

  const onEndReached = () => {
    console.log('=== onEndReached ===');
  };

  const renderFooterLoader = () => {
    console.log('=== renderFooterLoader ===');
  };

  return (
     <View style={{flex: 1}}>
      <CircleAnimationList
        data={verticalArray}
        extraData={true}
        secondArrayName={'horizontalArray'}
        isHorizontalArray={false}
        verticalAnimation={'fast'}
        onEndReached={onEndReached}
        horizontalAnimation={500}
        circleAnimationAtLeftSide={false}
        horizontalSpacingLeftToRightPosition={-50}
        centerObjectLeftToRightPosition={120}
        topObjectUpToDownPosition={15}
        bottomObjectUpToDownPosition={-55}
        horizontalListInLoop={false}
        verticalScrollEnabled={true}
        horizontalScrollEnabled={true}
        marginTopForFirstIndex={300}
        showsVerticalScrollIndicator={false}
        listFooterComponent={renderFooterLoader}
        onEndReachedThreshold={0.0000000001}
        renderItem={(item, index) => renderHorizontalSlider(item, index)}
        verticalListRef={ref => console.log(ref)}
        horizontalListRef={ref => console.log(ref)}
        verticalCurrentIndex={value => console.log('verticalIndex =>', value)}
        horizontalCurrentIndex={value =>
          console.log('horizontalIndex =>', value)
        }
      />
    </View>
  );
}

  const verticalArray = [
    {
      id: 0,
      img: 'https://picsum.photos/200',
    },
    {
      id: 1,
      img: 'https://picsum.photos/200',
    },
    {
      id: 2,
      img: 'https://picsum.photos/200',
    },
    {
      id: 3,
      img: 'https://picsum.photos/200',
    },
    {
      id: 4,
      img: 'https://picsum.photos/200',
    },
    {
      id: 5,
      img: 'https://picsum.photos/200',
    },
  ];

const styles = StyleSheet.create({
  container: {
    alignItems: 'center',
    justifyContent: 'center',
    marginLeft: 100,
    width: 350,
  },
  circle: {
    alignItems: 'center',
    justifyContent: 'center',
    backgroundColor: 'black',
    width: 300,
    height: 300,
    borderRadius: 150,
  },
  txt: {color: 'red', fontSize: 35},
});

Vertical and Horizontal circle-animation-list

import CircleAnimationList from '@logisticinfotech/react-native-circular-animation';

 const renderHorizontalSlider = (item, index) => {
    return (
        <View style={styles.container}>
        <View style={styles.circle}>
          <Image style={styles.circle} source={{uri: item.img}} />
        </View>
      </View>
    );
  };

  const onEndReached = () => {
    console.log('=== onEndReached ===');
  };

  const renderFooterLoader = () => {
    console.log('=== renderFooterLoader ===');
  };

  return (
    <View style={{flex: 1}}>
      <CircleAnimationList
        data={verticalArray}
        extraData={true}
        secondArrayName={'horizontalArray'}
        isHorizontalArray={true}
        verticalAnimation={'fast'}
        onEndReached={onEndReached}
        horizontalAnimation={500}
        circleAnimationAtLeftSide={false}
        horizontalSpacingLeftToRightPosition={-50}
        centerObjectLeftToRightPosition={120}
        topObjectUpToDownPosition={15}
        bottomObjectUpToDownPosition={-55}
        horizontalListInLoop={false}
        verticalScrollEnabled={true}
        horizontalScrollEnabled={true}
        marginTopForFirstIndex={300}
        showsVerticalScrollIndicator={false}
        listFooterComponent={renderFooterLoader}
        onEndReachedThreshold={0.0000000001}
        renderItem={(item, index) => renderHorizontalSlider(item, index)}
        verticalListRef={ref => console.log(ref)}
        horizontalListRef={ref => console.log(ref)}
        verticalCurrentIndex={value => console.log('verticalIndex =>', value)}
        horizontalCurrentIndex={value =>
          console.log('horizontalIndex =>', value)
        }
      />
    </View>
  );
}

  const verticalArray = [
    {
      id: 0,
      img: 'https://picsum.photos/200',
      horizontalArray: [
        {
          id: 0,
          img: 'https://picsum.photos/200',
        },
        {
          id: 1,
          img: 'https://picsum.photos/200',
        },
        {
          id: 2,
          img: 'https://picsum.photos/200',
        },
      ],
    },
    {
      id: 1,
      img: 'https://picsum.photos/200',
      horizontalArray: [
        {
          id: 0,
          img: 'https://picsum.photos/200',
        },
        {
          id: 1,
          img: 'https://picsum.photos/200',
        },
        {
          id: 2,
          img: 'https://picsum.photos/200',
        },
      ],
    },
    {
      id: 2,
      img: 'https://picsum.photos/200',
      horizontalArray: [
        {
          id: 0,
          img: 'https://picsum.photos/200',
        },
        {
          id: 1,
          img: 'https://picsum.photos/200',
        },
        {
          id: 2,
          img: 'https://picsum.photos/200',
        },
      ],
    },
    {
      id: 3,
      img: 'https://picsum.photos/200',
      horizontalArray: [
        {
          id: 0,
          img: 'https://picsum.photos/200',
        },
        {
          id: 1,
          img: 'https://picsum.photos/200',
        },
        {
          id: 2,
          img: 'https://picsum.photos/200',
        },
      ],
    },
    {
      id: 4,
      img: 'https://picsum.photos/200',
      horizontalArray: [
        {
          id: 0,
          img: 'https://picsum.photos/200',
        },
        {
          id: 1,
          img: 'https://picsum.photos/200',
        },
        {
          id: 2,
          img: 'https://picsum.photos/200',
        },
      ],
    },
    {
      id: 5,
      img: 'https://picsum.photos/200',
      horizontalArray: [
        {
          id: 0,
          img: 'https://picsum.photos/200',
        },
        {
          id: 1,
          img: 'https://picsum.photos/200',
        },
        {
          id: 2,
          img: 'https://picsum.photos/200',
        },
      ],
    },
  ];

const styles = StyleSheet.create({
  container: {
    alignItems: 'center',
    justifyContent: 'center',
    marginLeft: 100,
    width: 350,
  },
  circle: {
    alignItems: 'center',
    justifyContent: 'center',
    backgroundColor: 'black',
    width: 300,
    height: 300,
    borderRadius: 150,
  },
  txt: {color: 'red', fontSize: 35},
});

Note:

There is no any difference between Vertical circle-animation-list and Vertical and Horizontal circle-animation-list.

  1. If you want to use only vertical circle-animation-list then you have to set isHorizontalArray property to false.
  2. If you want to use both vertical and horizontal animations, you have to set the isHorizontalArray property to true and set the secondArrayName property with your horizontal array list.

Basic Props

PropsTypeDescriptionisRequire
dataArrayProvide array to libraryYes
isHorizontalArrayBooleantrue = vertical & horizontal list, false = only vertical listYes
renderItemFuncTakes an item from data and renders it into the listYes
secondArrayNameStringThis prop renders the horizontal and vertical arrays if you have enabled horizontal animationNo
marginTopForFirstIndexNumberFirst item spacing from topNo
extraDataBooleanProps it self re-render the listNo
verticalAnimationStringThis prop for set the scrolling speed using two arguments 'normal' and 'fast'No
onEndReachedFuncFunction is trigger when list reached at bottomNo
horizontalAnimationNumberThis prop set the horizontal scrolling speedNo
horizontalListInLoopBooleanHorizontal list will work in repeat mode by setting true or falseNo
verticalScrollEnabledBooleanFor lock vertical scrolling enable/disable by setting true or falseNo
horizontalScrollEnabledBooleanFor lock horizontal scrolling enable/disable by setting true or falseNo
listFooterComponentFuncFooter loaderNo
verticalListRefFuncThis prop returns the vertical list refrenceNo
horizontalListRefFuncThis prop returns the horizontal list refrenceNo
verticalCurrentIndexFuncThis function returns the selected index from the vertical array listNo
horizontalCurrentIndexFuncThis function returns the selected index from the horizontal array listNo
showsVerticalScrollIndicatorBooleanTo enable/disable scroll indicator by passing true or falseNo
circleAnimationAtLeftSideBooleanThis props will flip the scrolling effectNo
horizontalSpacingLeftToRightPositionNumberFor moving the first and third objects position left to right and vice a versaNo
centerObjectLeftToRightPositionNumberFor moving the center object's position left to right and vice a versaNo
topObjectUpToDownPositionNumberFor moving the top object position up or downNo
bottomObjectUpToDownPositionNumberFor moving the bottom object position up or downNo
onEndReachedThresholdNumberThis prop represents the number of screen lengths you should be from the bottom before it fires the eventNo

Keywords

FAQs

Package last updated on 22 Feb 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

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