( model: Model, props: VirtualListProps, kept = false )
| 352 | // After a content change, the stored offset can precede native's anchor |
| 353 | // adjustment. Keep the same visible item until the next scroll event. |
| 354 | const moved = ( |
| 355 | model: Model, |
| 356 | props: VirtualListProps, |
| 357 | kept = false |
| 358 | ): Virtualizer.Updated<Model> => { |
| 359 | if (model.viewport === 0) return { model, events: [] } |
| 360 | const origin = originOf(model, props) |
| 361 | return Virtualizer.update( |
| 362 | model, |
| 363 | props, |
| 364 | Virtualizer.Message.MovedViewport({ |
| 365 | start: kept ? model.scrollOffset - origin : startOf(model, props), |
| 366 | height: model.viewport, |
| 367 | anchor: kept && anchoredOf(props) ? model.position : null, |
| 368 | atStart: model.scrollOffset <= Virtualizer.edgeThreshold, |
| 369 | atEnd: atEndOf(model, props), |
| 370 | overflowing: model.content > model.viewport + 0.5, |
| 371 | length: Math.max(0, model.content - origin), |
| 372 | scrolled: null |
| 373 | }) |
| 374 | ) |
| 375 | } |
| 376 | |
| 377 | // The scroll the model asks for: to a waiting request's target, or to the |
| 378 | // end when the content grew under a list that follows it. |
no test coverage detected