andreluisjunqueira / react-native-document-scanner-android

Document scanner android, feature live detection, auto-capture, perspective correction :vibration_mode: :camera: -- :trophy:
MIT License
82 stars 32 forks source link

Black screen #27

Open ganascimento opened 5 years ago

ganascimento commented 5 years ago

I am having black screen problem, I already made several configurations however I did not have any progress. The code below is what I am currently using, could you help me:

import React from 'react' import { PermissionsAndroid, View } from 'react-native' import DocumentScanner from 'react-native-documentscanner-android'

export default class ScanDoc extends React.Component {

componentDidMount() {
    async function requestCameraPermission() {
        console.log("requestCameraPermission")
        try {
            const granted = await PermissionsAndroid.request(
                PermissionsAndroid.PERMISSIONS.CAMERA,
                {
                    'title': 'Cool Photo App Camera Permission',
                    'message': 'Cool Photo App needs access to your camera ' +
                    'so you can take awesome pictures.'
                }
            )
            if (granted === PermissionsAndroid.RESULTS.GRANTED) {
                console.log("You can STORE the camera")
            } else {
                console.log("storage permission denied")
            }
        }catch(e){
            console.log(e)
        }
        try {
            const granted = await PermissionsAndroid.request(
                PermissionsAndroid.PERMISSIONS.WRITE_EXTERNAL_STORAGE,
                {
                    'title': 'Cool Photo App Camera Permission',
                    'message': 'Cool Photo App needs access to your camera ' +
                    'so you can take awesome pictures.'
                }
            )
            if (granted === PermissionsAndroid.RESULTS.GRANTED) {
                console.log("You can write storage")
            } else {
                console.log("storage permission denied")
            }
        }catch(e){
            console.log(e)
        }
    }
    requestCameraPermission();
}

render(){
    return (
        <View style={{flex: 1}}>
            <DocumentScanner style={{flex: 1, backgroundColor: 'transparent', width: '100%', height: '100%',}}
                onPictureTaken={data => {
                    console.log(data.path);
                }}
                enableTorch={false}
                detectionCountBeforeCapture={5}/>
        </View>
    )
}

}

duwalanise commented 5 years ago

@ganascimento is there any progress on this issue? Did you find any solution?

acgollapalli commented 5 years ago

@ganascimento What version of React-Native are you using?

thongdn commented 5 years ago

@ganascimento you can see how to fix issue Black screen at here: https://github.com/andreluisjunqueira/react-native-documentscanner-android/pull/30#issue-295843425

M-Moghazy commented 5 years ago

@thongdn Change this packages and run it will work with you "react": "^16.8.1", "react-native": "^0.58.4", "react-native-documentscanner-android": "git+https://github.com/thongdn/react-native-documentscanner-android.git#develop",

ganascimento commented 5 years ago

Please could you share with me a project where it works correctly for me to see where the problem is, as I still have the black screen.