3

I've got a text input in my app which I use as a search bar and I know that Android has an API to display a search type keyboard and I'm wondering how I can use it in react-native.

I've looked in the react-native text input documentation but didn't find anything for that type of keyboard in Android.

my screen

Anyone knows which type of keyboard I can use in text input to achieve wanted result?

2 Answers 2

15

Looks like you're looking for returnKeyType and keyboardType

Sign up to request clarification or add additional context in comments.

Comments

1

It seems like you want to show a keyboard layout that has a search icon in the bottom right corner, similar to:

Something like this

There is a property called returnKeyType, and if you set its type to search, you'll see the desired layout:

Example:

<TextInput placeholder='Search...' 
            returnKeyType="search" // This will show the search icon
            onSubmitEditing={handleSearch} // This handles the search icon press
            value={searchText}
            onChangeText={(text) => setSearchText(text)}/>

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.