-
Notifications
You must be signed in to change notification settings - Fork 154
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
Invariant Violation: scrollToIndex out of range: requested index 28 is out of 0 to 1, js engine: hermes #275
Comments
I solved this inside the Dropdows.tsx Index file const scrollIndex = useCallback(() => {
if (autoScroll && data.length > 0 && listData?.length === data?.length) {
setTimeout(() => {
if (refList && refList?.current) {
const defaultValue = typeof value === 'object' ? _.get(value, valueField) : value;
const index = _.findIndex(listData, (e) => _.isEqual(defaultValue, _.get(e, valueField)));
if (index > -1 && index < listData.length) {
try {
refList.current.scrollToIndex({
index: index,
animated: false,
});
} catch (error) {
console.warn(`scrollToIndex error: ${error.message}`);
}
} else {
console.warn(`scrollToIndex out of range: requested index ${index} is out of 0 to ${listData.length - 1}`);
}
}
}, 200);
}
}, [autoScroll, data.length, listData, value, valueField, refList]); |
getting this error, again and again, need to be fixed, @gabrielroodriz you code converted the mi into warning but it's not worthy to edit in node modules for local use until it's merged in the library. |
Yes, I have a pull request open, waiting for approval for it: #279 |
Hi @gabrielroodriz , I faced this error. And apply your above file to my Dropdown index.tsx. It worked, but which selected it's not get select in my dropdown as a selected city its not appeared. |
No description provided.
The text was updated successfully, but these errors were encountered: