Giter Site home page Giter Site logo

Comments (8)

zkkg2018 avatar zkkg2018 commented on June 8, 2024

兄弟 那个版本的?

from react-native-qrcode-scanner-view.

Tyrone2333 avatar Tyrone2333 commented on June 8, 2024

兄弟 那个版本的?

^2.0.0,现在我用 react-native-camera 官方的 demo + 这个库的 QRScannerRectView 不会闪退了

from react-native-qrcode-scanner-view.

MarnoDev avatar MarnoDev commented on June 8, 2024

需要先申请权限,再跳转扫码,否则会因为权限不足报错。你自己加个 react-native-permissions 库判断下应该就好了。

from react-native-qrcode-scanner-view.

Don-oneself avatar Don-oneself commented on June 8, 2024

@MarnoDev 请问是判断 PERMISSIONS.ANDROID.CAMERA 吗 判断后在Android模拟器第一次打开正常,但是退出再次打开白屏,并且打包后Android真机闪退,是我判断错误还是需要判断别的权限

import {check, PERMISSIONS, RESULTS, request} from 'react-native-permissions';

check(Platform.OS === 'ios' ? PERMISSIONS.IOS.CAMERA : PERMISSIONS.ANDROID.CAMERA).then(result => {
                            switch (result) {
                                case RESULTS.UNAVAILABLE:
                                    console.log('This feature is not available (on this device / in this context)',);
                                    break;
                                case RESULTS.DENIED:
                                    console.log('开始请求权限');
                                    request(Platform.OS === 'ios' ? PERMISSIONS.IOS.CAMERA : PERMISSIONS.ANDROID.CAMERA).then(result => {
                                        if(result){
                                            this.props.navigation.navigate('Scanner')
                                        }
                                    });
                                    break;
                                case RESULTS.GRANTED:
                                    console.log('已通过');
                                    this.props.navigation.navigate('Scanner')
                                    break;
                                case RESULTS.BLOCKED:
                                    console.log('The permission is denied and not requestable anymore');
                                    break;
                                }
                            })

from react-native-qrcode-scanner-view.

Don-oneself avatar Don-oneself commented on June 8, 2024

QRScanner.js
组件 RNCamera 添加权限

androidCameraPermissionOptions={{
                        title:'****',
                        message: '****',
                        buttonPositive: '****',
                        buttonNegative: '****',
                    }}

但是有一个很神奇的现象 连续开关七八次 就闪退了

from react-native-qrcode-scanner-view.

weiting918 avatar weiting918 commented on June 8, 2024

@MarnoDev 请问是判断 PERMISSIONS.ANDROID.CAMERA 吗 判断后在Android模拟器第一次打开正常,但是退出再次打开白屏,并且打包后Android真机闪退,是我判断错误还是需要判断别的权限

import {check, PERMISSIONS, RESULTS, request} from 'react-native-permissions';

check(Platform.OS === 'ios' ? PERMISSIONS.IOS.CAMERA : PERMISSIONS.ANDROID.CAMERA).then(result => {
                            switch (result) {
                                case RESULTS.UNAVAILABLE:
                                    console.log('This feature is not available (on this device / in this context)',);
                                    break;
                                case RESULTS.DENIED:
                                    console.log('开始请求权限');
                                    request(Platform.OS === 'ios' ? PERMISSIONS.IOS.CAMERA : PERMISSIONS.ANDROID.CAMERA).then(result => {
                                        if(result){
                                            this.props.navigation.navigate('Scanner')
                                        }
                                    });
                                    break;
                                case RESULTS.GRANTED:
                                    console.log('已通过');
                                    this.props.navigation.navigate('Scanner')
                                    break;
                                case RESULTS.BLOCKED:
                                    console.log('The permission is denied and not requestable anymore');
                                    break;
                                }
                            })

用了你的代码,完美解决了我的问题啦,哈哈哈!!!

from react-native-qrcode-scanner-view.

Don-oneself avatar Don-oneself commented on June 8, 2024

@weiting918 不闪退吗? 增加 react-native-permissions 插件,不如在 RNCamera 添加权限

from react-native-qrcode-scanner-view.

nguyentuanit97 avatar nguyentuanit97 commented on June 8, 2024

How to fix when we must request permission in qrcode scanner screen?

from react-native-qrcode-scanner-view.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.