umhan35 / react-native-search-bar

The high-quality iOS native search bar for react native.
MIT License
861 stars 207 forks source link

textInput value not showing android #177

Open omererbil opened 4 years ago

omererbil commented 4 years ago

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

hiphotels commented 4 years ago

Hey. I'm having the same issue on Android. The text input is not visible.

Have you found a solution?

Screenshot_1595583484

hiphotels commented 4 years ago

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"
      />
alpha0010 commented 4 years ago

[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);
mrsrhn commented 2 years ago

@umhan35 would be really nice if you could merge the pull request