A native source editor component for React Native, built as a Fabric component wrapping STTextView on iOS and macOS. Designed to drop into both Expo CNG apps (via the included config plugin) and bare React Native / react-native-macos hosts.
iOS works end-to-end on the New Architecture today. macOS is scaffolded but not yet runnable — the underlying STTextView/Swift sources need an Obj-C++ port before they can ship on react-native-macos. Tracked in #27; roadmap below. Pre-1.0, expect the JS API to evolve until the macOS path lands.
Project tracking lives on the project board.
| Platform | Status | Min version |
|---|---|---|
| iOS | Shipping (Fabric / New Architecture) | 16.0 |
| macOS | Scaffolded, pending #27 | 14.0 (target) |
| iPadOS | Roadmap | — |
| Android | Stub only | — |
| Windows | Roadmap | — |
| Linux | Roadmap | — |
| Web | Out of scope for v1 | — |
iOS / macOS minimums are STTextView's floors, not ours.
# Library is not yet on npm — install via local path while v1 is in flight
npm install /path/to/react-native-source-editor
gem install cocoapods-spm # required: STTextView is SPM-onlyimport SourceEditor from '@workspace-sh/react-native-source-editor';
export default function Editor() {
return (
<SourceEditor
defaultValue="// hello"
editable
language="typescript"
style={{ flex: 1 }}
/>
);
}For Expo CNG apps, register the plugin in app.json so cocoapods-spm + the STTextView SPM package get injected into the Podfile during expo prebuild:
{
"plugins": [
"@workspace-sh/react-native-source-editor",
["expo-build-properties", {
"ios": { "deploymentTarget": "16.0", "useFrameworks": "static" }
}]
]
}Bare-RN hosts: see docs/installation.md for the manual Podfile snippet.
- Full setup → docs/installation.md
- Full API (props + ref handle) → docs/usage.md
- Runnable example apps → docs/examples.md
- v0.x (now) — bare RN Fabric library, iOS shipping. JS API: text, selection, font, theme, language (markdown / json / js / ts / html),
lineNumbersgutter toggle,contentInsets, imperativefocus/blur. - v0.x next — macOS via Obj-C++ port (#27). Unblocks the
example/macos-app/target and re-adds:osxto the podspec. - v1.0 — expanded font customisation, npm publish under
@workspace-sh/react-native-source-editor. - Post-1.0 — iPadOS polish, Android (TextKit alternative), Windows, Linux, Web.
Contributions and bug reports are welcome.
src/— TypeScript surface.SourceEditor.tsxis the high-level wrapper;SourceEditorView.tsxexposes the lower-level codegen Fabric component.ios/— Native sources.SourceEditor.{h,mm}is the Fabric Obj-C++ wrapper;SourceEditorImpl.swiftandHighlighter.swiftare the Swift impl (slated for Obj-C++ port in #27).ReactNativeSourceEditor.his the framework's umbrella anchor.example/ios-app/— Expo SDK 55 host. Uses Expo CNG, owned byexpo prebuild— never runpod installhere manually.example/macos-app/— react-native-macos 0.81 host. Standard bare-RN toolchain (pod install,react-native run-macos). Currently not runnable; see #27.app.plugin.js— Expo config plugin. Injectscocoapods-spm+ theSTTextViewSPM package into the consumer'sPodfileduringexpo prebuild.ReactNativeSourceEditor.podspec— root podspec; bare RN libraries put it here so autolinking finds it.
npm install
npm run typechecknpm run ios:plugin # one-time: gem install cocoapods-spm
npm run ios:install # one-time: install example/ios-app deps
npm run ios:run # build + launch on iOS simulator
npm run ios:dev # concurrently: clean Metro + run:iosOther scripts: ios:start, ios:clear, ios:run:device, ios:run:device:release, ios:clean (wipes generated ios/), ios:prebuild. Pod install is owned by expo run:ios — there is intentionally no ios:pods script.
Tracked in #27; the scripts (macos:install, macos:pods, macos:run, macos:dev) exist but the build will fail until the Swift sources are ported to Obj-C++.
- Branch off
develop; PRs targetdevelop.mainmirrors the latest release. - One PR per project-board issue. Reference the issue in the PR description.
- Squash-merge with the PR title as the commit subject.
- CI runs typecheck + iOS build via
.github/workflows/ci.yml.
MIT © Leslie Owusu-Appiah.
Built on top of STTextView by Marcin Krzyzanowski (BSD-2-Clause). Without it, this library would not exist.