The Ping Identity React Native Core module hosts shared runtime utilities for Ping RN SDKs. It provides process-wide registries for native handles, plus native error contracts used to keep promise rejections consistent across modules.
Note: This module is required by all other Ping Identity React Native SDK packages. Set it up and install it first.
Add the package and let autolinking wire the native code:
yarn add @ping-identity/rn-core
cd ios && pod install
Use the shared registry to keep native objects alive and retrievable by id:
import com.pingidentity.rncore.CoreRuntime
import com.pingidentity.rncore.registry.NativeHandle
class MyHandle : NativeHandle
val id = CoreRuntime.storageRegistry.register(MyHandle())
val handle = CoreRuntime.storageRegistry.resolve(id)
CoreRuntime.storageRegistry.remove(id)
import RNPingCore
final class MyHandle: NativeHandle {}
let id = await CoreRuntime.storageRegistry.register(MyHandle())
let handle = await CoreRuntime.storageRegistry.resolve(id)
await CoreRuntime.storageRegistry.remove(id)
Note: Android registry calls are synchronous. iOS uses async/await because the registry is actor-isolated.
Both platforms support clearing all tracked handles:
CoreRuntime.storageRegistry.removeAll()
await CoreRuntime.storageRegistry.removeAll()
Core defines a shared error payload so native modules can reject with consistent, serializable
data. The shape mirrors @ping-identity/rn-types (type, error, message, code, status).
import com.pingidentity.rncore.error.ErrorType
import com.pingidentity.rncore.error.GenericError
import com.pingidentity.rncore.error.reject
val error = GenericError(
type = ErrorType.ARGUMENT_ERROR,
error = "BROWSER_OPEN_ERROR",
message = "Invalid URL"
)
promise.reject(error)
import RNPingCore
let error = GenericError(
type: .argumentError,
error: "BROWSER_OPEN_ERROR",
message: "Invalid URL"
)
reject(error, rejecter: rejecter)
MIT