MobileReality / react-native-select-pro

React Native dropdown (select) component developed by Mobile Reality
https://mobilereality.github.io/react-native-select-pro
MIT License
280 stars 18 forks source link

fix: FlatList initialScrollIndex #233

Closed efstathiosntonas closed 10 months ago

efstathiosntonas commented 10 months ago

Items above initialScrollIndex on a fixed height list won't render, there are numerous bugs on react-native FlatList regarding this issue dated even back to 2015:

Problem:

Using this style which renders the whole list without the need to scroll it (applied on a really small list of 5 items):


optionsList: {
        maxHeight: 300
      },
      option: {
        container: {
          width: "100%",
          borderRadius: 8
        }
    }

...results in this issue shown below where the items above the initialScrollIndex are not rendered:

https://github.com/MobileReality/react-native-select-pro/assets/717975/87ca13f1-e1a1-4f89-a7b7-10125a27ca7d

After applying the fix proposed in this PR:

https://github.com/MobileReality/react-native-select-pro/assets/717975/e1b024a8-3eb6-437c-8c42-6773e892e02b

This is without the maxHeight: mvs(300) so it works fine in all scenarios:

https://github.com/MobileReality/react-native-select-pro/assets/717975/7d76a60e-3b0f-4a99-abda-a80ef4cc28d6

These changes align with SectionOptionsList:

changeset-bot[bot] commented 10 months ago

⚠️ No Changeset found

Latest commit: 04602dea0200299e3e7d49fe514a069476b503c3

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

efstathiosntonas commented 10 months ago

includes bonus fix for:

gitsad commented 10 months ago

@efstathiosntonas thanks for your contribution!

efstathiosntonas commented 10 months ago

@gitsad anytime, keep it up!