react-native-search-bar
react-native-search-bar copied to clipboard
textInput value not showing android
textInput value not showing when typying in android my app forced to use RTL, typing in RTL works good but in LTR not showing only after fast-refresh LTR typing is showing
react-native 0.61 react-native-search-bar 3.5.1
Hey. I'm having the same issue on Android. The text input is not visible.
Have you found a solution?
I had a look at the source code and you can pass the prop textColor. This works for me.
<SearchBar
ref={searchBar}
placeholder="Search"
onChangeText={(text) => onChangeText(text)}
onSearchButtonPress={(text) => onSearchButtonPress(text)}
onCancelButtonPress={onCancelButtonPress}
textColor="black"
/>
[Edit] Change of color handling behavior in react native core.
~~For future debugging purposes, my guess is something fails while retrieving the native ColorStateList
. (We need the ColorStateList
for proper look/feel when the search bar is unfocused or not editable.)~~
https://github.com/umhan35/react-native-search-bar/blob/v3.5.1/android/src/main/java/org/umhan35/RNSearchBarManager.java#L154-L156
final int[] attrs = {android.R.attr.textColorPrimary};
final TypedArray a = searchView.getContext().obtainStyledAttributes(0, attrs);
colorList = a.getColorStateList(0);
@umhan35 would be really nice if you could merge the pull request