Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

88
Views
Reduce time for calling native module methods in react-native application

I implemented a native module which navigates to a camera activity. But while calling the camera from nativeModules, it takes 1500-2000ms to open(excluding ui updation in camera).

The native module class that extends ReactContextBaseJavaModule is written like this:

@ReactModule(name = ImagePickerModule.NAME)
public class ImagePickerModule extends ReactContextBaseJavaModule
        implements ActivityEventListener
{
   ....
   // Calling this method
   @ReactMethod
   public void launchCamera(final ReadableMap options, final Callback callback) {
      // this method opens camera after checking necessary permissions and applies UI changes which was set by the user previously
   }
   ....
}

And this is nativeModules to JS mapping in the .ts file

import {NativeModules} from 'react-native';
import {ImagePickerNativeModule} from './privateTypes';

const NativeInterface: ImagePickerNativeModule | undefined =
  NativeModules.ImagePickerManager;

const DEFAULT_OPTIONS: ImagePickerOptions = {
   // options here
}

class ImagePicker {
  launchCamera(options: ImagePickerOptions, callback: Callback): void {
    return NativeInterface.launchCamera(
      {
        ...DEFAULT_OPTIONS,
        ...options,
        tintColor: processColor(options.tintColor || DEFAULT_OPTIONS.tintColor),
      },
      callback,
    );
  }
}

I am calling the nativeModule from react-native code like this:

export const CustomCamera = (): Promise<{ uri: string }> => {
    return new Promise((resolve, reject) => {
        ImagePicker.launchCamera(***Camera options passed***)
          .then(res => // Do something here)
          .catch(err => // Do something here)
    }
}

Is there any way I can open the activity faster while calling it from native modules? or keep the activity in the background so that the cameraActivity can load fast while calling it from react-native? Please suggest.

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!