Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Picker with MULTI – wrong value type #2716

Closed
2 of 7 tasks
mb8z opened this issue Aug 17, 2023 · 1 comment
Closed
2 of 7 tasks

Picker with MULTI – wrong value type #2716

mb8z opened this issue Aug 17, 2023 · 1 comment
Labels
bug a bug in one of the components waiting-for-response

Comments

@mb8z
Copy link

mb8z commented Aug 17, 2023

Description

Picker component with MULTI mode needs whole options to render their proper labels within text field

Related to

  • Components
  • Demo
  • Docs
  • Typings

Steps to reproduce

  1. Create a Picker component, with mode set to "MULTI".
  2. Use sample options (e.g. [{ label: 'Hello', value: '1' }, { label: 'World', value: '2' }])
  3. Pass ['1'] as the Pickers value – no labels renders in the text field
  4. Now pass [{ label: 'Hello', value: '1' }] as the value – the labels in the text field are now rendered correctly

Expected behavior

The expected behaviour would be to follow the expected type for the value

Actual behavior

See above

Code snippe

import { Picker as RNUIPicker } from 'react-native-ui-lib';

const options = [
  { value: '1', label: 'One' },
  { value: '2', label: 'Two' },
  { value: '3', label: 'Three' },
];
<Picker
  mode={Picker.modes.MULTI}
  value={['1', '2']}
>
  {options.map((option) => {
    return (
      <Picker.Item
        key={option.value}
        value={option.value}
        label={option.label}
      />
    );
  })}
</Picker>
// Versus
<Picker
  mode={Picker.modes.MULTI}
  value={[{ value: '1', label: 'One' }, { value: '2', label: 'Two' }]}
>
  {options.map((option) => {
    return (
      <Picker.Item
        key={option.value}
        value={option.value}
        label={option.label}
      />
    );
  })}
</Picker>

Screenshots/Video

Environment

  • React Native version: 0.72.3
  • React Native UI Lib version: 7.7.0

Affected platforms

  • Android
  • iOS – only tested here
  • Web
@mb8z mb8z added the bug a bug in one of the components label Aug 17, 2023
@ethanshar
Copy link
Collaborator

Hi @mb8z
This issue has been fixed
Please try a recent version

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug a bug in one of the components waiting-for-response
Projects
None yet
Development

No branches or pull requests

2 participants