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 Search not working #3166

Open
2 tasks done
LorenDorez opened this issue Jul 7, 2024 · 4 comments
Open
2 tasks done

Picker Search not working #3166

LorenDorez opened this issue Jul 7, 2024 · 4 comments
Assignees
Labels
bug a bug in one of the components WIP

Comments

@LorenDorez
Copy link

LorenDorez commented Jul 7, 2024

Description

I copied the example picker from the Demo app but unfortunately searching doesnt appear to work. Im using Expo Go incase that might be an issue.

Related to

  • Picker

Steps to reproduce

  1. Load the component
  2. Click to open the picker and see the list of langs
  3. Type in ada to the search

Expected behavior

When I type ada the list should filter down

Actual behavior

Does nothing

More Info

Code snippet

import { longOptions } from "@/utils/dev/PickerScreenLongOptions";
import { useState } from "react";
import { Colors, Picker } from "react-native-ui-lib";

export default function CompanyPicker() {
    const [language, setLanguage] = useState();
    return (
        <Picker
            placeholder="Favorite Language"
            floatingPlaceholder
            value={language}
            enableModalBlur={false}
            onChange={item => setLanguage(item)}
            topBarProps={{title: 'Languages'}}
            // style={{color: Colors.red20}}
            showSearch
            searchPlaceholder={'Search a language'}
            searchStyle={{color: Colors.blue30, placeholderTextColor: Colors.grey50}}
            // onSearchChange={value => console.warn('value', value)}
            items={longOptions}
          />
    );
}

Environment

  • React Native version: 0.74.3
  • React Native UI Lib version: ^7.25.0
  • Expo: 51

Affected platforms

  • Android
  • iOS
@LorenDorez LorenDorez added the bug a bug in one of the components label Jul 7, 2024
@LorenDorez
Copy link
Author

Doing some more digger the usePickerSearch gets passed in children but in my case this appears to be undefined, should this pass in the items prop and not children?

@LorenDorez
Copy link
Author

LorenDorez commented Jul 7, 2024

So looks like it works if i move my items to the children like such:

import { longOptions } from "@/utils/dev/PickerScreenLongOptions";
import { useState } from "react";
import { Colors, Picker } from "react-native-ui-lib";

export default function CompanyPicker() {
    const [language, setLanguage] = useState();
    return (
        <Picker
            placeholder="Favorite Language"
            floatingPlaceholder
            value={language}
            enableModalBlur={false}
            onChange={item => setLanguage(item)}
            topBarProps={{title: 'Languages'}}
            // style={{color: Colors.red20}}
            showSearch
            searchPlaceholder={'Search a language'}
            searchStyle={{color: Colors.blue30, placeholderTextColor: Colors.grey50}}
            // onSearchChange={value => console.warn('value', value)}
            //items={longOptions}
        >
            {longOptions.map(option => (
              <Picker.Item key={option.value} value={option.value} label={option.label} disabled={option.disabled}/>
            ))}
        </Picker>
    );
}

but if i do that i lose the label on selected item :(

@Akash9923
Copy link

Above code is working

@adids1221
Copy link
Contributor

Hi, we are working on fix for this.
related PR

@adids1221 adids1221 self-assigned this Aug 15, 2024
@adids1221 adids1221 added the WIP label Aug 18, 2024
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 WIP
Projects
None yet
Development

No branches or pull requests

3 participants