标签: react-native-camera

使用React-Native将content:// URI转换为Android的实际路径

我正在尝试上传图片cameraRoll.事情是cameraRoll组件返回content:// URI而不是实际的文件路径.要上传图像,我需要一个文件路径,有没有办法将content:// URI转换为文件URI?谢谢

android react-native react-native-camera

5
推荐指数
2
解决办法
7019
查看次数

如何使用react-native-camera录制视频

所以我正在开发一个项目,该项目使用来自https://github.com/lwansbrough/react-native-camera的react-native摄像机并让它正常工作.该组件将采用视频,数据将在Xcode的控制台中打印.不幸的是,我在计算机上丢失了这个文件和其他几个文件,并且从头开始重新启动应用程序.我一直试图重新创建具有视频录制功能的摄像机,但却无法使其正常工作.有人知道我做错了什么,因为我似乎无法弄明白.当我将captureMode更改为相机时,数据将打印出来,但视频不会发生任何事情.这是我的组件:

let startVideo = false;

class VideoCamera extends Component {
  constructor() {
    super()
    this.state = {
      captureMode: Camera.constants.CaptureMode.video,
    }
  }
  render() {
    return (
      <Camera
          captureMode={this.state.captureMode}
          ref="camera"
          style={styles.container}
      >
      <TouchableHighlight
          onPressIn={this._startRecord.bind(this)}
          onPressOut={this._endVideo.bind(this)}
      >
      <Icon
          name={'video-camera'}
          size={40}
          style={styles.recordButton}
      />
        </TouchableHighlight>
        </Camera>
      )
  }

  _startRecord() {
    startVideo = setTimeout(this._recordVideo.bind(this), 50)
  }

  _recordVideo() {
    this.refs.camera.capture({})
      .then((data) => console.log(data))
      .catch((err) => console.log(err))
  }

  _endVideo() {
    this.refs.camera.stopCapture()
  }

}
Run Code Online (Sandbox Code Playgroud)

video video-capture reactjs react-native react-native-camera

5
推荐指数
1
解决办法
7021
查看次数

如何用jest模拟react-native-camera?

我试图用jest测试react-native-camera模块

所以我有以下内容package.json:

{
  "name": "app",
  "version": "0.0.1",
  "private": true,
  "main": "index.js",
  "license": "MIT",
  "scripts": {
    "start": "node node_modules/react-native/local-cli/cli.js start",
    "test": "jest"
  },
  "dependencies": {
    "react": "~15.4.0-rc.4",
    "react-native": "0.40.0",
    "react-native-camera": "^0.5.1"
  },
  "devDependencies": {
    "babel-eslint": "^7.1.1",
    "babel-jest": "18.0.0",
    "babel-preset-react-native": "1.9.1",
    "jest": "18.1.0",
    "react-test-renderer": "~15.4.0-rc.4"
  },
  "jest": {
    "preset": "react-native"
  }
}
Run Code Online (Sandbox Code Playgroud)

并且Component示例中给出以下内容:

import React from 'react';
import Camera from 'react-native-camera';

class CameraComponent extends React.Component {
  constructor(props: Props) {
    super(props);

    this.camera = …
Run Code Online (Sandbox Code Playgroud)

javascript reactjs jestjs react-native react-native-camera

5
推荐指数
1
解决办法
2699
查看次数

错误:ENOENT:没有这样的文件或目录react-native-camera

拍照时有没有人用react-native-camera面对这个问题

错误:ENOENT:没有这样的文件或目录,打开'assets-library://asset/asset.JPG?id = B52996FD-EBCD-4B8D-A289-81063B8F09E9&ext = JPG'?(已编辑)

react-native react-native-camera react-native-ios

5
推荐指数
1
解决办法
388
查看次数

React-Camera:undefined不是对象(评估'CameraManager.Aspect.fill)

我在react-native-camera中遇到了一个有线错误.错误是undefined is not an object(evaluatiing 'CameraManager.Aspect.fill)

我们第二次打开申请时会来.这是第一次,它工作正常.

我尝试了以下步骤:1)取消链接2)卸载3)再次安装.

但它会有同样的问题.任何人都可以帮我解决这个问题吗?谢谢, 在此输入图像描述

camera android react-native react-native-camera

5
推荐指数
0
解决办法
430
查看次数

如何将react-reduced从0.56.0降级到0.55.4版本?

实际上我在我的应用程序中使用react-native-camera但它在这个版本中没有工作(react-native:0.56.0)并且它在这个版本中工作(react-native:0.55.4).

所以现在我想降低反应原生:0.56.0到反应原生:0.55.4.

我的系统配置:npm 6.1.0,react-native-cli:2.0.1,react-native:0.56.0,Mac OS,Xcode 9.3

谢谢

react-native react-native-camera react-native-android react-native-ios

5
推荐指数
1
解决办法
1万
查看次数

在react-native中的图像视图中从相机获取最近点击的图像

我正在我的反应原生应用程序中实现相机.我希望在点击后在同一屏幕上的小图像视图中显示该相机最近拍摄的图像.但我没有得到如何访问最近点击的图像.每当通过手机点击任何新图像时,它都会被赋予一个默认的随机名称,我如何在图像视图的源代码中引用它?请告诉我一些方法.我的代码是

 class Incident extends Component {
    constructor(props)
    {  super(props)

        this.state=  {path:"",show:false,video:Camera.constants.CaptureMode.video,camera:Camera.constants.CaptureMode.camera}    
      }
    render() {
      return (
              <View style={styles.container}>
             <View style={{flex:72}}>
             <Camera
              ref={(cam) => {
               this.camera = cam;
                }}
              style={styles.preview}
               aspect={Camera.constants.Aspect.fill}
              captureMode={this.state.camera}>

          </Camera>

  </View>
  <View style={{flex:8,opacity:0.5,backgroundColor:'black'}}>

    {()=>this.showClickedImage()}

  </View>


  <View style={{flex:10,flexDirection:'row',justifyContent:'space-between',backgroundColor:'#f3396b'}}>
  <TouchableOpacity style={{flex:33,flexDirection:'column', alignItems: 'center',paddingTop:10}}>
  <Image style={styles.icon} source={require('./Images/menu.png')}/>
  <Text>Home</Text>
  </TouchableOpacity>



  <TouchableOpacity style={{flex:34,flexDirection:'column', height:70,alignItems: 'center',borderColor:'#dd1e52',borderWidth:1,paddingTop:5}} 
                               onPress={()=>this.takePicture()}>
  <Image style={{width:50,height:50}} source={require('./Images/capture.png')}/>

  </TouchableOpacity>





  <TouchableOpacity style={{flex:33,flexDirection:'column', alignItems: 'center',paddingTop:10}}>
  <Image style={styles.icon} source={require('./Images/profile.png')}/>
  <Text>Profile</Text>
  </TouchableOpacity>


  </View>
  </View>
);
      }

      showClickedImage()
  { 
        return <View style={{flex:1,height:40,width:40, borderWidth:1,borderColor:'black'}}>
               <Image style={{width:40,height:40}} source= {{uri: …
Run Code Online (Sandbox Code Playgroud)

react-native react-native-camera react-native-android

4
推荐指数
1
解决办法
3459
查看次数

如何在相机中添加边框?

我需要在反应本机相机视图的取景器中间添加一个方框。存储库中也没有有关它的信息。那里的问题也没有得到解答。

我需要让相机视图像这样

react-native-camera

4
推荐指数
1
解决办法
7121
查看次数

如何修复“TypeError: undefined is not an object (evaluating '_reactNativeCamera.default.constants')” 在本机反应中的错误?

我正在尝试在我的项目中使用“React-native-camera”库。我实际上已经这样做了 50 多次,每次在我的 mac 和 Linux 系统上一切都很好。

但是现在突然之间它不再在我的 Linux 系统上工作并且不断产生这个错误(尽管在 mac 上工作!)。

在此处输入图片说明

我已经在这里检查了所有配置步骤 我已经尝试添加 missingDimensionStrategy 'react-native-camera', 'general' 到 app build.gradle 我已经尝试添加 maven {url " https://jitpack.io "} 和maven {url " https://maven.google.com "} 到项目 build.gradle 我试过从 .ideas 目录中删除 madules.xml 并重新启动 android studio,无论是否清除缓存。

仍然没有这是我让相机模块运行的示例代码:

class CameraApp extends Component {
  constructor(props) {
    super(props);

    this.state = {
      path: null,
      uri: '',
      imageName: ''
    };
  }

  takePicture() {
    this.camera.capture()
      .then((data) => {
        console.log(data);  
      })
      .catch(err => console.error(err));
}

  renderCamera() {
    return (
      <View>
        <Camera …
Run Code Online (Sandbox Code Playgroud)

android react-native react-native-camera

4
推荐指数
2
解决办法
3256
查看次数

在React Native中如何访问本机相机应用程序?

我想向我的应用添加链接以打开手机的本机摄像头应用吗?这可能吗?

我知道react-native-camera存在,但是从文档看来,它仅支持访问相机,目的是在应用程序内部创建自己的相机界面。我宁愿只使用手机上已有的相机应用程序。

谢谢

react-native react-native-camera

3
推荐指数
1
解决办法
1300
查看次数