Michaelvilleneuve / react-native-document-scanner

Document scanner, features live border detection, perspective correction, image filters and more ! 📲📸
MIT License
848 stars 290 forks source link

Black Screen Showing when released as APK #87

Open selvananbu opened 3 years ago

selvananbu commented 3 years ago

Everything works well in debug mode but when i tried to release an APK it shows a black screen can any one help on this.The following is the component i use

       <View style={isDarkMode ? styles.containerDark: styles.container}>
        <View  style={{  width: width(95), height: height(50),alignItems:"center",justifyContent:"center" }} >
        {this.state.image 
        ?
          <Image style={{  width: width(95), height: height(45) }}  source={{ uri:this.state.image}} resizeMode="contain" /> 
          :
          <Scanner
            useBase64
            onPictureTaken={data => this.setState({ image: data.croppedImage })}
            overlayColor="rgba(255,130,0, 0.7)"
            enableTorch={this.state.flashEnabled}
            useFrontCam={this.state.useFrontCam}
            brightness={0.2}
            saturation={0}
            quality={0.5}
            contrast={1.2}
            onRectangleDetect={({ stableCounter, lastDetectionType }) => this.setState({ stableCounter, lastDetectionType })}
            detectionCountBeforeCapture={10}
            detectionRefreshRateInMS={50}
            style={styles.scanner}
          />
        }
        </View>

        {this.state.image === null ?
          <View style={{width:width(99),height:height(20),alignItems:"center",justifyContent:"space-evenly",flexDirection:"row"}}>
            </View>
             :
          <View style={{width:width(99),height:height(10),alignItems:"center",justifyContent:"space-evenly",flexDirection:"row"}}>
          <TouchableOpacity style={{backgroundColor:isDarkMode ? "#023056" : "#023056",height:height(8),alignItems:"center",justifyContent:"center",width:width(45),borderRadius:12}} onPress={() => this.setState({ image: "" })}>
            <Text style={{color:isDarkMode?colors.textColorDark:colors.textColor,fontSize:14,fontFamily:mainFont.medium}}>Take another picture</Text>
          </TouchableOpacity>
          <TouchableOpacity style={{backgroundColor:isDarkMode ? "#023056" : "#023056",height:height(8),alignItems:"center",justifyContent:"center",width:width(30),borderRadius:12}} onPress={this.onSavePressed.bind(this)}>
            <Text style={{color:isDarkMode?colors.textColorDark:colors.textColor,fontSize:14,fontFamily:mainFont.medium}}>Save</Text>
          </TouchableOpacity>
          </View>
        }

        <TouchableOpacity style={[styles.button, styles.left,{backgroundColor:isDarkMode ? "#023056" : "#023056"}]} onPress={() => this.setState({ flashEnabled: !this.state.flashEnabled })}>
          <Text style={{color:isDarkMode ? colors.textColorDark : colors.textColor}}>📸 Flash</Text>
        </TouchableOpacity>
        <TouchableOpacity style={[styles.button, styles.right,{backgroundColor:isDarkMode ? "#023056" : "#023056"}]} onPress={() => this.setState({ useFrontCam: !this.state.useFrontCam })}>
          <Text style={{color:isDarkMode ? colors.textColorDark : colors.textColor}}>📸 Front Cam</Text>
        </TouchableOpacity>
      </View>

Screenshot_2021-01-15-20-14-35-71_eee9b64344c01a06f2ab3c12ecc3baf6 `

mohdaamir8182 commented 3 years ago

DUE TO PERMISSIONS ISSUE:

: If you see black screen then it is due to permissions. Allow the permissions manually or using a library totally up to you. : after allowing permissions everything will work fine.