diff --git a/src/MarkdownTextInput.web.tsx b/src/MarkdownTextInput.web.tsx index cce3dab3..e305c893 100644 --- a/src/MarkdownTextInput.web.tsx +++ b/src/MarkdownTextInput.web.tsx @@ -546,6 +546,15 @@ const MarkdownTextInput = React.forwardRef( updateSelection(null, {start: selection.start, end: selection.end || selection.start}); }, [selection, updateSelection]); + useEffect(() => { + if (history.current?.history.length !== 0) { + return; + } + const currentValue = value ?? ''; + history.current.add(currentValue, currentValue.length); + // eslint-disable-next-line react-hooks/exhaustive-deps + }, []); + return ( // eslint-disable-next-line jsx-a11y/no-static-element-interactions