1.0.0 • Published 2 years ago

expo-like-button v1.0.0

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

Expo Like Button

Provides an animated like/unlike button for reusability.

Features

  • Animated Like Button
  • Fully customizable

✨ Preview

Installation

Just run the below command in your project folder

Note:- This runs only in an Expo Managed and Bare(expo) project and not in React Native CLI project.

To install,

npm install --save expo-like-button

Usage

UnControlled Component

Below shown is the usage of the component as an uncontrolled component.

import LikeButton from 'expo-like-button';

...

// basic Usage
<LikeButton />

Controlled Component

For controlled component, you can use it as shown.

import LikeButton from "expo-like-button";

const [Liked, SetLiked] = useState(true);

const onLikePress = async () => {
  // Do something for Like operation
  SetLiked(true);
};

const onUnLikePress = async () => {
  // Do something for Like operation
  SetLiked(true);
};

// basic Usage
<LikeButton liked={Liked} onPress={Liked ? onUnLikePress : onLikePress} />;

Parameters

Basic Parameters

ParameterDefaultDescription
likedundefinedColor of the timestamp which shows total time that has been elapsed since the video started playing
onPressundefinedColor of the timestamp which shows total duration of the clip
iconSizeundefinedColor of the timestamp which shows total duration of the clip

Liked Icon Component Props

ParameterDefaultDescription
likedColorredColor of the liked icon
likedIconName"heart-outline"name of the icon when liked is true (Derived from MaterialCommunityIcons family)
customLikedComponentnullcustom component to show in place of liked icon

UnLiked Icon Component Props

ParameterDefaultDescription
unlikedColorblackColor of the unliked icon
unlikedIconName"heart"name of the icon when liked is false (Derived from MaterialCommunityIcons family)
customUnlikedComponentnullcustom component to show in place of unliked icon