Props
Every prop of CodeEditor with its type, its default and what it does.
CodeEditor takes every React Native ViewProps plus the props in the following tables. style sizes the editor as it sizes any other view. The editor ignores padding in style, and contentInsets is the padding instead. The callbacks are on the events page.
Document3
Sets the initial text of the editor. It is read once, so use setText() to replace the document later.
The id of an installed language package. Without the package the editor shows plain text.
Makes the editor read only: no keyboard, and the toolbar methods that type or delete do nothing. Selection, copy and search still work.
Appearance9
Sets the editor's colors. The prop is compared by reference, so define the object outside your component. See theme tokens.
The font, by the name React Native's Text takes: an expo-font key such as JetBrainsMono_400Regular, a font linked with react-native-asset or a system family. iOS also takes a PostScript name. Load the font before the editor mounts. With an unknown name or a font that loads later, the editor draws the default.
Sets the font size, in dp on Android and points on iOS.
Sets the line height as a multiple of fontSize. The row height is round(fontSize * lineHeight).
Shows the line number gutter.
Wraps long lines to the editor's width. When it's off, long lines scroll sideways.
Paints the line the caret is on.
Paints the bracket pair at the caret. Brackets inside strings and comments are skipped.
Shows this text while the document is empty.
Editing6
The width of one indentation level.
Indents with spaces. When it's off, the editor indents with tabs.
A newline keeps the indentation of the line before it and adds a level inside an open bracket.
Closes pairs as you type, skips over a closer you type yourself, wraps a selection, and removes an empty pair on Backspace.
Controls what the keyboard offers. off asks for no suggestions. forceOff also makes most Android keyboards type each letter straight in, without an underlined word in progress. on allows suggestions and autocorrect. On iOS, forceOff is the same as off.
Focuses the editor and opens the keyboard when the editor first appears.
Scrolling and keyboard4
Lets the editor scroll up and down. When it's off, vertical drags go to a parent ScrollView, and lines wider than the editor still scroll sideways.
Adds space inside the scrollable area, in dp on Android and points on iOS. A bottom inset keeps the caret above a toolbar.
The space between the text and the editor's left and right edges, inside contentInsets, in dp on Android and points on iOS. Set it to 0 to start the text exactly at contentInsets.left.
Adds the keyboard overlap to the bottom inset on every frame of the keyboard animation. See the keyboard guide.
Decorations2
Draws underlines, gaps under lines and line backgrounds. They follow edits until the next array arrives. See the decorations guide.
Gives the revision of the text the array was computed for, from getRevision() or ChangeEvent.revision. The editor moves the array through the edits made since then. Without it, the editor takes the array as computed for the current text.