react-native-picker / picker

Picker is a cross-platform UI component for selecting an item from a list of options.
MIT License
1.45k stars 273 forks source link

bug: don't work: no label and no value #536

Open 332lfgb6 opened 7 months ago

332lfgb6 commented 7 months ago
import React, { useState } from "react";
import { Picker } from "@react-native-picker/picker";
import { Text } from "react-native";

const CompPicker = () => {
  const [selectedLanguage, setSelectedLanguage] = useState();

  return (
    <>
      <Picker
        mode="dropdown"
        selectedValue={selectedLanguage}
        onValueChange={(itemValue, itemIndex) => setSelectedLanguage(itemValue)}
      >
        <Picker.Item label="Java" value="java" />
        <Picker.Item label="JavaScript" value="js" />
      </Picker>
      <Text style={{ marginTop: 100 }}>zzz</Text>
    </>
  );
};

export default CompPicker;

image

AlperenLogo commented 7 months ago

I have same issue. Please Help!

PhilipRudzinsky commented 7 months ago

Same issue

nzeris commented 7 months ago

I have the same issue. ver 2.5.1 seems to work for me

dbatrakov1 commented 7 months ago

I added the prop style={{ fontSize: 14 }}, and it works for me: <Picker.Item label={item} value={item} key={item} style={{ fontSize: 14 }} />

dancosta-fed commented 6 months ago

style={{ fontSize: 14 }}

This works for me! Thank you!

LushawnDev commented 6 months ago

I added the prop style={{ fontSize: 14 }}, and it works for me: <Picker.Item label={item} value={item} key={item} style={{ fontSize: 14 }} />

Setting font size also worked for me - glad I checked out the issues tab! Thank you 🙌🏻

RafaelCENG commented 6 months ago

fontSize working but I cant do it on all my pickers. Any chance they will release a fix?

jmarks-joshua commented 5 months ago

the fontSize has made no difference to mine.

Edit: I am using expo and once I created a new development build it worked just fine. Must have been a mismatch of native and javascript versions I guess.