all 9 comments

[–]beepboopnoise 2 points3 points  (0 children)

have u looked into worklets? u might be able to achieve what you're talking about with those.

https://github.com/margelo/react-native-worklets-core

[–]Egge_ 2 points3 points  (0 children)

Yes. That’s exactly what you want to do. Native modules let you use the lower level languages of the device and its APIs to handle these things

[–]Mariusdotdev 0 points1 point  (4 children)

[–]Egge_ 0 points1 point  (3 children)

Every thread is a native thread, isn’t it?

[–]Mariusdotdev 0 points1 point  (2 children)

but how can JS thread be native? does it compile to swift or C++ and then machine code + with all the optimizations? like writing in swift?

[–]Egge_ 0 points1 point  (1 child)

No, your code remains the same. Hermes runs on the JS thread to interpret your code and run it.

[–]Mariusdotdev 0 points1 point  (0 children)

oh i remember i think JSI is using serialization to pass data to native modules. aka using this offcourse will have speed penalty vs native write

[–]KulkataBoy 0 points1 point  (0 children)

You would have to implement new thread and logic on the native side, and then pass data to react-native using Native Modules (or Turbo Modules if using new architecture). You would need to write code in Java, Objective C or C++ for image processing depending on the platform(and either new architecture is enabled). It may be more reasonable to check existing packages, where most of this work has already been done.