hoaphantn7604 / react-native-element-dropdown

A react-native dropdown component easy to customize for both iOS and Android.
MIT License
1.01k stars 173 forks source link

Crashes in production only - iOS #276

Open arlindiDev opened 6 months ago

arlindiDev commented 6 months ago

Works in the Expo Go simulator for iOS. But crashes in production. On iOS, it crashes when you try to open the dropdown.

I am building with eas build

To Reproduce

Additional details

Code

  const renderItem = (item, selected) => {
    return (
      <View style={ styles.itemBackground}>
        <View style={styles.item}>
          {/* <CountryFlag isoCode={item.value} size={12} /> */}
          <Text style={styles.textItem}>{item.label}</Text>
        </View>
      </View>
    );
  };

    const [country, setCountry] = useState("");
    const [items] = useState([
      { label: "United States", value: "us", index: 0 },
      { label: "Canada", value: "ca", index: 1 },
      { label: "United Kingdom", value: "gb", index: 9999 },
      // Add more countries as needed
    ]);

    <Dropdown
            style={[appStyle.dropdown]}
            placeholderStyle={styles.placeholderStyle}
            selectedTextStyle={styles.selectedTextStyle}
            selectedStyle={styles.selectedStyle}
            containerStyle={styles.containerStyle}
            itemContainerStyle={styles.itemContainerStyle}
            activeColor={"#000000"}
            data={items}
            maxHeight={300}
            labelField="label"
            valueField="value"
            placeholder={"Country"}
            value={country}
            onChange={(item) => {
              countryChange(item.value);
            }}
            renderItem={renderItem}
            renderRightIcon={() => (
              <Icon
                style={styles.iconStyle}
                name={"chevron-down"}
                size={20}
                color={country != "" ? "#000000" : "#6D6F78"}
              />
            )}
          />