Repository navigation
Open
Description
Describe the bug
I am using picker-select in form for creating/editing notes. I am fetching items from our API.
First issue is with create note:
- Open picker, can see all items
- Select item
- item label is not shown in select field
- if i save note, it is created with correct category
Issue with edit:
- click on edit
- do not see label
- can select different item, but after select, do not see label in field
It works fine only if i have items array locally ( not acceptable) and also default value is set to value from items, which is problem for creating new, because default is null. Also it is not accepting default value from props (as can be seen in code snipet)
On iPhone works just fine, only Android issue.
To Reproduce
Steps to reproduce the behavior:
- Go to '...'
- Click on '....'
- Scroll down to '....'
- See error
Expected behavior
I expected the same behavior as on iPhone.
Screenshots
- Empty new form
- Show all items
- Select picker after select one of the items
Additional details
- Device: [Pixel 3]
- OS: [Android 11]
- react-native-picker-select version: [8.04]
- react-native version: [0.63]
- expo sdk version: [40]
Reproduction and/or code sample
function NewNote({ t, note: _note, loading, onSubmit, onCancel }) {
const [note, setNote] = useState(_note);
const [categories, setCategories] = useState([]);
const [categoryId, setCategoryId] = (_note && _note.categoryId );
const handleSubmit = async () => {
await onSubmit(note);
setNote(null);
onCancel();
};
const loadCategories = async () => {
const res = await axios('categories/autocompletes', {
params: {
params: { perPage: 9999 },
filters: [
{
by: 'categoryType',
rule: 'equal',
value: 'Note'
}
]
}
});
setCategories(
res.data.categories.map(c => ({
value: c.id,
label: c.name
}))
);
};
const handleNoteTypeChange = value => {
if (!value) return;
setCategoryId(value);
setNote({ ...note, categoryId: value });
};
useEffect(() => {
loadCategories();
}, []);
return (
<RNPickerSelect
value={note && note.categoryId}
onValueChange={handleNoteTypeChange}
style={_pickerStyles}
placeholder={{ label: 'Type', value: null }}
items={categories}
/>
)
Reacted by EmmanuelSkapple, Iwashi1t, Cory Harter, Reza Sam Khaniani, Tim Traversy, Daniel Rivera, Jędrzej Majko, wspoon and Valentyn Saik
Metadata
Metadata
Assignees
Labels
No labels



Activity
EmmanuelSkapple commentedon Jan 19, 2021
Same error to :/
KIMNIGANG commentedon Jan 20, 2021
same error too
guozhaolong commentedon Jan 22, 2021
same error too
iwashi1t commentedon Jan 22, 2021
As a temporary workaround, I found two solutions.
Set one of the following prop to RNPickerSelect,
style={{ inputAndroid: { color: 'black' } }}useNativeAndroidPickerStyle={false}guozhaolong commentedon Jan 22, 2021
verified, inputAndroid: {color:'black' } this trick is easy to use,thx bro
matobiely commentedon Jan 22, 2021
@iwashi1t Thanks. It helps. But as you mentioned, it is just temporary workaround, it will be great, if somebody from team take a look on it.
iggirex commentedon Feb 5, 2021
After many hours of twiddling with this thing finally found this thread. Low and behold this indeed does fix the problem!!
style={{ inputAndroid: { color: 'black' } }} useNativeAndroidPickerStyle={false}My other solution was to set the placeholder as empty object, but this screws up the layout if you're needing that placeholder
placeholder={{}}Tharinducn commentedon Feb 7, 2021
This didn't fix the issue.
imsjmalve commentedon Feb 23, 2021
style={{ inputAndroid: { color: 'black' } }}
useNativeAndroidPickerStyle={false}
these two perfectly works for me
dschnare commentedon Feb 24, 2021
I'm having this issue with iOS actually. Tried setting styles for
inputIOSwith no dice.imsjmalve commentedon Feb 26, 2021
u said useNativeAndroidPickerStyle={false}, find another for iso
ubay1 commentedon Mar 20, 2021
const [selectedLanguage, setSelectedLanguage] = useState('');
<RNPickerSelect
useNativeAndroidPickerStyle={false}
value={selectedLanguage}
onValueChange={(itemValue) => {
setSelectedLanguage(itemValue)
}}
items={[
{ label: 'Football', value: 'football' },
{ label: 'Baseball', value: 'baseball' },
{ label: 'Hockey', value: 'hockey' },
]} >
{selectedLanguage }
ubay1 commentedon Mar 20, 2021
hey, lets try..
EvgeniiKlepilin commentedon Apr 2, 2021
One thing that I found was that if you have a default Android Theme, it usually has a default application-wide font color set to
#ffffff. You can change that by either adding a custom font color to existing theme, or changing parent theme to themes like MaterialDark or Holo for example.android/app/src/main/res/values/styles.xml
android/app/src/main/AndroidManifest.xml
References:
It seems that there are some native parts of this package that can be changed by tweaking details of the manifest.
Saurabhreactninja commentedon May 26, 2021
Which version of picker_select you are using ?
JedrzejMajko commentedon Apr 11, 2022
Regarding iOS and Android I encounter similar issue when padding (in inputIOS or )inputAndroid was set to large number, like 20 on ios 14 or lower. on ios 15 vertical padding of 20+ didn't cause same issue.
So this can also be a styling issue coming from label being out of view.
This is iOS 14 with inputIOS.paddingVertical 10:

This is iOS 14 with inputIOS.paddingVertical 18:
