Open mrousavy opened 3 years ago
I think react-native's image should be responsible for supporting an in-memory image, or we would be duplicating a lot of code in many libraries. I can help contributing in the rn side if the HostObject is ready.
@MarcoScabbiolo I can create a jsi::HostObject image library, but I don't think RN Core is going to depend on a third party library. I think we have to maintain the Image UI component separately. That's not a big problem though, FastImage does this as well
Currently image capture works like this:
takePhoto
invocationUIImage
/Bitmap
) to a file (🐢 slow!)takePhoto
promise resolver with file path, goes over bridge (🐢 slow!)<Image>
/<FastImage>
<Image>
/<FastImage>
wants to load photo from file again (🐢 slow!)With the upcoming React Native Re-Architecture this will change. Instead, I want to achieve the following:
takePhoto
invocationjsi::HostObject
which contains theUIImage
/Bitmap
object (🐇 fast!)takePhoto
promise resolver withjsi::HostObject
("image") (🐇 fast!)<Image>
/<FastImage>
<Image>
/<FastImage>
simply sets the already in-memory image to display (🐇 fast!)This will provide huge performance improvements since 1. the entire async Bridge calls are gone, and 2. because the File IO is completely gone.
I'm estimating at least 200ms of faster capture. (measured File I/O quite a while ago)
To display my
jsi::HostObject
image, I either have to create a custom image component, or maybe React Native's Core Image component will support this out of the box.We'll see.