Smooth Page Slipping
Overview
This sample demonstrates how to optimize slow loading and frame loss issues when swiping complex waterfall pages. Specifically, based on an ArkTs application and typical usage scenarios, this sample builds a complex smooth page using performance optimization techniques such as lazy loading, list item caching, and component reuse to prevent frame loss.
Preview

Project Directory
├──ets
│ ├──constants
│ │ ├──BreakpointConstants.ets // Breakpoint constants
│ │ ├──CommonConstants.ets // Common constants
│ │ └──HomeConstants.ets // Home page constants
│ ├──entryability
│ │ └──EntryAbility.ets
│ ├──entrybackupability
│ │ └──EntryBackupAbility.ets
│ ├──model
│ │ ├──FooterTabData.ets // Data related to the footer tab
│ │ ├──FunctionEntryData.ets // Data for function entries
│ │ ├──FunctionEntryListData.ets // List of data in the function entry
│ │ ├──WaterFlowData.ets // Waterfall data
│ │ ├──WaterFlowDescriptionData.ets // Description data at the bottom of a waterfall item
│ │ ├──WaterFlowHeadData.ets // Media information of a waterfall item
│ │ └──WaterFlowListData.ets // List of waterfall data
│ ├──pages
│ │ ├──Index.ets // Page entry
│ │ ├──WaterFlowDataSource.ets // Data source class of the WaterFlow component
│ │ └──WaterFlowPage.ets // Function demonstration page of the WaterFlow component
│ ├──utils
│ │ ├──BreakpointSystem.ets // Breakpoint listening
│ │ ├──BreakpointType.ets // Breakpoint type
│ │ ├──Logger.ts // Log utility
│ │ └──NetworkUtil.ets // Network request utility
│ └──view
│ ├──FunctionView.ets // Function view
│ ├──HomeContent.ets // Home page
│ ├──IndexNavDestination.ets // Navigation bar entry
│ ├──NavigationBarView.ets // Navigation bar view
│ ├──SearchBarView.ets // Search bar view
│ ├──WaterFlowDescriptionView.ets // View for the description at the bottom of a waterfall item
│ ├──WaterFlowImageView.ets // View for the image description of a waterfall item
│ ├──WaterFlowLivingView.ets // View for the live video description of a waterfall item
│ ├──WaterFlowVideoView.ets // View for the video description of a waterfall item
│ └──WaterFlowView.ets // Waterfall view
└──resources // Resources
How to Implement
- Implement waterfall flows by using lazy loading and caching list items. This approach avoids the performance bottleneck caused by loading and rendering a large amount of data at once when using a list as the data source, and also prevents the white blocks that may occur when scrolling too quickly.
- Reuse the components for the cards in the waterfall flow model. This eliminates the performance loss caused by frequent creation and destruction of a large number of components with the same structure.
- During card placement, calculate the card height with a fixed aspect ratio. This prevents the card height from being measured twice after the component is rendered.
How to Use
- Swipe left and right on the function area.
- The waterfall flow supports pull-down refresh, ensuring no frame drops during scrolling.
Required Permissions
- ohos.permission.INTERNET: allows an application to access Internet.
- ohos.permission.GET_NETWORK_INFO: allows an application to obtain network connection status.
Restrictions
- This sample app is only supported on bar phones running standard systems.
- The HarmonyOS version must be HarmonyOS 5.0.0 Release or later.
- The DevEco Studio version must be DevEco Studio 6.0.1 Release or later.
- The HarmonyOS SDK version must be HarmonyOS 6.0.1 Release or later.