currently i am using native base and having this type of text input for search bar
<Text>
Card Name
</Text>
<Header searchBar rounded style={{ backgroundColor: '#E9E9EF'}}>
<Item style={{ backgroundColor: 'lightgray', borderRadius: 5 }}>
<Icon name="ios-search" />
<Input placeholder="Search" onChangeText={(searchText) => this.setState({searchText})} value={this.state.searchText} />
</Item>
</Header>
I wanted to enable paste from clipboard, where user can copy some text from other places and paste it on this search input box. How can i do that?
You can use the clipboard API : https://facebook.github.io/react-native/docs/clipboard or Textinput property : selectTextOnFocus
<TextInput selectTextOnFocus={true} />
You can use this community package which is suggested by the official docs
@react-native-clipboard/clipboard
import Clipboard from '@react-native-clipboard/clipboard'
You can easily access clipboard text by invoking an async function
const text = await Clipboard.getString()
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With