Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Black screen #27

Open
ganascimento opened this issue May 20, 2019 · 5 comments
Open

Black screen #27

ganascimento opened this issue May 20, 2019 · 5 comments

Comments

@ganascimento
Copy link

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
Copy link

duwalanise commented May 30, 2019

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

@acgollapalli
Copy link

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

@thongdn
Copy link
Contributor

thongdn commented Jul 22, 2019

@ganascimento you can see how to fix issue Black screen at here: #30 (comment)

@M-Moghazy
Copy link

@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
Copy link
Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants