You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I wanna use TextInput ref to set user selection, The react native has setSelection method, But it's not work on react-native-paper.
I saw the source code it dosent export this method. (
import{View,TextInput}from'react-native';constReceiveScreen: ScreenPage<{initialAmount?: number}>=({route: { params }})=>{constf=useRef<TextInput>(null);return(<Screen><TextInputvalue={'Hi this is a input'}ref={f}/><ButtononPress={()=>{f.current?.focus();// The TextInput from 'react-native' is work fine, but it's undefined while from 'react-native-paper'f.current?.setSelection(0,3);}}>
Select
</Button></Screen>);};
💡 I have tried to use setNativeProps instead, but it's not work both on react-native and react-native-paper.
Currently, I am doing it by rewriting the render, I think it's better to export this usefull method.
The text was updated successfully, but these errors were encountered:
TivonJJ
changed the title
Export the setSelection method on ref
Export the setSelection method on TextInput's ref
Jan 15, 2025
Issue
I wanna use TextInput ref to set user selection, The react native has setSelection method, But it's not work on react-native-paper.
I saw the source code it dosent export this method. (
react-native-paper/src/components/TextInput/TextInput.tsx
Line 290 in 8dcfbcc
Example
💡 I have tried to use setNativeProps instead, but it's not work both on react-native and react-native-paper.
Currently, I am doing it by rewriting the render, I think it's better to export this usefull method.
The text was updated successfully, but these errors were encountered: