# @koimy/rnw-image-upload

> 图片上传

Latest version **1.0.5** (published 2020-08-12) · MIT license · 0 weekly downloads

## Install

```sh
npm install @koimy/rnw-image-upload
pnpm add @koimy/rnw-image-upload
yarn add @koimy/rnw-image-upload
bun add @koimy/rnw-image-upload
```

## 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 | 1.0.5 |
| Published | 2020-08-12 |
| First published | 2020-08-12 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | mashizhen |
| Maintainers | dohard |
| Keywords | koimy, cimforce, atom, 原子操作, ai |

## Links

- npm: https://www.npmjs.com/package/@koimy/rnw-image-upload
- Repository: http://git.koimy.com/feidao-works/widgets-mobile
- npm.io page: https://npm.io/package/@koimy/rnw-image-upload

## Dependencies (2)

- [@koimy/rn-file-upload](https://npm.io/package/@koimy/rn-file-upload.md) latest
- [@koimy/rn-image-picker](https://npm.io/package/@koimy/rn-image-picker.md) latest

## Alternatives

- [@expo/fingerprint](https://npm.io/package/@expo/fingerprint.md) — 6.2M weekly downloads
- [@azure/monitor-opentelemetry-exporter](https://npm.io/package/@azure/monitor-opentelemetry-exporter.md) — 850.0K weekly downloads
- [@azure/monitor-opentelemetry](https://npm.io/package/@azure/monitor-opentelemetry.md) — 624.0K weekly downloads
- [@posthog/ai](https://npm.io/package/@posthog/ai.md) — 423.3K weekly downloads
- [fakefilter](https://npm.io/package/fakefilter.md) — 63.9K weekly downloads

## Recent versions

- 1.0.5 (latest) — 2020-08-12
- 1.0.4 — 2020-08-12
- 1.0.3 — 2020-08-12
- 1.0.2 — 2020-08-12
- 1.0.1 — 2020-08-12
- 1.0.0 — 2020-08-12

## README

# 图片上传

## 安装

```bash
yarn add @koimy/rnw-image-upload
```

## 配置

依赖于 `@koimy/rn-image-picker`， 请参考 [@koimy/rn-image-picker配置](https://www.npmjs.com/package/@koimy/rn-image-picker)

## 属性

### productid

产品id string 必填

### file_url

string 必填

文件服务地址

### multiple

number 非必填

是否开启多选，值为文件上限。

### files

IFile[] 必填

初始文件

## 方法

### upload()

开始上传

## 使用示例

```tsx
import { IFileServer } from '@koimy/rn-file-upload';
import React, { useEffect, useRef, useState } from 'react';
import { Button, Text, View } from 'react-native';
import Upload, { IFile } from './index';

const file_url = '';
const productid = '';

export default () => {
	// 图片
	const [images, set_images] = useState<IFile[]>([]);

	const upload_ref = useRef<{
		upload(): IFileServer[]
	}>();

	/**
	 * 副作用说明
	 */
	useEffect(() => {
		(async () => {

		})();
	}, []);

	const upload = async () => {
		const res = await upload_ref.current!.upload();
		set_images(res);
	};

	return (
		<View>
			<Text>文件上传</Text>
			<Button title='上传' onPress={() => upload()}></Button>
			<View style={{ flex: 1 }}>
				<Upload ref={upload_ref} multiple={2} file_url={file_url} productid={productid} files={images} />
			</View>
		</View>
	);
};

```

---
_Source: https://npm.io/package/@koimy/rnw-image-upload · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
