1.0.4 • Published 3 years ago

@mindinventory/react-native-card-animation v1.0.4

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

Description

Beautiful Flatlist with OnScroll and OnClick animation. By using this, user can easily animate their flatlist, they can customise animation’s direction, duration, opacity with different colors. They can customise view by their own and integrate into flatlist.

Installation

using npm:

npm install @mindinventory/react-native-card-animation

using yarn:

yarn add @mindinventory/react-native-card-animation

Supported platform

  • iOS
  • Android

Dependencies

  • react-native-reanimated

Usage

// User Data to load in List

const alarmData = [
  {
    id: Math.random(),
    title: 'Hi..',
    time: '06:00 AM',
    bgColor: BLUE,
  },
  {
    id: Math.random(),
    title: 'Hello...',
    time: '06:30 AM',
    bgColor: LIGHT_GREEN,
  },
  {
    id: Math.random(),
    title: 'Hey Wake Up',
    time: '07:00 AM',
    bgColor: YELLOW,
  },
  {
    id: Math.random(),
    title: "It's Morning...",
    time: '08:00 AM',
    bgColor: SKIN,
  },
  {
    id: Math.random(),
    title: 'Have a Breakfast...',
    time: '10:30 AM',
    bgColor: SKYBLUE,
  },
  {
    id: Math.random(),
    title: 'Get ready to go out...',
    time: '11:00 AM',
    bgColor: PURPAL,
  },
  {
    id: Math.random(),
    title: 'Have a great day...',
    time: '11:30 AM',
    bgColor: LIGHT_BLUE,
  },
];

// OnScroll Card Animation Values

const startValue = 100;
const startDegree = '0deg';
const endDegree = '5deg';
const perspectiveValue = 100;

// OnPress Card Animation Values

const duration = 500;
const opacityToVal = 0.5;
const opacityEndVal = 1;
const bounceToVal = 1.1;
const bounceEndVal = 1;
const bgColor = “#1a212f”;
const spaceBetween = -25;
const borderRadius = 25;
const shadowRadius = 10;
const shadowOpacity = 1;

// Implementation of  CardAnimation Component 

<CardAnimation
  list={DATA}
  startValue={startValue}
  startDegree={startDegree}
  endDegree={endDegree}
  perspectiveValue={perspectiveValue}
  duration={duration}
  opacityToVal={opacityToVal}
  opacityEndVal={opacityEndVal}
  bounceToVal={bounceToVal}
  bounceEndVal={bounceEndVal}
  backgroundColor={bgColor}
  spaceBetween={spaceBetween}
  borderRadius={borderRadius}
  shadowRadius={shadowRadius}
  shadowOpacity={shadowOpacity}
  onCardPress={item => {alert(`You have pressed : ${item.time}`)}}
  renderCard={item => <CustomCardView item={item} />}
/>

Component props

propvaluerequired/optionaldescription
listarrayrequiredList of data which load in FlatList.
startValuenumberoptionalStart value for animation.
startDegreestringoptionalStart point for animate view.
endDegreestringoptionalEnd point for animate view.
perspectiveValuenumberoptionalMax range value to tilt view on scaleX.
durationnumberoptionalAnimation duration
opacityToValnumberoptionalStart value for animate opacity of view.
opacityEndValnumberoptionalEnd value for animate opacity of view.
bounceToValnumberoptionalStart value for animate bounce of view.
bounceEndValnumberoptionalEnd value for animate bounce of view.
backgroundColorstringoptionalIt will apply on flatlist background colour.
spaceBetweennumberoptionalIncrease and decrease the space between list of items.
borderRadiusnumberoptionalCustom border radius can apply on list of items.
shadowRadiusnumberoptionalCustom shadow radius can apply on list of items.
shadowOpacitynumberoptionalCustom shadow opacity can apply on list of items.
onCardPressfunctionoptionalGet callBack data form selected index of flatlist.
renderCardfunctionrequiredRender custom component in flatlist created by user.

LICENSE!

React-native-card-animation is MIT-licensed.

Let us know!

We would be really happy if you send us links of your projects where you use our component. Just send an email to sales@mindinventory.com and do let us know if you have any questions or suggestion regarding our work.