react-native-everywhere-image-picker
An image picker for React Native (mobile) and React (web).
Last updated 2 years ago by minieggs40 .
MIT · Original npm · Tarball · package.json
$ cnpm install react-native-everywhere-image-picker 
SYNC missed versions from official npm registry.

React Native Everywhere Image Picker

Cross-platform image picker for React/React Native. Built for iOS, Android, and web.

Installation

npm install --save react-native-everywhere-image-picker

Requirements

  1. For web use in create-react-app you MUST have react-scripts version 1.0.8 or over.

example

import React from "react";
import { Text, Image, View } from "react-native";
import ImagePicker from "react-native-everywhere-image-picker";

const style = {
  container: {
    flex: 1,
    alignItems: "center",
    justifyContent: "center"
  },
  image: {
    width: 200,
    height: 200,
    marginTop: 25
  }
};

export default class Example extends React.Component {
  state = { uri: null };

  _handleImage = ({ uri }) => {
    this.setState(() => ({ uri }));
  };

  _handleFail = ({ error }) => {
    console.log(error);
  };

  render() {
    return (
      <View style={style.container}>
        <ImagePicker onComplete={this._handleImage} onFail={this._handleFail}>
          <Text>Pick an image from camera roll</Text>
        </ImagePicker>
        {this.state.uri &&
          <Image source={{ uri: this.state.uri }} style={style.image} />}
      </View>
    );
  }
}

Current Tags

  • 0.1.3                                ...           latest (2 years ago)

4 Versions

  • 0.1.3                                ...           2 years ago
  • 0.1.2                                ...           2 years ago
  • 0.1.1                                ...           2 years ago
  • 0.1.0                                ...           2 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 13
Dependencies (4)
Dev Dependencies (6)
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |