Migration

Migrate business logic

Move one Kotlin function or data call while keeping the current React Native screen and its behavior.

On this page

Choose a boundary#

Start with an operation that has a clear input and output, such as validation, a calculation, parsing or fetching one resource. Keep the TypeScript caller and its loading, error and retry behavior. Record representative inputs and expected results from the current implementation.

Export the operation#

Move the logic to commonMain and expose a public entry point with @ReactNativeFunction. Use a suspend function for asynchronous work. The generated TypeScript API returns a Promise. Regenerate the package and switch the existing caller to the generated export. Export example · Type mappings

If the first step moves HTTP from Axios to Ktor, keep request parameters, authentication and error behavior stable. The Pokédex shows that a React Native screen can use Ktor through a Kotlin function while keeping its current UI. Axios to Ktor · Pokédex

Compare behavior#

Run the same inputs through both implementations, including empty data, errors, and cancellation where applicable. Check the user-visible result and any side effects around the caller. Keep the existing source of truth while moving the function.