ReactNative: use a picture storage component assembly ImageStore

I. Introduction

ImageStore components are used in ReactNative store images, support by uri fetched from memory and remove an image, and also supports the storage and retrieval of binary images. API ImageStore component provides only four static functions, simple to use.

 

二, API

1, to obtain images by uri

// query the picture, two parameters: the first pictures of the uri, the second query callback 
static hasImageForTag (uri: String , callback: (hasImage: BOOL ) => void )

2, by removing the pictures uri

// remove an image, a parameter, the picture uri 
static removeImageForTag (uri: String )

3, store pictures of base64 get uri

// store pictures of base64 encoding, three parameters, the first picture is of binary encoding, the second is the success callback, the third callback failure. Unless special needs, we do not recommend using this method to store images. A waste of performance. 
static addImageFromBase64 (base64ImageData: String , Success: (URI: String ) => void , failure: (error: the any) => void )

4, take a picture by uri base64

// by pictures uri get base64 encoded pictures, but also the three parameters, the first is the picture uri, second and third respectively callback success and failure, unless special needs, is not recommended. A waste of performance. 
static getBase64ForTag (URI: String , Success: (base64ImageData: String ) => void , failure: (error: the any) => void )

 

Guess you like

Origin www.cnblogs.com/XYQ-208910/p/12133067.html