Skip to main content
0.1Out now for Android and iOS→

The native code editor for React Native.

One C++ core shared by Android and iOS, drawn by a native view in Kotlin and Swift, with tree-sitter highlighting and a Nitro binding. Not a WebView in sight.

$bun add react-native-codepad react-native-nitro-modules
Engine
One C++ core
Highlighting
tree-sitter, 19 languages
Binding
Nitro, New Architecture
9:41
sample.js
find
↑↓
with
All
1
Ln 1, Col 1JavaScriptSpaces 2opened in 10 ms
qwertyuiop
asdfghjkl
⇧zxcvbnm⌫
123spacereturn
<CodeEditor autoCloseBrackets autoIndent />
selection handlesthe loupeedit menuundo and redoauto indentauto-closing pairsbracket matchingactive lineline numberssoft wrapregex searchreplace allhardware keystoolbar APIread only modeplaceholdercontent insetsscroll to line
//01speed

Every keystroke lands inside the frame.

Handling a key and drawing the result takes 3 ms on a 10,000 line file. A frame at 60 Hz is 16.7 ms. The rest is yours.

one frame at 60 Hz16.7 ms
3 ms
13.7 ms left over
work per keystroke · 10,000 line file · iOS, debug build · median of 60 keys
Frames go by. A key lands every 150 ms, as in the benchmark.slowed down 40×
key
key
key
key
key
key
key
3 ms
of work per keystroke on a 10,000 line file
iOS, debug build
7 ms
to reparse a 2,000 line Markdown file with 2,239 injections
Android, debug build
131 ms
to the first paint of a 100,000 line file
Android, debug build

Simulator and emulator numbers, re-measured before each release to catch regressions. Numbers from a real device are welcome in an issue.

//02highlighting

Nineteen languages. Ship only yours.

Every grammar is its own npm package, parsed by tree-sitter. Pick a language and a theme, then hover a capture to see what it paints.

position.ts
1type Position = { line: number; column: number };
2
3// Offsets count UTF-16 code units.
4export function toPosition(text: string, offset: number): Position {
5 const before = text.slice(0, offset);
6 const line = before.split('\n').length - 1;
7 const column = offset - (before.lastIndexOf('\n') + 1);
8 return { line, column };
9}
captures in this file
$ bun add react-native-codepad-lang-typescript
//03editing

An editor, not a text field.

No WebView and no TextInput. CodePad draws its own caret, handles and edit menu, and every key runs through the same engine paths.

const file = await open(path);
return await readFile(path, "utf8");

Selection that feels native

Tap, double tap and long press, with handles, the loupe and the platform's own edit menu.

one undo step
answer
⌘Zundo

Undo in whole words

Keystrokes group into one undo step, so undo takes back what you meant.

if (ready) {}
}

Pairs and indents, handled

Brackets and quotes close as you type. A newline keeps the indent and adds a level inside an open bracket.

findretriesAa.*\b4 matches
// readFile with retries
export async function load(path, retries = 3) {
for (let i = 0; i < retries; i++) {
if (i === retries - 1) throw error;

Find and replace, every match painted

Literal or regex, case sensitive and whole word, next and previous, replace one or all in a single undo group.

⌘ZUndo
⇧⇥Outdent the selected lines
⌥←Move by one word

Hardware keyboards

A full key table on both platforms. These are the iOS chords; Android gets its own.

⇥←→↶↷⌫
editor.current?.moveCaret('wordLeft')

Build your own key row

The toolbar API drives the same paths as the keyboard, straight from JavaScript.

1const message = "a long string literal that keeps going past the edge";

Soft wrap, or scroll

Wrap long lines or scroll sideways. The gutter and the active line come with both.

//04keyboard

It rides the keyboard.

Turn on avoidKeyboard and the keyboard's overlap goes into the bottom inset on every frame of its animation. The caret never ends up behind it.

1import { CodeEditor } from 'react-native-codepad';
2
3export function KeyboardAwareEditor() {
4 return (
5 <CodeEditor
6 avoidKeyboard
7 autoFocus
8 suggestions="off"
9 contentInsets={{ bottom: 56 }}
10 style={{ flex: 1 }}
11 />
12 );
13}
bottom inset
bottom inset, frame by frame
frame 0frame 15

Each dot is one frame of the keyboard animation, slowed down 4×. The inset follows the curve, not a fixed jump.

//05platforms

One core, two native views.

The same C++ core runs on both platforms, and each platform draws it with its own view and text layout. These are release builds of the example app.

The example app on iOS with a JavaScript file open in the dark themeThe example app on iOS with a Markdown file open in the light theme
iOS · Swift view · release build
The example app on Android with a JavaScript file open in the dark themeThe example app on Android with a Markdown file open in the light theme
Android · Kotlin view · release build
android
A native view in Kotlin, from Android 7.0 (API 24).
ios
A native view in Swift, from iOS 17.
both
One C++ core, one Nitro binding and one JavaScript API.
requires
React Native 0.81+New ArchitectureiOS 17+Android 7.0+ (API 24)react-native-nitro-modules
works with
Expo development buildsreact-native-keyboard-controllerreact-native-safe-area-context
Expo needs a development build or npx expo prebuild. Expo Go isn't supported.
//06agents

Your coding agent already knows it.

The CodePad skill gives coding agents the API and its pitfalls. The whole docs also ship as one plain text file.

Claude CodeCodexCursor
terminal
$npx skills add SectionTN/react-native-codepad
# or hand it the docs as plain text
$curl https://reactnativecodepad.pages.dev/llms-full.txt
//07roadmap

Where it goes next.

Released steps are on npm. Everything after them is planned in the open, and ideas go to the issues.

0.1
Android and iOS, fifteen languages, search, themes and the keyboard follower
0.1.3 and 0.1.4
Text padding, one font name for both platforms and horizontal scroll in a ScrollView
0.1.6
Decorations: underlines, space under a line and line backgrounds
0.1.7
PHP and SQL language packages
planned
Autocomplete and an LSP client
planned
Code folding and a minimap
planned
Multiple cursors, diagnostics, font ligatures and bidi editing
planned
Web
1.0
The first stable release


and start typing.

Add the editor and one language package, run pod install, and follow the quick start.

$ bun add react-native-codepad react-native-nitro-modules react-native-codepad-lang-javascript
$ cd ios && pod install