react-native-photo-editor icon indicating copy to clipboard operation
react-native-photo-editor copied to clipboard

Photo is blank as black screen after execution

Open idoor88 opened this issue 5 years ago • 9 comments

Hi All, for some reason, I tried the following code to load a photo, I first copied the jpg file to a sub directory as photo.jpg, but the editor loaded the photo.jpg as a blank screen, no photo shown, it is a black screen with the editor icons visible, I checked and found the file is copied successfully, the exist logged in console printed as true, but the photo not shown up when loaded the editor screen. so any clue what happened? I tested on android device.

`

   let photoPath = RNFS.DocumentDirectoryPath + "/photo.jpg";
   let filepath =  "/storage/emulated/0/DCIM/Camera/IMG_20190628_134627.jpg";

   RNFS.copyFile(filepath, photoPath)
                .then(async () => {
                    console.log('FILE WRITTEN!')
                    console.debug(' photoPath: ', photoPath);
                    let exist = await RNFS.exists(photoPath);
                    console.log(' exists: ', exist);
                    RNPhotoEditor.Edit({
                      path: photoPath,
                      stickers: [
                        'sticker0',
                        'sticker1',
                        'sticker2',
                        'sticker3',
                        'sticker4',
                        'sticker5',
                        'sticker6',
                        'sticker7',
                        'sticker8',
                        'sticker9',
                        'sticker10',
                      ],
                    //   hiddenControls: ['clear', 'crop', 'draw', 'save', 'share', 'sticker', 'text'],
                      colors: undefined,
                      onDone: () => {
                        console.log('on done');
                      },
                      onCancel: () => {
                        console.log('on cancel');
                      },
                    });
                })
                .catch(err => {
                    console.log(err.message)
                })

`

React-native info:

Info Fetching system and libraries information... System: OS: macOS 10.14.6 CPU: (8) x64 Intel(R) Core(TM) i7-7820HQ CPU @ 2.90GHz Memory: 2.28 GB / 16.00 GB Shell: 3.2.57 - /bin/bash Binaries: Node: 11.4.0 - /usr/local/bin/node npm: 6.13.1 - /usr/local/bin/npm Watchman: 4.9.0 - /usr/local/bin/watchman SDKs: iOS SDK: Platforms: iOS 13.2, DriverKit 19.0, macOS 10.15, tvOS 13.2, watchOS 6.1 Android SDK: API Levels: 23, 25, 26, 27, 28 Build Tools: 27.0.3, 28.0.2, 28.0.3 System Images: android-22 | Google APIs Intel x86 Atom, android-27 | Google APIs Intel x86 Atom, android-27 | Google Play Intel x86 Atom, android-28 | Google APIs Intel x86 Atom, android-28 | Google Play Intel x86 Atom IDEs: Android Studio: 3.1 AI-173.4907809 Xcode: 11.2.1/11B500 - /usr/bin/xcodebuild npmPackages: react: ^16.8.6 => 16.8.6 react-native: ^0.60.0 => 0.60.0 npmGlobalPackages: create-react-native-app: 2.0.2 react-native-asset: 2.0.0 react-native-cli: 2.0.1 react-native-cn-richtext-editor: 1.0.42 react-native-git-upgrade: 0.2.7

idoor88 avatar Dec 22 '19 05:12 idoor88

I faced this also

ethanloh95 avatar Jan 31 '20 06:01 ethanloh95

Same problem

vincentkedison avatar Feb 03 '20 03:02 vincentkedison

I faced this problem too. Is there any update about it?

arsh-sw avatar May 09 '20 14:05 arsh-sw

@arsh-sw "nguvl,vaodaymaxem" https://github.com/prscX/react-native-photo-editor/issues/27#issuecomment-452121083

Richtervn avatar Jan 15 '21 12:01 Richtervn

Is there any update to this?

import React, { Component } from 'react';
import { View } from 'react-native';
import RNPhotoEditor from 'react-native-photo-editor';

export default class HomeScreen extends Component {
    componentDidMount() { }
    render() {
        return (
            <View>
                {RNPhotoEditor.Edit({
                    path: '../images/defaultImage.jpg'
                })}
            </View>
        )
    }
}

Here is my code, and I am getting black screen, defaultImage.jpg exists in images/ folder. Is there any problem in snippet?

krishnan-tech avatar Jan 23 '21 06:01 krishnan-tech

Same Problem

VivekkChudasama avatar Feb 02 '21 05:02 VivekkChudasama

i encounter this issues in low quality android phones with Big Image size if i send image with big size (back camera captured image) ( ~ 3MB) , black screen shows and if i use front camera ( image size: ~ 1 MB), Image shows.

this Shows all image sizes fine In High Quality Devices.

i am pretty sure that path of provided image is correct(without file://) and moved image to dir before edit.

"react": "17.0.1",
"react-native": "0.64.0",
"react-native-vision-camera": "^2.4.1",
"react-native-photo-editor": "^1.0.12",

h2soheili avatar Jul 27 '21 11:07 h2soheili

Anyone found a solution for this problem ?

Khaled-Hb avatar Jun 27 '22 09:06 Khaled-Hb

Has anyone found a solution to this problem?

react06 avatar Jul 04 '23 06:07 react06