Skip to content

Commit

Permalink
type fix
Browse files Browse the repository at this point in the history
  • Loading branch information
christianwen committed Sep 17, 2024
1 parent 17e1a5f commit de9ea3e
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/MarkdownTextInput.web.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@ import type {
TextInputKeyPressEventData,
TextInputFocusEventData,
TextInputContentSizeChangeEventData,
GestureResponderEvent,
} from 'react-native';
import React, {useEffect, useRef, useCallback, useMemo, useLayoutEffect} from 'react';
import type {CSSProperties, MutableRefObject, ReactEventHandler, FocusEventHandler, MouseEvent, KeyboardEvent, SyntheticEvent, ClipboardEventHandler} from 'react';
import type {CSSProperties, MutableRefObject, ReactEventHandler, FocusEventHandler, MouseEvent, KeyboardEvent, SyntheticEvent, ClipboardEventHandler, TouchEvent} from 'react';
import {StyleSheet} from 'react-native';
import {updateInputStructure} from './web/utils/parserUtils';
import InputHistory from './web/InputHistory';
Expand Down Expand Up @@ -591,6 +592,14 @@ const MarkdownTextInput = React.forwardRef<TextInput, MarkdownTextInputProps>(
divRef.current = r as MarkdownTextInputElement;
};

const handleTouchStart = (event: TouchEvent<HTMLDivElement>) => {
if (!onTouchStart) {
return;
}
const e = event as unknown as GestureResponderEvent;
onTouchStart(e);
};

useClientEffect(
function parseAndStyleValue() {
if (!divRef.current || value === divRef.current.value) {
Expand Down Expand Up @@ -677,7 +686,7 @@ const MarkdownTextInput = React.forwardRef<TextInput, MarkdownTextInputProps>(
dir={dir}
inputMode={inputMode}
onSelect={updateSelection}
onTouchStart={onTouchStart}
onTouchStart={handleTouchStart}
/>
);
},
Expand Down

0 comments on commit de9ea3e

Please sign in to comment.