I have a Text Input that I am using in React Native and want to disable Text Selection and further options that are show in the image :-
Can someone help me with this ?
I have a Text Input that I am using in React Native and want to disable Text Selection and further options that are show in the image :-
Can someone help me with this ?
Just set selection to the end of the text: selection={{start: this.state.text.length, end: this.state.text.length}}
You can use selection property. And when selection change, set selection prop to end position of your selection.
class App extends React.Component {
constructor(props) {
super(props);
this.state = {
selection: { start: 0, end: 0 },
};
}
onSelectionChange = ({ nativeEvent: { selection, text } }) => {
this.setState({ selection: { start: selection.end, end: selection.end } });
};
render() {
return (
<TextInput
onSelectionChange={this.onSelectionChange}
selection={this.state.selection}
value={this.state.value}
/>
);
}
}