Registry
A

refactor-native-module-calls

No description available

adarshrawat10 executions

  • Legacy
  • react-native
Connect a repo
npx codemod refactor-native-module-calls

Convert Callback-Based Native Module Calls to Synchronous Assignments

This codemod updates your React Native code to use the New Architecture's synchronous native module calls, replacing callback-based patterns for improved performance and simplicity.

Example

Before

ts
// In the old architecture, in order to handle a response from native function calls, you needed to provide a callback, and the value returned needed to be serializable:
nativeModule.getValue((value) => {
  nativeModule.doSomething(value);
});

After

ts
// In the New Architecture, you can make synchronous calls to native functions
const value = nativeModule.getValue();
nativeModule.doSomething(value);

Ready to evolve your codebase?

Build tailored, compiler-aware skills to assess, plan, and automate complex codebase changes.