Skip to content
No description, website, or topics provided.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
android update to 1.0.2 Oct 16, 2017
ios
libs eslint code Mar 30, 2017
.gitignore 正式发布1.0.0 Oct 11, 2016
.npmignore 正式发布1.0.0 Oct 11, 2016
LICENSE 正式发布1.0.0 Oct 11, 2016
README.md 正式发布1.0.0 Oct 11, 2016
index.js eslint code Mar 30, 2017
package.json update to 1.0.2 Oct 16, 2017

README.md

React Native Capture (remobile)

A cordova capture for react-native, support for ios and android

Installation

npm install @remobile/react-native-capture --save

Installation (iOS)

  • Drag RCTCapture.xcodeproj to your project on Xcode.
  • Click on your main project file (the one that represents the .xcodeproj) select Build Phases and drag libRCTCapture.a from the Products folder inside the RCTCapture.xcodeproj.
  • Look for Header Search Paths and make sure it contains both $(SRCROOT)/../../../react-native/React as recursive.

Installation (Android)

...
include ':react-native-capture'
project(':react-native-capture').projectDir = new File(settingsDir, '../node_modules/@remobile/react-native-capture/android')
  • In android/app/build.gradle
...
dependencies {
    ...
    compile project(':react-native-capture')
}
  • register module (in MainApplication.java)
......
import com.remobile.capture.RCTCapturePackage;  // <--- import

......

@Override
protected List<ReactPackage> getPackages() {
   ......
   new RCTCapturePackage(),            // <------ add here
   ......
}

Usage

Example

var React = require('react');
var ReactNative = require('react-native');
var {
    StyleSheet,
    View,
    Image
} = ReactNative;

var Capture = require('@remobile/react-native-capture');
var Button = require('@remobile/react-native-simple-button');

module.exports = React.createClass({
    getInitialState () {
        return {
            filePath: '',
        };
    },
    taskVideo() {
        Capture.captureVideo((mediaFiles)=>{
            let filePath = mediaFiles[0].fullPath;
            this.setState({filePath});
        }, ()=>{
            Toast('录制失败');
        }, {limit:1});
    },
    render() {
        const {filePath} = this.state;
        return (
            <View style={styles.container}>
                <Button onPress={this.taskVideo}>摄像</Button>
                <Text>{filePath}</Text>
            </View>
        );
    },
});


var styles = StyleSheet.create({
    container: {
        flex: 1,
        justifyContent: 'space-around',
        alignItems: 'center',
        backgroundColor: 'transparent',
    },
});

HELP

thanks

see detail use

You can’t perform that action at this time.