This repository contains a React Native Fabric view + worklet-based transformer for TextInput. Use this file as quick guidance for AI/codegen changes.
src/: JS/TS API. Entry point issrc/index.tsx(barrel).src/Transformer.ts:Transformerclass and worklet types.src/TransformerTextInput.tsx:TransformerTextInputcomponent.src/registry.ts: UI runtime registry for transformer worklets.ios/: iOS Fabric view + module.android/: Android Fabric view + JNI bridge.cpp/: Shared C++ runtime helpers (JSI + worklets).example/: Example app.
- New Architecture only (Fabric + codegen). Do not add paper/legacy view paths.
- Worklet registry lives on the UI runtime global:
__rntti_registerTransformerRegistry. - Shared C++ helpers live in the
rnttinamespace. - Avoid JSI types in public/shared C++ APIs when possible; keep JSI at edges.
SetUIWorkletRuntimeschedules assignment on the UI runtime; no mutex.
- Users create
new Transformer(worklet); constructor validates worklet. TransformerTextInputaccepts aTransformerinstance.- The transformer worklet receives
{ value, previousValue, selection, previousSelection }. - Return
null/undefinedfor no transform, or{ value?, selection? }.
- iOS uses
RCTConversionshelpers for string bridging. - C++ transform flow:
LookupTransformer->RunTransformer. - Android JNI currently has its own transformer calls; keep in sync with JS contracts.
yarn format:write(format code before committing)yarn lint(run linters)yarn test(run unit tests)yarn prepare(builds viabob)yarn example(opens example workspace commands)
- Prefer ASCII in source edits.
- Avoid touching generated/build artifacts (
lib/,example/ios/Pods/). - Keep changes focused and minimal; update README when JS API changes.