Skip to content

[Android] App crash after capture #678

Open
@VincentSastra

Description

@VincentSastra

Versions
OS: Android 13
React: 18.3.1
React Native: 0.76.1
react-native-camera-kit: 14.0.0

Describe the bug
App crash after capture, Logcat mentions two main errors
getOrCreateModule(): Unable to create module "UIManager" (legacy: false, turbo: true)
and then
java.lang.NullPointerException: null cannot be cast to non-null type com.rncamerakit.CKCamera
at com.rncamerakit.RNCameraKitModule.capture$lambda$0(RNCameraKitModule.kt:70)
on line
val view = uiManager?.resolveView(viewTag) as CKCamera

I believe the main issue is that the UIManager is not created

To Reproduce

const CameraComponent = ({ setImageData, onClose }) => {
  const cameraRef = useRef(null);

  const handleOnPress = async () => {
    if (cameraRef.current !== null) {
      const image = await cameraRef.current.capture();

      setImageData({
        name: image.name,
        type: "image/jpg",
        uri: image.uri,
      });

      onClose();
    }
  };

  return (
    <>
      <Camera style={{ aspectRatio: 3 / 4, width: "100%" }} ref={cameraRef} />
      <Icon
        onPress={() => onClose()}
        name="arrow-back"
        color={"white"}
        size={80}
      />
      <Icon onPress={handleOnPress} name="circle" color={"white"} size={80} />
      <Icon name="arrow-back" color={"black"} size={80} />
    </>
  );
};

Logcat
Crash message
Screenshot 2024-11-06 at 2 44 12 PM

Null pointer at source code
Screenshot 2024-11-06 at 2 44 34 PM

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