Skip to content

Issue with PhotoEditorActivity: requestFeature() Error #62

Open
@nasyx-rakeeb

Description

@nasyx-rakeeb

Hello,

I'm encountering an issue when trying to use the @baronha/react-native-photo-editor package in my Expo app. After patching the package to make it compatible with Expo Dev Client for Android, I'm now facing a java.lang.RuntimeException error related to the requestFeature() method call. It seems that this error is caused by the PhotoEditorActivity.

Steps to Reproduce

  1. Install @baronha/react-native-photo-editor version 1.1.6.
  2. Apply the patch mentioned here to make it work with expo dev client.
  3. Integrate the PhotoEditor component in the app.
  4. Attempt to use the PhotoEditor functionality.

Expected Behavior

The PhotoEditor component should launch and allow me to edit images without any errors.

Actual Behavior

When I attempt to use the PhotoEditor component, I encounter the following error:

java.lang.RuntimeException: Unable to start activity ComponentInfo{com.nasyxrakeeb.test/com.reactnativephotoeditor.activity.PhotoEditorActivity}: android.util.AndroidRuntimeException: requestFeature() must be called before adding content

Additional Information

  • Expo SDK Version: 49.0.8
  • React Native Version: 0.72.4
  • @baronha/react-native-photo-editor Version: 1.1.6
  • Android Device: Samsung a50 (Physical)
  • Android OS Version: 11
  • I had to patch the package to make it work with Expo Dev Client for Android.

CODE

const remoteURL =
  "https://images.unsplash.com/photo-1634915728822-5ad85582837a?ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&ixlib=rb-1.2.1&auto=format&fit=crop&w=774&q=80";

export default function App() {
  const edit = async () => {
    try {
      const result = await PhotoEditor.open({
        path: remoteURL,
        stickers: [],
      });
    } catch (error) {
      console.log({ error });
    }
  };

  return (
    <View>
      <Button onPress={edit}>
        Edit
      </Button>
    </View>
  );
}

I appreciate your help in resolving this issue. Please let me know if there's any additional information needed from my end.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions