From 317a4481d56ea18ac64a07565c35824b361d0cbd Mon Sep 17 00:00:00 2001 From: lukewalczak Date: Tue, 22 Apr 2025 15:40:03 +0200 Subject: [PATCH] fix: add missing setSelection method on text input --- src/components/TextInput/TextInput.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/components/TextInput/TextInput.tsx b/src/components/TextInput/TextInput.tsx index aaea38a3b5..1bdd7cef00 100644 --- a/src/components/TextInput/TextInput.tsx +++ b/src/components/TextInput/TextInput.tsx @@ -184,7 +184,7 @@ interface CompoundedComponent type TextInputHandles = Pick< NativeTextInput, - 'focus' | 'clear' | 'blur' | 'isFocused' | 'setNativeProps' + 'focus' | 'clear' | 'blur' | 'isFocused' | 'setNativeProps' | 'setSelection' >; const DefaultRenderer = (props: RenderProps) => ; @@ -294,6 +294,8 @@ const TextInput = forwardRef( isFocused: () => root.current?.isFocused() || false, blur: () => root.current?.blur(), forceFocus: () => root.current?.focus(), + setSelection: (start: number, end: number) => + root.current?.setSelection(start, end), })); React.useEffect(() => {