From 24fe68495101c163f3081a0e8357d78d3584e8b6 Mon Sep 17 00:00:00 2001 From: Leslie Owusu-Appiah Date: Fri, 8 May 2026 11:05:24 +0200 Subject: [PATCH 1/2] =?UTF-8?q?feat:=20lineNumbers=20prop=20=E2=80=94=20ru?= =?UTF-8?q?ntime-toggleable=20gutter?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit STTextView (UIKit + AppKit) exposes the same `showsLineNumbers` Bool; both impls toggle the gutter view in place when flipped, so we just forward the codegen prop straight through. No remount, no reload. Surface: - Fabric spec gains `lineNumbers?: boolean` - Public `SourceEditorProps` + lower-level `SourceEditorViewProps` both accept it; `SourceEditor` defaults to `false` - ios/SourceEditor.mm forwards prop diffs to RNSESourceEditorImpl - iOS + macOS Swift impls both call `textView.showsLineNumbers = value` (macOS branch ships now even though the example app can't exercise it until #27 lands the Obj-C++ port) Example app gets a glass-effect Toggle in the toolbar (SF Symbol `number`) so the prop is demonstrably runtime-togglable. Closes #10 --- README.md | 4 ++-- docs/usage.md | 1 + example/ios-app/App.tsx | 18 ++++++++++++++++++ ios/SourceEditor.mm | 3 +++ ios/SourceEditorImpl.swift | 14 ++++++++++++++ src/SourceEditor.tsx | 2 ++ src/SourceEditor.types.ts | 2 ++ src/SourceEditorViewNativeComponent.ts | 1 + 8 files changed, 43 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 6d3ff28..c7e74f2 100644 --- a/README.md +++ b/README.md @@ -66,9 +66,9 @@ Bare-RN hosts: see [docs/installation.md](docs/installation.md) for the manual ` ## Roadmap -- **v0.x (now)** — bare RN Fabric library, iOS shipping. JS API: text, selection, font, theme, language (markdown / json / js / ts / html), `contentInsets`, imperative `focus`/`blur`. +- **v0.x (now)** — bare RN Fabric library, iOS shipping. JS API: text, selection, font, theme, language (markdown / json / js / ts / html), `lineNumbers` gutter toggle, `contentInsets`, imperative `focus`/`blur`. - **v0.x next** — macOS via Obj-C++ port ([#27](https://github.com/workspace-sh/react-native-source-editor/issues/27)). Unblocks the `example/macos-app/` target and re-adds `:osx` to the podspec. -- **v1.0** — line number gutter ([#10](https://github.com/workspace-sh/react-native-source-editor/issues/10)), expanded font customisation, npm publish under `@workspace-sh/react-native-source-editor`. +- **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. ## Contributing diff --git a/docs/usage.md b/docs/usage.md index 8ae2ca9..27a82cc 100644 --- a/docs/usage.md +++ b/docs/usage.md @@ -36,6 +36,7 @@ export default function Editor() { | `font` | `{ family?: string; size?: number }` | system mono @ 14 | Falls back to monospaced system font if `family` is missing or unresolvable. | | `theme` | `'light' \| 'dark' \| 'auto'` | `'auto'` | `auto` follows system appearance. | | `language` | `'plaintext' \| 'markdown' \| 'json' \| 'javascript' \| 'typescript' \| 'html'` | `'plaintext'` | Syntax highlighting via attributed text. `html` highlights nested CSS (in `