You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

react-native-thumbnail-selector

Package Overview
Dependencies
Maintainers
1
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-native-thumbnail-selector

A thumbnail selector.

4.1.0
Source
npmnpm
Version published
Weekly downloads
165
142.65%
Maintainers
1
Weekly downloads
 
Created
Source

react-native-thumbnail-selector

Platform npm npm License CI

Table of contents

Installation

  • yarn add react-native-thumbnail-selector
  • npm install react-native-thumbnail-selector --save

Support

react versionreact-native versionpackage versionreason
v16.8.0v0.61.0>=3.0.0React hooks and usage of useWindowDimensions

Demo

screenshot

Usage

  • Import import ThumbnailSelector from 'react-native-thumbnail-selector';

  • Create an array of object(s) that have image and caption properties. Example:

    const thumbnails = [
      {
        image: 'https://reactnative.dev/docs/assets/favicon.png',
        caption: 'React-native',
      },
      {image: 'https://placeimg.com/125/125/any', caption: 'Any'},
    ];
    
  • Add ThumbnailSelector component and allocate ref.

    let thumbnailSelectorRef = useRef();
    <ThumbnailSelector ref={thumbnailSelectorRef} thumbnails={thumbnails} />;
    
  • Then to show or hide it use: thumbnailSelectorRef.current.animate();.

Props

NameTypeDescriptionDefault
thumbnailsArraythumbnails for the Flatlist[]
renderThumbnailFunctionrender the thumbnailsundefined
onThumbnailSelectFunctioninvoked at thumbnail selection() => {}
initialIndexNumberthe index that is selected initially-1
horizontalBooleanthumbnail stack positiontrue
activeObjectopacity and border color for thumbnail when selected{ opacity: 1, borderColor: 'black' }
inactiveObjectopacity and border color for thumbnail when not selected{ opacity: 0.5, borderColor: 'transparent' }
thumbnailPropsObjectprops passed to Image component{ style: { width: 125, height: 125, borderWidth: 2 } }
captionPropsObjectprops passed to Text component{style: {fontSize: 16, textAlign: 'center'}}
buttonPropsObjectprops passed to TouchableOpacity component{style: {flexDirection: 'column', padding: 8}}
animatedViewStyleObjectstyle for Animated.View{ elevation: 1, zIndex: 1,position: 'absolute', top: 0, left: 0, right: 0 }
animationConfigObjectstyle for Animated.SpringAnimationConfig{ toValue: 0, duration: 600, friction: 9, useNativeDriver: false }

Keywords

thumbnail

FAQs

Package last updated on 29 Dec 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