react-native-picker / picker

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

Picker Item is not listed on IOS #550

Open JoezerSmaniotto opened 8 months ago

JoezerSmaniotto commented 8 months ago

I'm using Picker (@react-native-picker/picker) in a form, but on IOS it doesn't display the Picker.Items, on Android it worked perfectly estou usando a versão "@react-native-picker/picker": "2.4.10" e estou usando o "expo": "^49.0.0",

`

      <Controller
        control={control}
        rules={{ required: true }}
        render={({ field: { onChange, onBlur, value } }) => (
          <ContainerSelect>
            <Picker
              enabled={!isSubmitting && loadBrokers}
              selectedValue={value}
              onValueChange={onChange}
              onBlur={onBlur}
              style={{ backgroundColor: theme.colors.mediumGray, color: theme.colors.lightGray, height: 48, fontSize: 16 }}
              dropdownIconColor="white"
              dropdownIconRippleColor={theme.colors.mediumGray}>
              <Picker.Item label="" value="" />
              {brokers.map((item: broker) => {
                return <Picker.Item label={item.nameDisplay} value={item.name} key={item.nameDisplay} />;
              })}
            </Picker>
          </ContainerSelect>
        )}
        name="broker"
      />
      {errors.broker && <ErrorText>{errors.broker.message}</ErrorText>}
    </InputContainer>`

"In the broker input, it should present a listing"

Picker

Pickercode

sairamchow5555 commented 8 months ago

After installation of module run pod install

refer: https://www.npmjs.com/package/@react-native-picker/picker

JoezerSmaniotto commented 8 months ago

@sairamchow5555 But is expo-managed flow necessary when doing so?

sairamchow5555 commented 8 months ago

you can try to use the Selector from the native-base which also works similar to the react-native-picker/picker

scotttiger123 commented 7 months ago

its still not working using pod intstall on IOS any help ?

JoezerSmaniotto commented 7 months ago

I ended up creating the component by hand, considering it was having problems

iamjoshua commented 6 months ago

I can confirm that no items are rendered after following the install instructions within a clean install of the latest version of Expo 50.0.17 on iOS. What seems to be required is a parent View immediately around the picker, otherwise nothing will be rendered even if placed on a screen with other elements.

fjerbi commented 6 months ago

Same issue, here, Items are not rendered in IOS, any fixes or suggestions?

augustosamame commented 6 months ago

I can confirm that no items are rendered after following the install instructions within a clean install of the latest version of Expo 50.0.17 on iOS. What seems to be required is a parent View immediately around the picker, otherwise nothing will be rendered even if placed on a screen with other elements.

H! Can you elaborate on your workaround? I have put the Picker inside a View, but still not showing up in my Expo 50 project.

Serdnad commented 5 months ago

Surrounding the Picker in a View with an explicit width set did it for me. E.g.

<View style={{ width: "100%" }}>
  <PickerIOS>...</PickerIOS>
</View>
farzadali3 commented 4 months ago

Defining the width property in itemStyle prop of Picker would solve the issue of Picker items not appearing on the screen.


import { Picker } from '@react-native-picker/picker';

<Picker
  selectedValue={this.state.location}
  itemStyle={{ width: 150 }}  // Define width in itemStyle
>
  <Picker.Item label="Location 1" value="1" /> 
  <Picker.Item label="Location 2" value="2" />
  <Picker.Item label="Location 3" value="3" />
</Picker>