import type { TurboModule } from 'react-native'; import { TurboModuleRegistry } from 'react-native'; // Codegen TurboModule spec. Declaring hash128/hash64 as spec methods makes them // real (synchronous) TurboModule methods that ARE reachable from JS on the New // Architecture / bridgeless — unlike a generic ObjCTurboModule whose RCT methods // aren't exposed. They are the reliable fallback for hash128()/hash64() when the // faster JSI globals (__xxhash128/__xxhash64) aren't installed yet, and importing // this spec (getEnforcing) instantiates the module synchronously on the JS thread // so the native installJSIBindingsWithRuntime hook fires before the first hash. export interface Spec extends TurboModule { hash128(input: string): string; hash64(input: string): string; } export default TurboModuleRegistry.getEnforcing('xxhash');