Socket
Book a DemoInstallSign in
Socket

@luu-truong/react-native-reaction-button

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@luu-truong/react-native-reaction-button

Reactions like Facebook does

1.0.6
latest
Source
npmnpm
Version published
Maintainers
1
Created
Source

Reaction Button

Reactions button like Facebook does.

Demo

Installation

Yarn:

yarn add @luu-truong/react-native-reaction-button

NPM:

npm install @luu-truong/react-native-reaction-button

Usage


import ReactionButton from '@luu-truong/react-native-reaction-button'

function Demo() {
  const [value, setValue] = React.useState(-1);

  function onChange(index: number) {
    setValue(value === index ? -1 : index);
  }

  const reactions = [
    {
      source: {
        url: '...'
      },
      title: 'Like'
    },
    {
      source: require('....'),
      title: 'Haha'
    }
  ];

  return <ReactionButton reactions={reactions} defaultIndex={0} value={value} onChange={onChange} />
}

Properties

NameTypeRequiredDescription
debugbooleannoDebug message. Default: false
reactionSizenumbernoRender reaction image at size. Default: 40px
reactionsReactionItem[]yesList reactions
valuenumberyesSelected reaction index.
defaultIndexnumbernoDefault reaction
onChange(index: number) => voidyesCallback when a reaction pressed
textPropsobjectnoProps passed to button reaction text
reactionSmallSizenumbernoSize to render reaction in button
DefaultImage(passedProps: any) => JSX.ElementnoDefault image component to render reaction when value is unspecified
reactionContainerStyleobjectnoStyle apply to reactions popover container
imageProps{renderImage: (props) => JSX.Element}no
styleViewStyleno
hitSlop{top: number; left: number; right: number; bottom: number}no

ReactionItem properties:

NameTypeRequiredDescription
sourceobjectyesImage object source
titlestringyesReaction title

React native support

Versionreact-native version
1.x.x0.64.0+

Keywords

react native

FAQs

Package last updated on 22 Nov 2021

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

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.