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

[BUG] initialScrollIndex "-1" is not valid #214

Closed
efstathiosntonas opened this issue May 18, 2023 · 4 comments
Closed

[BUG] initialScrollIndex "-1" is not valid #214

efstathiosntonas opened this issue May 18, 2023 · 4 comments
Assignees
Labels
bug Something isn't working documentation Improvements or additions to documentation

Comments

@efstathiosntonas
Copy link
Contributor

efstathiosntonas commented May 18, 2023

Hi, I'm using 2.1.5 and it throws this error when I open the drop down:

initialScrollIndex "-1" is not valid

I've changed this line:

to:

initialScrollIndex={initialScrollIndex === -1 ? 0 : initialScrollIndex}

But I don't know yet if there are any side effects, probably there aren't any, let me know if you want me to open a PR

To Reproduce
Steps to reproduce the behavior:
Nothing special, just:

 <Select
        clearable={false}
        flatListProps={{ indicatorStyle: theme.mode === "dark" ? "white" : "black" }}
        onSelect={setSelectedTicket}
        options={tickets || []}
        placeholderText={t("support_screen.select_box_placeholder") as string}
        placeholderTextColor={themeContext.newPost.select.placeholder}
        styles={selectStyles}
      />

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
Screenshot 2023-05-18 at 08 44 22

@efstathiosntonas efstathiosntonas added bug Something isn't working documentation Improvements or additions to documentation labels May 18, 2023
@gitsad gitsad self-assigned this May 30, 2023
@gitsad
Copy link
Contributor

gitsad commented May 30, 2023

Hi @efstathiosntonas

Why would you like to change this line into: initialScrollIndex={initialScrollIndex === -1 ? 0 : initialScrollIndex} ?

@efstathiosntonas
Copy link
Contributor Author

efstathiosntonas commented May 30, 2023

Hi @gitsad, I can't find out why initialScrollIndex is -1 to start with, haven't checked on source code where this is calculated so I over driven it to stop showing the error. No special use cases, check on how I'm using the module on 1st comment, pretty simple and straight forward usage.

@efstathiosntonas
Copy link
Contributor Author

efstathiosntonas commented May 30, 2023

Now that I'm thinking of it, I believe it doesn't like the empty array: options={tickets || []} thus it cannot find the initialScrollIndex.

I have to either wait for tickets to load or patch it as mentioned above.

@efstathiosntonas
Copy link
Contributor Author

efstathiosntonas commented Jun 7, 2023

closing this, probably fixed on rn 0.71.9 here, will test and reopen if needed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

2 participants