-
Notifications
You must be signed in to change notification settings - Fork 427
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
Remove the initial empty render of the scrollview if a scrollviewsize is passed #450
Conversation
…nder to remove initial shift by making opacity 0
src/core/RecyclerListView.tsx
Outdated
@@ -91,6 +91,7 @@ export interface RecyclerListViewProps { | |||
onVisibleIndicesChanged?: TOnItemStatusChanged; | |||
renderFooter?: () => JSX.Element | JSX.Element[] | null; | |||
externalScrollView?: { new(props: ScrollViewDefaultProps): BaseScrollView }; | |||
scrollViewSize?: Dimension; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
call out edge cases
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added in readme
…e render when the onLayout is called for the first time
Please i need this, its posible merge? |
@arunreddy10 thanks, working perfectly :), now its full replacement for flatlist and sectionList |
…utDelta check from gridlayoutmanager
src/core/RecyclerListView.tsx
Outdated
@@ -675,6 +717,11 @@ RecyclerListView.propTypes = { | |||
//Specify the initial item index you want rendering to start from. Preferred over initialOffset if both are specified. | |||
initialRenderIndex: PropTypes.number, | |||
|
|||
//Specify the estimated size of the recyclerlistview to render the list items in the first pass. If not provided, the recyclerlistview | |||
//will first render with no items and then fill in the items based on the size given by its onLayout event. When provided, the items are | |||
//rendered in the first pass according to the estimated size and then adjusted according to the actual size when the onLayout event arrives. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This isn't true right? With the new changes?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated the comments.
README.md
Outdated
@@ -107,6 +107,7 @@ not be as fast. | |||
| optimizeForInsertDeleteAnimations | No | boolean | Enables you to utilize layout animations better by unmounting removed items | | |||
| style | No | object | To pass down style to inner ScrollView | | |||
| scrollViewProps | No | object | For all props that need to be proxied to inner/external scrollview. Put them in an object and they'll be spread and passed down. | | |||
| scrollViewSize | No | Dimension | Will prevent the initial empty render required to compute the size of the listview and use these dimensions to render list items in the first render itself. This is useful for cases such as server side rendering. | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mention how canChangeSize can help
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added a comment for the same
src/core/RecyclerListView.tsx
Outdated
@@ -391,7 +410,15 @@ export default class RecyclerListView<P extends RecyclerListViewProps, S extends | |||
} | |||
if (forceFullRender || this.props.layoutProvider !== newProps.layoutProvider || this.props.isHorizontal !== newProps.isHorizontal) { | |||
//TODO:Talha use old layout manager | |||
this._virtualRenderer.setLayoutManager(newProps.layoutProvider.newLayoutManager(this._layout, newProps.isHorizontal)); | |||
if (forceFullRender) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This isn't what we want
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If layoutProvider and orientation changes we do the old thing. If only forceFullRender we use cached layouts.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved forceFullRender to separate if condition
hi @naqvitalha , @arunreddy10 Why not merge request ? |
The current behavior of recyclerlistview is to render an empty scrollview and then wait for its on layout event to get its actual size before rendering all the children inside it. If an estimated scroll view size is passed, then the children can also be rendered in the first pass based on those estimates removing an initial blank render. To change the size after render, canChangeSize must be set to true.