yarn | yarn add react-native-thumbnail-selector |
npm | npm install react-native-thumbnail-selector --save |
react version | react-native version | package version | reason |
---|---|---|---|
v16.8.0 | v0.61.0 | >=3.0.0 | React hooks and usage of useWindowDimensions |
import React from 'react';
import {Animated} from 'react-native';
import ThumbnailSelector from 'react-native-thumbnail-selector';
const thumbnails = [
{
caption: 'react-native',
imageSrc: {uri: 'https://reactnative.dev/img/pwa/manifest-icon-512.png'},
},
{
caption: 'Dolore do magna ullamco nisi quis.',
imageSrc: {uri: 'https://reactnative.dev/img/pwa/manifest-icon-512.png'},
},
];
function Example() {
// use toggle to show and hide ThumbnailSelector
let toggle = () => new Promise<Animated.EndResult>(res => res);
return (
<ThumbnailSelector
thumbnails={thumbnails}
toggle={func => (toggle = func)}
/>
);
}
export default Example;