diff --git a/example/src/App.tsx b/example/src/App.tsx index 39aae5be..44cffa19 100644 --- a/example/src/App.tsx +++ b/example/src/App.tsx @@ -62,6 +62,7 @@ function getRandomColor() { export default function App() { const [value, setValue] = React.useState(DEFAULT_TEXT); const [markdownStyle, setMarkdownStyle] = React.useState({}); + const [selection, setSelection] = React.useState({start: 0, end: 0}); // TODO: use MarkdownTextInput ref instead of TextInput ref const ref = React.useRef(null); @@ -98,6 +99,10 @@ export default function App() { ref={ref} markdownStyle={markdownStyle} placeholder="Type here..." + onSelectionChange={(e) => { + setSelection({...e.nativeEvent.selection}); + }} + selection={selection} /> {/* TextInput singleline +