Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

89
Vistas
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
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda