1e41f4b71Sopenharmony_ci# ArkUI Subsystem Changelog 2e41f4b71Sopenharmony_ci 3e41f4b71Sopenharmony_ci## cl.arkui.1 Restrictions on Data Type Declarations of State Variables 4e41f4b71Sopenharmony_ci 5e41f4b71Sopenharmony_ci1. The data types of state variables decorated by state decorators must be explicitly declared. They cannot be declared as **any**. 6e41f4b71Sopenharmony_ci 7e41f4b71Sopenharmony_ci Example: 8e41f4b71Sopenharmony_ci 9e41f4b71Sopenharmony_ci ```ts 10e41f4b71Sopenharmony_ci // xxx.ets 11e41f4b71Sopenharmony_ci @Entry 12e41f4b71Sopenharmony_ci @Component 13e41f4b71Sopenharmony_ci struct DatePickerExample { 14e41f4b71Sopenharmony_ci // Incorrect: @State isLunar: any = false 15e41f4b71Sopenharmony_ci @State isLunar: boolean = false 16e41f4b71Sopenharmony_ci 17e41f4b71Sopenharmony_ci build() { 18e41f4b71Sopenharmony_ci ... 19e41f4b71Sopenharmony_ci } 20e41f4b71Sopenharmony_ci } 21e41f4b71Sopenharmony_ci ``` 22e41f4b71Sopenharmony_ci 23e41f4b71Sopenharmony_ci2. The data type declaration of the **@State**, **@Provide**, **@Link**, or **@Consume** decorated state variables can consist of only one of the primitive data types or reference data types. 24e41f4b71Sopenharmony_ci 25e41f4b71Sopenharmony_ci The **Length**, **ResourceStr**, and **ResourceColor** types are combinations of primitive data types or reference data types. Therefore, they cannot be used by the aforementioned types of state variables. 26e41f4b71Sopenharmony_ci For details about the definitions of **Length**, **ResourceStr**, and **ResourceColor**, see [Types](../../../application-dev/reference/arkui-ts/ts-types.md). 27e41f4b71Sopenharmony_ci 28e41f4b71Sopenharmony_ci Example: 29e41f4b71Sopenharmony_ci 30e41f4b71Sopenharmony_ci ```ts 31e41f4b71Sopenharmony_ci // xxx.ets 32e41f4b71Sopenharmony_ci @Entry 33e41f4b71Sopenharmony_ci @Component 34e41f4b71Sopenharmony_ci struct IndexPage { 35e41f4b71Sopenharmony_ci // Incorrect: @State message: string | Resource = 'Hello World' 36e41f4b71Sopenharmony_ci @State message: string = 'Hello World' 37e41f4b71Sopenharmony_ci // Incorrect: @State message: ResourceStr = $r('app.string.hello') 38e41f4b71Sopenharmony_ci @State resourceStr: Resource = $r('app.string.hello') 39e41f4b71Sopenharmony_ci 40e41f4b71Sopenharmony_ci build() { 41e41f4b71Sopenharmony_ci Row() { 42e41f4b71Sopenharmony_ci Column() { 43e41f4b71Sopenharmony_ci Text(`${this.message}`) 44e41f4b71Sopenharmony_ci .fontSize(50) 45e41f4b71Sopenharmony_ci .fontWeight(FontWeight.Bold) 46e41f4b71Sopenharmony_ci } 47e41f4b71Sopenharmony_ci .width('100%') 48e41f4b71Sopenharmony_ci } 49e41f4b71Sopenharmony_ci .height('100%') 50e41f4b71Sopenharmony_ci } 51e41f4b71Sopenharmony_ci } 52e41f4b71Sopenharmony_ci ``` 53e41f4b71Sopenharmony_ci 54e41f4b71Sopenharmony_ci  55e41f4b71Sopenharmony_ci 56e41f4b71Sopenharmony_ci**Change Impacts** 57e41f4b71Sopenharmony_ci 58e41f4b71Sopenharmony_ci1. If the data type of a state variable decorated by a state decorator is declared as **any**, a build error message will be displayed. 59e41f4b71Sopenharmony_ci ```ts 60e41f4b71Sopenharmony_ci // ArkTS:WARN Please define an explicit type, not any. 61e41f4b71Sopenharmony_ci @State isLunar: any = false 62e41f4b71Sopenharmony_ci ``` 63e41f4b71Sopenharmony_ci3. If the data type of a **@State**, **@Provide**, **@Link**, and or **@Consume** decorated state variable is Length, **ResourceStr**, or **ResourceColor**, 64e41f4b71Sopenharmony_ci a build error will occur. 65e41f4b71Sopenharmony_ci 66e41f4b71Sopenharmony_ci ```ts 67e41f4b71Sopenharmony_ci /* ArkTS:ERROR The state variable type here is 'ResourceStr', it contains both a simple type and an object type, 68e41f4b71Sopenharmony_ci which are not allowed to be defined for state variable of a struct.*/ 69e41f4b71Sopenharmony_ci @State message: ResourceStr = $r('app.string.hello') 70e41f4b71Sopenharmony_ci ``` 71e41f4b71Sopenharmony_ci 72e41f4b71Sopenharmony_ci**Key API/Component Changes** 73e41f4b71Sopenharmony_ci 74e41f4b71Sopenharmony_ciN/A 75e41f4b71Sopenharmony_ci 76e41f4b71Sopenharmony_ci**Adaptation Guide** 77e41f4b71Sopenharmony_ci 78e41f4b71Sopenharmony_ci1. Explicitly declare the data type for state variables decorated by state decorators. 79e41f4b71Sopenharmony_ci3. 80e41f4b71Sopenharmony_ci Adapt the **@State**, **@Provide**, **@Link**, and **@Consume** decorated variables based on the following code snippet so that they do not use the **Length(string|number|Resource)**, **ResourceStr(string|Resource)**, and **ResourceColor(string|number|Color|Resource)** types: 81e41f4b71Sopenharmony_ci ```ts 82e41f4b71Sopenharmony_ci // Incorrect: 83e41f4b71Sopenharmony_ci @State message: ResourceStr = $r('app.string.hello') 84e41f4b71Sopenharmony_ci // Corrected: 85e41f4b71Sopenharmony_ci @State resourceStr: Resource = $r('app.string.hello') 86e41f4b71Sopenharmony_ci ``` 87e41f4b71Sopenharmony_ci 88e41f4b71Sopenharmony_ci## cl.arkui.2 Initialization Rules and Restrictions of Custom Components' Member Variables 89e41f4b71Sopenharmony_ci 90e41f4b71Sopenharmony_ciComply with the following rules when using constructors to initialize member variables: 91e41f4b71Sopenharmony_ci 92e41f4b71Sopenharmony_ci| **From the Variable in the Parent Component (Right) to the Variable in the Child Component (Below)**| **regular** | **@State** | **@Link** | **@Prop** | **@Provide** | **@Consume** | **@ObjectLink** | 93e41f4b71Sopenharmony_ci| -------------------------- | ----------- | ---------- | --------- | --------- | ------------ | ------------ | --------------- | 94e41f4b71Sopenharmony_ci| **regular** | Supported | Supported | Supported | Supported | Not supported | Not supported | Supported | 95e41f4b71Sopenharmony_ci| **@State** | Supported | Supported | Supported | Supported | Supported | Supported | Supported | 96e41f4b71Sopenharmony_ci| **@Link** | Not supported | Supported (1) | Supported (1) | Supported (1) | Supported (1) | Supported (1) | Supported (1) | 97e41f4b71Sopenharmony_ci| **@Prop** | Supported | Supported | Supported | Supported | Supported | Supported | Supported | 98e41f4b71Sopenharmony_ci| **@Provide** | Supported | Supported | Supported | Supported | Supported | Supported | Supported | 99e41f4b71Sopenharmony_ci| **@Consume** | Not supported | Not supported | Not supported | Not supported | Not supported | Not supported | Not supported | 100e41f4b71Sopenharmony_ci| **@ObjectLink** | Not supported | Not supported | Not supported | Not supported | Not supported | Not supported | Not supported | 101e41f4b71Sopenharmony_ci 102e41f4b71Sopenharmony_ci| **From the Variable in the Parent Component (Right) to the Variable in the Child Component (Below)**| **@StorageLink** | **@StorageProp** | **@LocalStorageLink** | **@LocalStorageProp** | 103e41f4b71Sopenharmony_ci| -------------------------- | ---------------- | ---------------- | --------------------- | --------------------- | 104e41f4b71Sopenharmony_ci| **regular** | Supported | Not supported | Not supported | Not supported | 105e41f4b71Sopenharmony_ci| **@State** | Supported | Supported | Supported | Supported | 106e41f4b71Sopenharmony_ci| **@Link** | Supported (1) | Supported (1) | Supported (1) | Supported (1) | 107e41f4b71Sopenharmony_ci| **@Prop** | Supported | Supported | Supported | Supported | 108e41f4b71Sopenharmony_ci| **@Provide** | Supported | Supported | Supported | Supported | 109e41f4b71Sopenharmony_ci| **@Consume** | Not supported | Not supported | Not supported | Not supported | 110e41f4b71Sopenharmony_ci| **@ObjectLink** | Not supported | Not supported | Not supported | Not supported | 111e41f4b71Sopenharmony_ci 112e41f4b71Sopenharmony_ci> **NOTE** 113e41f4b71Sopenharmony_ci> 114e41f4b71Sopenharmony_ci> **Supported (1)**: The dollar sign ($) must be used, for example, **this.$varA**. 115e41f4b71Sopenharmony_ci> 116e41f4b71Sopenharmony_ci> **regular**: refers to a regular variable that is not decorated by any decorator. 117e41f4b71Sopenharmony_ci 118e41f4b71Sopenharmony_ci**@StorageLink**, **@StorageProp**, **@LocalStorageLink**, and **@LocalStorageProp** variables cannot be initialized from the parent component. 119e41f4b71Sopenharmony_ci 120e41f4b71Sopenharmony_ci**Change Impacts** 121e41f4b71Sopenharmony_ci 122e41f4b71Sopenharmony_ci1. **@LocalStorageLink** and **@LocalStorageProp** variables cannot be initialized from the parent component. Otherwise, a build error message will be displayed. 123e41f4b71Sopenharmony_ci ```ts 124e41f4b71Sopenharmony_ci @Entry 125e41f4b71Sopenharmony_ci @Component 126e41f4b71Sopenharmony_ci struct LocalStorageComponent { 127e41f4b71Sopenharmony_ci build() { 128e41f4b71Sopenharmony_ci Column() { 129e41f4b71Sopenharmony_ci Child({ 130e41f4b71Sopenharmony_ci /* ArkTS:WARN Property 'simpleVarName' in the custom component 'Child' cannot 131e41f4b71Sopenharmony_ci initialize here (forbidden to specify). */ 132e41f4b71Sopenharmony_ci simpleVarName: 1, 133e41f4b71Sopenharmony_ci /* ArkTS:WARN Property 'objectName' in the custom component 'Child' cannot 134e41f4b71Sopenharmony_ci initialize here (forbidden to specify). */ 135e41f4b71Sopenharmony_ci objectName: new ClassA("x") 136e41f4b71Sopenharmony_ci }) 137e41f4b71Sopenharmony_ci } 138e41f4b71Sopenharmony_ci } 139e41f4b71Sopenharmony_ci } 140e41f4b71Sopenharmony_ci @Component 141e41f4b71Sopenharmony_ci struct Child { 142e41f4b71Sopenharmony_ci @LocalStorageLink("storageSimpleProp") simpleVarName: number = 0; 143e41f4b71Sopenharmony_ci @LocalStorageProp("storageObjectProp") objectName: ClassA = new ClassA("x"); 144e41f4b71Sopenharmony_ci build() {} 145e41f4b71Sopenharmony_ci } 146e41f4b71Sopenharmony_ci ``` 147e41f4b71Sopenharmony_ci2. The **@ObjectLink** decorated variable cannot be directly initialized from a decorated variable in the parent component. The source of the parent component must be an array item or object attribute decorated by **@State**, **@Link**, **@Provide**, **@Consume**, or **@ObjectLink**. 148e41f4b71Sopenharmony_ci ```ts 149e41f4b71Sopenharmony_ci let NextID : number = 0; 150e41f4b71Sopenharmony_ci 151e41f4b71Sopenharmony_ci @Observed class ClassA { 152e41f4b71Sopenharmony_ci public id : number; 153e41f4b71Sopenharmony_ci public c: number; 154e41f4b71Sopenharmony_ci constructor(c: number) { 155e41f4b71Sopenharmony_ci this.id = NextID++; 156e41f4b71Sopenharmony_ci this.c = c; 157e41f4b71Sopenharmony_ci } 158e41f4b71Sopenharmony_ci } 159e41f4b71Sopenharmony_ci 160e41f4b71Sopenharmony_ci @Component 161e41f4b71Sopenharmony_ci struct Child { 162e41f4b71Sopenharmony_ci @ObjectLink varA : ClassA; 163e41f4b71Sopenharmony_ci build() { 164e41f4b71Sopenharmony_ci Row() { 165e41f4b71Sopenharmony_ci Text('ViewA-' + this.varA.id) 166e41f4b71Sopenharmony_ci } 167e41f4b71Sopenharmony_ci } 168e41f4b71Sopenharmony_ci } 169e41f4b71Sopenharmony_ci 170e41f4b71Sopenharmony_ci @Component 171e41f4b71Sopenharmony_ci struct Parent { 172e41f4b71Sopenharmony_ci @Link linkValue: ClassA 173e41f4b71Sopenharmony_ci build() { 174e41f4b71Sopenharmony_ci Column() { 175e41f4b71Sopenharmony_ci /* ArkTS:ERROR The @Link property 'linkValue' cannot be assigned to 176e41f4b71Sopenharmony_ci the @ObjectLink property 'varA'.*/ 177e41f4b71Sopenharmony_ci Child({ varA: this.linkValue }) 178e41f4b71Sopenharmony_ci } 179e41f4b71Sopenharmony_ci } 180e41f4b71Sopenharmony_ci } 181e41f4b71Sopenharmony_ci ``` 182e41f4b71Sopenharmony_ci 183e41f4b71Sopenharmony_ci**Key API/Component Changes** 184e41f4b71Sopenharmony_ci 185e41f4b71Sopenharmony_ciN/A 186e41f4b71Sopenharmony_ci 187e41f4b71Sopenharmony_ci**Adaptation Guide** 188e41f4b71Sopenharmony_ci1. When building a child component, do not assign values to the variables decorated by **@LocalStorageLink** and **@LocalStorageProp** in the child component. 189e41f4b71Sopenharmony_ci 190e41f4b71Sopenharmony_ci To change these variables from the parent component, use the API provided by the **LocalStorage** (such as the **set** API) to assign values to them. 191e41f4b71Sopenharmony_ci 192e41f4b71Sopenharmony_ci2. For details about how to use **@ObjectLink**, see [\@Observed and \@ObjectLink Decorators: Observing Attribute Changes in Nested Class Objects](../../../application-dev/quick-start/arkts-observed-and-objectlink.md). 193e41f4b71Sopenharmony_ci 194e41f4b71Sopenharmony_ci## cl.arkui.3 Change of the onScrollBegin Event of the \<List> and \<Scroll> Components 195e41f4b71Sopenharmony_ci 196e41f4b71Sopenharmony_ciThe **onScrollBegin** event of the **\<List>** and **\<Scroll>** components is renamed **onScrollFrameBegin**. In the **onScrollBegin** event, the amount to scroll by is indicated by the **dx** and **dy** parameters. In the **onScrollFrameBegin** event, it is indicated by the **offset** parameter. The **onScrollFrameBegin** event adds the **ScrollState** parameter to indicate whether the component is in the finger dragging or inertial scrolling state. 197e41f4b71Sopenharmony_ci 198e41f4b71Sopenharmony_ci**Change Impacts** 199e41f4b71Sopenharmony_ci 200e41f4b71Sopenharmony_ciThe **onScrollBegin** event is deprecated and must be replaced with the **onScrollFrameBegin** event. 201e41f4b71Sopenharmony_ci 202e41f4b71Sopenharmony_ci**Key API/Component Changes** 203e41f4b71Sopenharmony_ci 204e41f4b71Sopenharmony_ci| Old Event | New Event | 205e41f4b71Sopenharmony_ci| ---------------------------------------- | ---------------------------------------- | 206e41f4b71Sopenharmony_ci| onScrollBegin(event: (dx: number, dy: number) => { dxRemain: number, dyRemain: number }) | onScrollFrameBegin(event: (offset: number, state: ScrollState) => { offsetRemain: number }) | 207e41f4b71Sopenharmony_ci 208e41f4b71Sopenharmony_ciFor details about the **onScrollFrameBegin** event, see the following: 209e41f4b71Sopenharmony_ci- [Scroll Events](../../../application-dev/reference/arkui-ts/ts-container-scroll.md#events) 210e41f4b71Sopenharmony_ci- [List Events](../../../application-dev/reference/arkui-ts/ts-container-list.md#events) 211e41f4b71Sopenharmony_ci 212e41f4b71Sopenharmony_ci**Adaptation Guide** 213e41f4b71Sopenharmony_ci 214e41f4b71Sopenharmony_ciSwitch the event from **onScrollBegin** to **onScrollFrameBegin**, and use the **offset** parameter in **onScrollFrameBegin**, rather than the **dx** and **dy** parameters in **onScrollBegin**, to indicate the amount to scroll by. 215e41f4b71Sopenharmony_ci 216e41f4b71Sopenharmony_ciExample of using the **onScrollBegin** event: 217e41f4b71Sopenharmony_ci```ts 218e41f4b71Sopenharmony_ci@Entry 219e41f4b71Sopenharmony_ci@Component 220e41f4b71Sopenharmony_cistruct NestedScroll { 221e41f4b71Sopenharmony_ci @State listPosition: number = 0; // 0 indicates scrolling to the top of the list, 1 indicates scrolling to the middle of the list, and 2 indicates scrolling to the bottom of the list. 222e41f4b71Sopenharmony_ci private arr: number[] = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] 223e41f4b71Sopenharmony_ci private scrollerForScroll: Scroller = new Scroller() 224e41f4b71Sopenharmony_ci private scrollerForList: Scroller = new Scroller() 225e41f4b71Sopenharmony_ci 226e41f4b71Sopenharmony_ci build() { 227e41f4b71Sopenharmony_ci Flex() { 228e41f4b71Sopenharmony_ci Scroll(this.scrollerForScroll) { 229e41f4b71Sopenharmony_ci Column() { 230e41f4b71Sopenharmony_ci Text("Scroll Area") 231e41f4b71Sopenharmony_ci .width("100%").height("40%").backgroundColor(0X330000FF) 232e41f4b71Sopenharmony_ci .fontSize(16).textAlign(TextAlign.Center) 233e41f4b71Sopenharmony_ci .onClick(() => { 234e41f4b71Sopenharmony_ci this.scrollerForList.scrollToIndex(5) 235e41f4b71Sopenharmony_ci }) 236e41f4b71Sopenharmony_ci 237e41f4b71Sopenharmony_ci List({ space: 20, scroller: this.scrollerForList }) { 238e41f4b71Sopenharmony_ci ForEach(this.arr, (item) => { 239e41f4b71Sopenharmony_ci ListItem() { 240e41f4b71Sopenharmony_ci Text("ListItem" + item) 241e41f4b71Sopenharmony_ci .width("100%").height("100%").borderRadius(15) 242e41f4b71Sopenharmony_ci .fontSize(16).textAlign(TextAlign.Center).backgroundColor(Color.White) 243e41f4b71Sopenharmony_ci }.width("100%").height(100) 244e41f4b71Sopenharmony_ci }, item => item) 245e41f4b71Sopenharmony_ci } 246e41f4b71Sopenharmony_ci .width("100%") 247e41f4b71Sopenharmony_ci .height("50%") 248e41f4b71Sopenharmony_ci .edgeEffect(EdgeEffect.None) 249e41f4b71Sopenharmony_ci .onReachStart(() => { 250e41f4b71Sopenharmony_ci this.listPosition = 0 251e41f4b71Sopenharmony_ci }) 252e41f4b71Sopenharmony_ci .onReachEnd(() => { 253e41f4b71Sopenharmony_ci this.listPosition = 2 254e41f4b71Sopenharmony_ci }) 255e41f4b71Sopenharmony_ci .onScrollBegin((dx: number, dy: number) => { 256e41f4b71Sopenharmony_ci if ((this.listPosition == 0 && dy >= 0) || (this.listPosition == 2 && dy <= 0)) { 257e41f4b71Sopenharmony_ci this.scrollerForScroll.scrollBy(0, -dy) 258e41f4b71Sopenharmony_ci return { dxRemain: dx, dyRemain: 0 } 259e41f4b71Sopenharmony_ci } 260e41f4b71Sopenharmony_ci this.listPosition = 1 261e41f4b71Sopenharmony_ci return { dxRemain: dx, dyRemain: dy }; 262e41f4b71Sopenharmony_ci }) 263e41f4b71Sopenharmony_ci 264e41f4b71Sopenharmony_ci Text("Scroll Area") 265e41f4b71Sopenharmony_ci .width("100%").height("40%").backgroundColor(0X330000FF) 266e41f4b71Sopenharmony_ci .fontSize(16).textAlign(TextAlign.Center) 267e41f4b71Sopenharmony_ci } 268e41f4b71Sopenharmony_ci } 269e41f4b71Sopenharmony_ci .width("100%").height("100%") 270e41f4b71Sopenharmony_ci }.width('100%').height('100%').backgroundColor(0xDCDCDC).padding(20) 271e41f4b71Sopenharmony_ci } 272e41f4b71Sopenharmony_ci} 273e41f4b71Sopenharmony_ci``` 274e41f4b71Sopenharmony_ciExample of using the **onScrollFrameBegin** event: 275e41f4b71Sopenharmony_ci```ts 276e41f4b71Sopenharmony_ci@Entry 277e41f4b71Sopenharmony_ci@Component 278e41f4b71Sopenharmony_cistruct NestedScroll { 279e41f4b71Sopenharmony_ci @State listPosition: number = 0; // 0 indicates scrolling to the top of the list, 1 indicates scrolling to the middle of the list, and 2 indicates scrolling to the bottom of the list. 280e41f4b71Sopenharmony_ci private arr: number[] = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] 281e41f4b71Sopenharmony_ci private scrollerForScroll: Scroller = new Scroller() 282e41f4b71Sopenharmony_ci private scrollerForList: Scroller = new Scroller() 283e41f4b71Sopenharmony_ci 284e41f4b71Sopenharmony_ci build() { 285e41f4b71Sopenharmony_ci Flex() { 286e41f4b71Sopenharmony_ci Scroll(this.scrollerForScroll) { 287e41f4b71Sopenharmony_ci Column() { 288e41f4b71Sopenharmony_ci Text("Scroll Area") 289e41f4b71Sopenharmony_ci .width("100%").height("40%").backgroundColor(0X330000FF) 290e41f4b71Sopenharmony_ci .fontSize(16).textAlign(TextAlign.Center) 291e41f4b71Sopenharmony_ci .onClick(() => { 292e41f4b71Sopenharmony_ci this.scrollerForList.scrollToIndex(5) 293e41f4b71Sopenharmony_ci }) 294e41f4b71Sopenharmony_ci 295e41f4b71Sopenharmony_ci List({ space: 20, scroller: this.scrollerForList }) { 296e41f4b71Sopenharmony_ci ForEach(this.arr, (item) => { 297e41f4b71Sopenharmony_ci ListItem() { 298e41f4b71Sopenharmony_ci Text("ListItem" + item) 299e41f4b71Sopenharmony_ci .width("100%").height("100%").borderRadius(15) 300e41f4b71Sopenharmony_ci .fontSize(16).textAlign(TextAlign.Center).backgroundColor(Color.White) 301e41f4b71Sopenharmony_ci }.width("100%").height(100) 302e41f4b71Sopenharmony_ci }, item => item) 303e41f4b71Sopenharmony_ci } 304e41f4b71Sopenharmony_ci .width("100%") 305e41f4b71Sopenharmony_ci .height("50%") 306e41f4b71Sopenharmony_ci .edgeEffect(EdgeEffect.None) 307e41f4b71Sopenharmony_ci .onReachStart(() => { 308e41f4b71Sopenharmony_ci this.listPosition = 0 309e41f4b71Sopenharmony_ci }) 310e41f4b71Sopenharmony_ci .onReachEnd(() => { 311e41f4b71Sopenharmony_ci this.listPosition = 2 312e41f4b71Sopenharmony_ci }) 313e41f4b71Sopenharmony_ci .onScrollFrameBegin((offset: number, state: ScrollState) => { 314e41f4b71Sopenharmony_ci if ((this.listPosition == 0 && offset >= 0) || (this.listPosition == 2 && offset <= 0)) { 315e41f4b71Sopenharmony_ci this.scrollerForScroll.scrollBy(0, -offset) 316e41f4b71Sopenharmony_ci return { offsetRemain: 0 } 317e41f4b71Sopenharmony_ci } 318e41f4b71Sopenharmony_ci this.listPosition = 1 319e41f4b71Sopenharmony_ci return { offsetRemain: offset }; 320e41f4b71Sopenharmony_ci }) 321e41f4b71Sopenharmony_ci 322e41f4b71Sopenharmony_ci Text("Scroll Area") 323e41f4b71Sopenharmony_ci .width("100%").height("40%").backgroundColor(0X330000FF) 324e41f4b71Sopenharmony_ci .fontSize(16).textAlign(TextAlign.Center) 325e41f4b71Sopenharmony_ci } 326e41f4b71Sopenharmony_ci } 327e41f4b71Sopenharmony_ci .width("100%").height("100%") 328e41f4b71Sopenharmony_ci }.width('100%').height('100%').backgroundColor(0xDCDCDC).padding(20) 329e41f4b71Sopenharmony_ci } 330e41f4b71Sopenharmony_ci} 331e41f4b71Sopenharmony_ci``` 332