You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When inserting a list with >30 label-value pairs, the WheelPicker becomes almost unresponsive and slow.
Related to
Components
Demo
Docs
Typings
Steps to reproduce
Create a Wheelpicker component in your return statement.
Insert a list with more than 30 label-value pairs.
Open the app and try scrolling through the WheelPicker.
Lagging should be noticeable.
Expected behaviour
The WheelPicker should be easy to use and scroll smoothly.
Actual behaviour
The WheelPicker is lagging, causing confusion and incorrect feedback.
More Info
The issue seems to reside with the component assigning an event's contentOffset.y to a SharedValue offset on every scroll.
On their own, whether assigning a constant value to the SharedValue or logging contentOffset.y on every scroll, doesn't seem to impact performance.
My conclusion is that assigning an ever-changing variable to offset leads somehow to a behaviour which internally that messes with the rendering, causing stuttering.
How to remove lag
Go to node_modules/react-native-ui-lib/src/components/WheelPicker/index.js
Find the constant scrollHandler in index.js
comment out the following line:
offset.value = e.contentOffset.y;
Code snippet
const range = (min, max) => {
console.log(min, max, "minmax")
var range = new Array(max-min)
for(let i=min; i <= max; i++)
range[i-min] = i
return range.map(value => {return {label: value.toString(), value}})
}
const fieldRange = useMemo(()=>range(dialogOptions.min, dialogOptions.max), [])
.
.
.
<WheelPicker
numberOfVisibleRows={5}
initialValue={'0'}
items={fieldRange}>
</WheelPicker>
Screenshots/Video
Expected behaviour:
Actual behaviour:
Environment
React Native version: 0.70.5
React Native UI Lib version: ^7.18.3
Affected platforms
Android
iOS
Web
The text was updated successfully, but these errors were encountered:
Description
When inserting a list with >30 label-value pairs, the WheelPicker becomes almost unresponsive and slow.
Related to
Steps to reproduce
Expected behaviour
The WheelPicker should be easy to use and scroll smoothly.
Actual behaviour
The WheelPicker is lagging, causing confusion and incorrect feedback.
More Info
The issue seems to reside with the component assigning an event's contentOffset.y to a SharedValue offset on every scroll.
On their own, whether assigning a constant value to the SharedValue or logging contentOffset.y on every scroll, doesn't seem to impact performance.
My conclusion is that assigning an ever-changing variable to offset leads somehow to a behaviour which internally that messes with the rendering, causing stuttering.
How to remove lag
Code snippet
Screenshots/Video
Expected behaviour:
Actual behaviour:
Environment
Affected platforms
The text was updated successfully, but these errors were encountered: