hossein-zare / react-native-dropdown-picker

A single / multiple, categorizable, customizable, localizable and searchable item picker (drop-down) component for react native which supports both Android & iOS.
https://hossein-zare.github.io/react-native-dropdown-picker-website/
MIT License
992 stars 296 forks source link

Performance issues, the picker takes more than 2 seconds to open #539

Closed dacapoo closed 2 years ago

dacapoo commented 2 years ago

Hello,

The picker performance is not ideal on Android, the picker takes almost 2 seconds. The behavior is consistent across the whole app I am using listmode=""SCROLLVIEW"

Is this how the picker is supposed to perform, or I am missing something ?

The video that demonstrates that -> https://drive.google.com/file/d/1WIHgdudlMT1gTE7OIieks8n4cYtTwovi/view?usp=sharing

hossein-zare commented 2 years ago

Hello,

I think it's because you have many pickers with frequently rendered items, Every time you open a picker the items are recreated. As a developer / programmer / software engineer, You should find bottlenecks and optimize your code.

// ✔
useEffect(() => {
    setItems1(...);
    setItems2(...);
    setItems3(...);
    ...
}, []);

// ❌
const [items1, setItems1] = useState(...);
const [items2, setItems2] = useState(...);
const [items3, setItems3] = useState(...);
...

You should also read articles about how to optimize react / react native apps.

kafeelkhatri commented 2 years ago

Its happening with me too is it possible to show a loader when i click on a picker and hide loader when picker opens ?