Skip to content

Commit

Permalink
Add review changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Skalakid committed Sep 20, 2024
1 parent 47ac858 commit fd1f5a9
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/MarkdownTextInput.web.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ const MarkdownTextInput = React.forwardRef<TextInput, MarkdownTextInputProps>(
const history = useRef<InputHistory>();
const dimensions = useRef<Dimensions | null>(null);
const pasteContent = useRef<string | null>(null);
const hasJustFocused = useRef<boolean>(false);
const hasJustBeenFocused = useRef<boolean>(false);

if (!history.current) {
history.current = new InputHistory(100, 150, value || '');
Expand Down Expand Up @@ -268,9 +268,9 @@ const MarkdownTextInput = React.forwardRef<TextInput, MarkdownTextInputProps>(
updateSelection(e);

// If the input has just been focused, we need to scroll the cursor into view
if (divRef.current && contentSelection.current && hasJustFocused.current) {
if (divRef.current && contentSelection.current && hasJustBeenFocused.current) {
setCursorPosition(divRef.current, contentSelection.current?.start, contentSelection.current?.end, true);
hasJustFocused.current = false;
hasJustBeenFocused.current = false;
}
},
[updateSelection],
Expand Down Expand Up @@ -471,7 +471,7 @@ const MarkdownTextInput = React.forwardRef<TextInput, MarkdownTextInputProps>(

const handleFocus: FocusEventHandler<HTMLDivElement> = useCallback(
(event) => {
hasJustFocused.current = true;
hasJustBeenFocused.current = true;
const e = event as unknown as NativeSyntheticEvent<TextInputFocusEventData>;
const hostNode = e.target as unknown as HTMLDivElement;
currentlyFocusedField.current = hostNode;
Expand Down

0 comments on commit fd1f5a9

Please sign in to comment.