The app crashes when you touch the picker and the background of the picker selection is black while opened
- The app is in typescript and the picker behaves strangely that when I touch it then the app crashes and closes.
- When opening the picker then the background of his choice is black and it is not clear to me how to change to a white background. The library I use is: @ react-native-picker / picker
import React, { useEffect, useState } from 'react';
import { View, Text, StyleSheet, TouchableOpacity } from 'react-native';
import { Picker } from '@react-native-picker/picker';
const EventTypePicker = () => {
return (
<Picker
mode="dropdown"
style={styles.PickerText}
selectedValue={emergencyselection}
onValueChange={(itemValue, itemIndex) =>
setEmergencyselection(itemValue)
}>
<Picker.Item label="DOG" value="DOG" />
<Picker.Item label="CAT" value="CAT" />
</Picker>
)
}
return (
<>
<View style={styles.container}>
<View style={styles.text}>
<Text style={styles.label} >{MenuStrings.EventType}</Text>
<View style={styles.pickerView}>
<MaterialIcons
name="arrow-drop-down"
style={styles.pickerIcon}
/>
<EventTypePicker />
</View>
</View>
);
}
crash+1
crash in android when I touches the words. the dropdown triangle works fine
crash +1 How can this be fixed?
Same, when android is in dark mode, the background and the items are black
EDIT:
@roei133 to change items to a white background, I applied on each Picker Item these props:
<Picker.Item
label={label}
value={value}
color={'#000'}
style={{backgroundColor: '#fff', color: '#fff'}}
/>
When trying to refactoring styles to itemStyle on Picker component, the behaviour was not consistent…
Hope this helps
Seems to be fixed with
React-native 0.64.2 @react-native-picker/picker 1.16.3
This was a bug on React Native's side, should be fixed on React Native 0.64.2