# react-native-thumbnails-light

> ## Getting started

Latest version **2.0.1** (published 2020-10-20) · 0 weekly downloads

## Install

```sh
npm install react-native-thumbnails-light
pnpm add react-native-thumbnails-light
yarn add react-native-thumbnails-light
bun add react-native-thumbnails-light
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.1 |
| Published | 2020-10-20 |
| First published | 2020-10-16 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 83.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Lemaro |
| Maintainers | lemaro |
| Keywords | react-native |

## Links

- npm: https://www.npmjs.com/package/react-native-thumbnails-light
- Repository: https://github.com/Lemaro86/thumbnails-light
- Homepage: https://github.com/Lemaro86/thumbnails-light#readme
- Issues: https://github.com/Lemaro86/thumbnails-light/issues
- npm.io page: https://npm.io/package/react-native-thumbnails-light

## Recent versions

- 2.0.1 (latest) — 2020-10-20
- 2.0.0 — 2020-10-19
- 1.0.1 — 2020-10-16
- 1.0.0 — 2020-10-16

## README

# react-native-thumbnails-light

## Getting started

`$ npm i react-native-thumbnails-light`

#### iOS

1. In pod add `pod 'RNThumbnailsLight', :path => '../node_modules/react-native-thumbnails-light/ios/RNThumbnailsLight.podspec'`
2. pod install
2. Run your project 

#### Android

1. Open up `android/app/src/main/java/[...]/MainApplication.kt`
  - Add `import com.reactnative.thumbnailslight.RNThumbnailsLightPackage;;` to the imports at the top of the file
  - Add `new RNThumbnailsLightPackage()` to the list returned by the `getPackages()` method
  
2. Append the following lines to `android/settings.gradle`:
  	```
  	include ':react-native-thumbnails-light'
    project(':react-native-thumbnails-light').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-thumbnails-light/android')
    ```
3. Insert the following lines inside the dependencies block in `android/app/build.gradle`:
  	```
    implementation project(':react-native-thumbnails-light')
  	```

## Usage
```javascript

import React, { useEffect, useState } from 'react';
import { Image, View, Text } from 'react-native';
import { getThumbnailAsync } from 'react-native-thumbnails-light';

const VideoThumnails = ({ url }) => {
	const [image, setImage] = useState(null);

	useEffect(() => {
		if (!image) {
			getImageUrlFromVideo();
		}
	}, []);

	const getImageUrlFromVideo = async () => {
		await getThumbnailAsync(url, { time: 5000 })
            .then(res => {
                setImage(res.uri);
            })
            .catch(e => {
            	console.log(e);
            });
        setImage(uri);
	};

    return (
        <View>
            {image ? (
                <Image
                    source={{ uri: image }}
                    style={{ width: 100, height: 100 }}
                />
            ) : (
                <Text>Loading...</Text>
            )}
		</View>
	);
}

export default VideoThumnails;
```

---
_Source: https://npm.io/package/react-native-thumbnails-light · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
