Skip to content

Commit 47e2841

Browse files
authored
fix: add missing setSelection method on text input (#4688)
1 parent 27a6556 commit 47e2841

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/components/TextInput/TextInput.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ interface CompoundedComponent
184184

185185
type TextInputHandles = Pick<
186186
NativeTextInput,
187-
'focus' | 'clear' | 'blur' | 'isFocused' | 'setNativeProps'
187+
'focus' | 'clear' | 'blur' | 'isFocused' | 'setNativeProps' | 'setSelection'
188188
>;
189189

190190
const DefaultRenderer = (props: RenderProps) => <NativeTextInput {...props} />;
@@ -294,6 +294,8 @@ const TextInput = forwardRef<TextInputHandles, Props>(
294294
isFocused: () => root.current?.isFocused() || false,
295295
blur: () => root.current?.blur(),
296296
forceFocus: () => root.current?.focus(),
297+
setSelection: (start: number, end: number) =>
298+
root.current?.setSelection(start, end),
297299
}));
298300

299301
React.useEffect(() => {

0 commit comments

Comments
 (0)