diff --git a/en/release-notes/changelogs/OpenHarmony_4.0.2.3/changelogs-arkui.md b/en/release-notes/changelogs/OpenHarmony_4.0.2.3/changelogs-arkui.md index cb91d8c6854e5a39c552f2cb3016d671aa0664c5..44851cb60473fe9f08708c8c80c989c014363d0f 100644 --- a/en/release-notes/changelogs/OpenHarmony_4.0.2.3/changelogs-arkui.md +++ b/en/release-notes/changelogs/OpenHarmony_4.0.2.3/changelogs-arkui.md @@ -1,8 +1,8 @@ -# ArkUI Subsystem ChangeLog +# ArkUI Subsystem Changelog ## cl.arkui.1 Restrictions on Data Type Declarations of State Variables -1. The data types of state variables decorated by state decorators must be explicitly declared. They cannot be declared as **any** or **Date**. +1. The data types of state variables decorated by state decorators must be explicitly declared. They cannot be declared as **any**. Example: @@ -13,34 +13,13 @@ struct DatePickerExample { // Incorrect: @State isLunar: any = false @State isLunar: boolean = false - // Incorrect: @State selectedDate: Date = new Date('2021-08-08') - private selectedDate: Date = new Date('2021-08-08') - + build() { - Column() { - Button('Switch Calendar') - .margin({ top: 30 }) - .onClick(() => { - this.isLunar = !this.isLunar - }) - DatePicker({ - start: new Date('1970-1-1'), - end: new Date('2100-1-1'), - selected: this.selectedDate - }) - .lunar(this.isLunar) - .onChange((value: DatePickerResult) => { - this.selectedDate.setFullYear(value.year, value.month, value.day) - console.info('select current date is: ' + JSON.stringify(value)) - }) - - }.width('100%') + ... } } ``` - - ![datePicker](../../../application-dev/reference/arkui-ts/figures/datePicker.gif) - + 2. 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. 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. @@ -76,17 +55,14 @@ **Change Impacts** -1. If the data type of a state variable decorated by a state decorator is declared as **any**, a build error will occur. +1. If the data type of a state variable decorated by a state decorator is declared as **any**, a build error message will be displayed. ```ts - // ArkTS:ERROR Please define an explicit type, not any. + // ArkTS:WARN Please define an explicit type, not any. @State isLunar: any = false ``` -2. If the data type of a state variable decorated by a state decorator is declared as **Date**, a build error will occur. - ```ts - // ArkTS:ERROR The @State property 'selectedDate' cannot be a 'Date' object. - @State selectedDate: Date = new Date('2021-08-08') - ``` -3. If the data type of a **@State**, **@Provide**, **@Link**, and or **@Consume** decorated state variable is Length, **ResourceStr**, or **ResourceColor**, a build error will occur. +3. If the data type of a **@State**, **@Provide**, **@Link**, and or **@Consume** decorated state variable is Length, **ResourceStr**, or **ResourceColor**, + a build error will occur. + ```ts /* ArkTS:ERROR The state variable type here is 'ResourceStr', it contains both a simple type and an object type, which are not allowed to be defined for state variable of a struct.*/ @@ -100,7 +76,6 @@ N/A **Adaptation Guide** 1. Explicitly declare the data type for state variables decorated by state decorators. -2. If a state variable decorated by a state decorator uses the **Date** object, change it to a regular variable – a variable not decorated by any decorator. 3. 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: ```ts @@ -115,24 +90,24 @@ N/A Comply with the following rules when using constructors to initialize member variables: | **From the Variable in the Parent Component (Right) to the Variable in the Child Component (Below)**| **regular** | **@State** | **@Link** | **@Prop** | **@Provide** | **@Consume** | **@ObjectLink** | -|---------------------------------|----------------------------|------------|-----------|-----------|--------------|--------------|------------------| -| **regular** | Supported | Supported | Supported | Supported | Not supported | Not supported | Supported | -| **@State** | Supported | Supported | Supported | Supported | Supported | Supported | Supported | -| **@Link** | Not supported | Supported (1) | Supported (1) | Supported (1) | Supported (1) | Supported (1) | Supported (1) | -| **@Prop** | Supported | Supported | Supported | Supported | Supported | Supported | Supported | -| **@Provide** | Supported | Supported | Supported | Supported | Supported | Supported | Supported | -| **@Consume** | Not supported | Not supported | Not supported | Not supported | Not supported | Not supported | Not supported | -| **@ObjectLink** | Not supported | Not supported | Not supported | Not supported | Not supported | Not supported | Not supported | +| -------------------------- | ----------- | ---------- | --------- | --------- | ------------ | ------------ | --------------- | +| **regular** | Supported | Supported | Supported | Supported | Not supported | Not supported | Supported | +| **@State** | Supported | Supported | Supported | Supported | Supported | Supported | Supported | +| **@Link** | Not supported | Supported (1) | Supported (1) | Supported (1) | Supported (1) | Supported (1) | Supported (1) | +| **@Prop** | Supported | Supported | Supported | Supported | Supported | Supported | Supported | +| **@Provide** | Supported | Supported | Supported | Supported | Supported | Supported | Supported | +| **@Consume** | Not supported | Not supported | Not supported | Not supported | Not supported | Not supported | Not supported | +| **@ObjectLink** | Not supported | Not supported | Not supported | Not supported | Not supported | Not supported | Not supported | | **From the Variable in the Parent Component (Right) to the Variable in the Child Component (Below)**| **@StorageLink** | **@StorageProp** | **@LocalStorageLink** | **@LocalStorageProp** | -|------------------|------------------|------------------|-----------------------|------------------------| -| **regular** | Supported | Not supported | Not supported | Not supported | -| **@State** | Supported | Supported | Supported | Supported | -| **@Link** | Supported (1) | Supported (1) | Supported (1) | Supported (1) | -| **@Prop** | Supported | Supported | Supported | Supported | -| **@Provide** | Supported | Supported | Supported | Supported | -| **@Consume** | Not supported | Not supported | Not supported | Not supported | -| **@ObjectLink** | Not supported | Not supported | Not supported | Not supported | +| -------------------------- | ---------------- | ---------------- | --------------------- | --------------------- | +| **regular** | Supported | Not supported | Not supported | Not supported | +| **@State** | Supported | Supported | Supported | Supported | +| **@Link** | Supported (1) | Supported (1) | Supported (1) | Supported (1) | +| **@Prop** | Supported | Supported | Supported | Supported | +| **@Provide** | Supported | Supported | Supported | Supported | +| **@Consume** | Not supported | Not supported | Not supported | Not supported | +| **@ObjectLink** | Not supported | Not supported | Not supported | Not supported | > **NOTE** > @@ -144,7 +119,7 @@ Comply with the following rules when using constructors to initialize member var **Change Impacts** -1. Variables decorated by **@LocalStorageLink** and **@LocalStorageProp** cannot be initialized from the parent component. +1. **@LocalStorageLink** and **@LocalStorageProp** variables cannot be initialized from the parent component. Otherwise, a build error message will be displayed. ```ts @Entry @Component @@ -152,10 +127,10 @@ Comply with the following rules when using constructors to initialize member var build() { Column() { Child({ - /* ArkTS:ERROR Property 'simpleVarName' in the custom component 'Child' cannot + /* ArkTS:WARN Property 'simpleVarName' in the custom component 'Child' cannot initialize here (forbidden to specify). */ simpleVarName: 1, - /* ArkTS:ERROR Property 'objectName' in the custom component 'Child' cannot + /* ArkTS:WARN Property 'objectName' in the custom component 'Child' cannot initialize here (forbidden to specify). */ objectName: new ClassA("x") }) @@ -210,11 +185,11 @@ Comply with the following rules when using constructors to initialize member var N/A **Adaptation Guide** -1. When building a child component, do not perform the build on the variables decorated by **@LocalStorageLink** and **@LocalStorageProp** in the child component. - - 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. - -2. For details about how to use **@ObjectLink**, see [@Observed and @ObjectLink](../../../application-dev/quick-start/arkts-observed-and-objectlink.md). +1. When building a child component, do not assign values to the variables decorated by **@LocalStorageLink** and **@LocalStorageProp** in the child component. + + 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. + +2. 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). ## cl.arkui.3 Change of the onScrollBegin Event of the \ and \ Components @@ -226,13 +201,13 @@ The **onScrollBegin** event is deprecated and must be replaced with the **onScro **Key API/Component Changes** -| Old Event | New Event | -|------------------ | ------------------- | +| Old Event | New Event | +| ---------------------------------------- | ---------------------------------------- | | onScrollBegin(event: (dx: number, dy: number) => { dxRemain: number, dyRemain: number }) | onScrollFrameBegin(event: (offset: number, state: ScrollState) => { offsetRemain: number }) | For details about the **onScrollFrameBegin** event, see the following: -- [Scroll](../../../application-dev/reference/arkui-ts/ts-container-scroll.md#events) -- [List](../../../application-dev/reference/arkui-ts/ts-container-list.md#events) +- [Scroll Events](../../../application-dev/reference/arkui-ts/ts-container-scroll.md#events) +- [List Events](../../../application-dev/reference/arkui-ts/ts-container-list.md#events) **Adaptation Guide** diff --git a/en/release-notes/changelogs/OpenHarmony_4.0.8.2/changelogs-arkui.md b/en/release-notes/changelogs/OpenHarmony_4.0.8.2/changelogs-arkui.md new file mode 100644 index 0000000000000000000000000000000000000000..85f6aebf03beb604a61c7be18c293507b8415eab --- /dev/null +++ b/en/release-notes/changelogs/OpenHarmony_4.0.8.2/changelogs-arkui.md @@ -0,0 +1,99 @@ +# ArkUI Subsystem Changelog + +## cl.arkui.1 Restrictions on Data Type Declarations of State Variables + +The data types of state variables decorated by state decorators must be explicitly declared. They cannot be declared as **any**. + +**Example** + +```ts +// xxx.ets +@Entry +@Component +struct DatePickerExample { + // Incorrect: @State isLunar: any = false + @State isLunar: boolean = false + + build() { + ... + } +} +``` + +**Change Impacts** + +If the data type of a state variable decorated by a state decorator is declared as **any**, a WARN-level (previously ERROR-level) build error will occur. + +```ts +// ArkTS:ERROR Please define an explicit type, not any. +@State isLunar: any = false +``` + +**Key API/Component Changes** + +N/A + +**Adaptation Guide** + +Explicitly declare the data type for state variables decorated by state decorators. + +## cl.arkui.2 Initialization Rules and Restrictions of Custom Components' Member Variables + +**@LocalStorageLink** and **@LocalStorageProp** variables cannot be initialized from the parent component. + +**Example** + +```ts +let NextID: number = 0; + +@Observed +class ClassA { + public id: number; + public c: number; + + constructor(c: number) { + this.id = NextID++; + this.c = c; + } +} + +@Entry +@Component +struct LocalStorageComponent { + build() { + Column() { + Child({ + /* ArkTS:ERROR Property 'simpleVarName' in the custom component 'Child' cannot + initialize here (forbidden to specify). */ + simpleVarName: 1, + /* ArkTS:ERROR Property 'objectName' in the custom component 'Child' cannot + initialize here (forbidden to specify). */ + objectName: new ClassA(1) + }) + } + } +} + +@Component +struct Child { + @LocalStorageLink("storageSimpleProp") simpleVarName: number = 0; + @LocalStorageProp("storageObjectProp") objectName: ClassA = new ClassA(1); + + build() { + } +} +``` + +**Change Impacts** + +If **@LocalStorageLink** and **@LocalStorageProp** variables are initialized from the parent component, a WARN-level (previously ERROR-level) build error will occur. + +**Key API/Component Changes** + +N/A + +**Adaptation Guide** + +When building a child component, do not assign values to the variables by **@LocalStorageLink** and **@LocalStorageProp** in the child component. + +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. diff --git a/en/release-notes/changelogs/OpenHarmony_4.0.8.5/changelogs-arkui.md b/en/release-notes/changelogs/OpenHarmony_4.0.8.5/changelogs-arkui.md new file mode 100644 index 0000000000000000000000000000000000000000..b11e318f5f61130ce0665ae0f4fe31671a58d409 --- /dev/null +++ b/en/release-notes/changelogs/OpenHarmony_4.0.8.5/changelogs-arkui.md @@ -0,0 +1,43 @@ +# ArkUI Subsystem Changelog + +## cl.arkui.1 Change in the Priority of alignContent and align Attributes for \ + +Changed the priority of **alignContent** and **align** as follows: + +API version 9 and earlier: The universal attribute **align** prevails. + +API version 10 and later: The last set attribute prevails. + +When two attributes provide the same functions, the last set attribute takes effect. This rule applies to **alignContent** and **align**, both of which set the alignment mode when used for the **\** component. + +**Example** + +```ts +// xxx.ets +@Entry +@Component +struct StackExample { + build() { + Stack({alignContent:Alignment.Start}){ + Text("Stack's child").backgroundColor(Color.Brown).height("100").width(100) + } + .width(300).height(300) + .backgroundColor(Color.Pink) + .align(Alignment.Center) + .alignContent(Alignment.TopEnd) + } +} +``` + +API version 9 and earlier: Child components are arranged based on the universal attribute **align**. + +![stack](figures/api9.png) + + +API version 10 and later: Child components are arranged based on the **alignContent** attribute, which is set at a later time than **align**. + +![stack](figures/api10_and_later.png) + +**Change Impact** + +When both **alignContent** and **align** attributes are set, the last set attribute prevails. diff --git a/en/release-notes/changelogs/OpenHarmony_4.0.8.5/figures/api10_and_later.png b/en/release-notes/changelogs/OpenHarmony_4.0.8.5/figures/api10_and_later.png new file mode 100644 index 0000000000000000000000000000000000000000..a5c7e90386f90da43daebe82165ef728dbf0d1d0 Binary files /dev/null and b/en/release-notes/changelogs/OpenHarmony_4.0.8.5/figures/api10_and_later.png differ diff --git a/en/release-notes/changelogs/OpenHarmony_4.0.8.5/figures/api9.png b/en/release-notes/changelogs/OpenHarmony_4.0.8.5/figures/api9.png new file mode 100644 index 0000000000000000000000000000000000000000..ab945f0162be71defb1d3f6de5ae59fcb15a846e Binary files /dev/null and b/en/release-notes/changelogs/OpenHarmony_4.0.8.5/figures/api9.png differ