picker icon indicating copy to clipboard operation
picker copied to clipboard

The app crashes when you touch the picker and the background of the picker selection is black while opened

Open roei133 opened this issue 5 years ago • 6 comments

  1. The app is in typescript and the picker behaves strangely that when I touch it then the app crashes and closes.
  2. 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>
 );
}

roei133 avatar May 27 '21 09:05 roei133

crash+1

DBL2017 avatar May 28 '21 10:05 DBL2017

crash in android when I touches the words. the dropdown triangle works fine

abcabccd avatar May 30 '21 10:05 abcabccd

crash +1 How can this be fixed?

nut-nuttawat avatar Jun 01 '21 05:06 nut-nuttawat

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

Tenshock avatar Jun 09 '21 09:06 Tenshock

Seems to be fixed with

React-native 0.64.2 @react-native-picker/picker 1.16.3

Victor-Jansson avatar Jul 12 '21 21:07 Victor-Jansson

This was a bug on React Native's side, should be fixed on React Native 0.64.2

Naturalclar avatar Jul 13 '21 23:07 Naturalclar