1e41f4b71Sopenharmony_ci# ArkUI Subsystem Changelog
2e41f4b71Sopenharmony_ci
3e41f4b71Sopenharmony_ci## cl.arkui.1 Restrictions on Data Type Declarations of State Variables
4e41f4b71Sopenharmony_ci
5e41f4b71Sopenharmony_ciThe 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_cistruct 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_ci**Change Impacts**
24e41f4b71Sopenharmony_ci
25e41f4b71Sopenharmony_ciIf 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.
26e41f4b71Sopenharmony_ci
27e41f4b71Sopenharmony_ci```ts
28e41f4b71Sopenharmony_ci// ArkTS:ERROR Please define an explicit type, not any.
29e41f4b71Sopenharmony_ci@State isLunar: any = false
30e41f4b71Sopenharmony_ci```
31e41f4b71Sopenharmony_ci
32e41f4b71Sopenharmony_ci**Key API/Component Changes**
33e41f4b71Sopenharmony_ci
34e41f4b71Sopenharmony_ciN/A
35e41f4b71Sopenharmony_ci
36e41f4b71Sopenharmony_ci**Adaptation Guide**
37e41f4b71Sopenharmony_ci
38e41f4b71Sopenharmony_ciExplicitly declare the data type for state variables decorated by state decorators.
39e41f4b71Sopenharmony_ci
40e41f4b71Sopenharmony_ci## cl.arkui.2 Initialization Rules and Restrictions of Custom Components' Member Variables
41e41f4b71Sopenharmony_ci
42e41f4b71Sopenharmony_ci**@LocalStorageLink** and **@LocalStorageProp** variables cannot be initialized from the parent component.
43e41f4b71Sopenharmony_ci
44e41f4b71Sopenharmony_ci**Example**
45e41f4b71Sopenharmony_ci
46e41f4b71Sopenharmony_ci```ts
47e41f4b71Sopenharmony_cilet NextID: number = 0;
48e41f4b71Sopenharmony_ci
49e41f4b71Sopenharmony_ci@Observed
50e41f4b71Sopenharmony_ciclass ClassA {
51e41f4b71Sopenharmony_ci  public id: number;
52e41f4b71Sopenharmony_ci  public c: number;
53e41f4b71Sopenharmony_ci
54e41f4b71Sopenharmony_ci  constructor(c: number) {
55e41f4b71Sopenharmony_ci    this.id = NextID++;
56e41f4b71Sopenharmony_ci    this.c = c;
57e41f4b71Sopenharmony_ci  }
58e41f4b71Sopenharmony_ci}
59e41f4b71Sopenharmony_ci
60e41f4b71Sopenharmony_ci@Entry
61e41f4b71Sopenharmony_ci@Component
62e41f4b71Sopenharmony_cistruct LocalStorageComponent {
63e41f4b71Sopenharmony_ci  build() {
64e41f4b71Sopenharmony_ci    Column() {
65e41f4b71Sopenharmony_ci      Child({
66e41f4b71Sopenharmony_ci        /* ArkTS:ERROR Property 'simpleVarName' in the custom component 'Child' cannot
67e41f4b71Sopenharmony_ci          initialize here (forbidden to specify). */
68e41f4b71Sopenharmony_ci        simpleVarName: 1,
69e41f4b71Sopenharmony_ci        /* ArkTS:ERROR Property 'objectName' in the custom component 'Child' cannot
70e41f4b71Sopenharmony_ci          initialize here (forbidden to specify). */
71e41f4b71Sopenharmony_ci        objectName: new ClassA(1)
72e41f4b71Sopenharmony_ci      })
73e41f4b71Sopenharmony_ci    }
74e41f4b71Sopenharmony_ci  }
75e41f4b71Sopenharmony_ci}
76e41f4b71Sopenharmony_ci
77e41f4b71Sopenharmony_ci@Component
78e41f4b71Sopenharmony_cistruct Child {
79e41f4b71Sopenharmony_ci  @LocalStorageLink("storageSimpleProp") simpleVarName: number = 0;
80e41f4b71Sopenharmony_ci  @LocalStorageProp("storageObjectProp") objectName: ClassA = new ClassA(1);
81e41f4b71Sopenharmony_ci
82e41f4b71Sopenharmony_ci  build() {
83e41f4b71Sopenharmony_ci  }
84e41f4b71Sopenharmony_ci}
85e41f4b71Sopenharmony_ci```
86e41f4b71Sopenharmony_ci
87e41f4b71Sopenharmony_ci**Change Impacts**
88e41f4b71Sopenharmony_ci
89e41f4b71Sopenharmony_ciIf **@LocalStorageLink** and **@LocalStorageProp** variables are initialized from the parent component, a WARN-level (previously ERROR-level) build error will occur.
90e41f4b71Sopenharmony_ci
91e41f4b71Sopenharmony_ci**Key API/Component Changes**
92e41f4b71Sopenharmony_ci
93e41f4b71Sopenharmony_ciN/A
94e41f4b71Sopenharmony_ci
95e41f4b71Sopenharmony_ci**Adaptation Guide**
96e41f4b71Sopenharmony_ci
97e41f4b71Sopenharmony_ciWhen building a child component, do not assign values to the variables by **@LocalStorageLink** and **@LocalStorageProp** in the child component.
98e41f4b71Sopenharmony_ci
99e41f4b71Sopenharmony_ciTo change these variables from the parent component, use the API provided by the **LocalStorage** (such as the **set** API) to assign values to them.
100e41f4b71Sopenharmony_ci
101e41f4b71Sopenharmony_ci## cl.arkui.3 Change of the bottom Definition in Toast Options in the PromptAction Module
102e41f4b71Sopenharmony_ci
103e41f4b71Sopenharmony_ciChanged the definition of the **bottom** attribute in toast options from distance between the top of the toast and the bottom of the screen to distance between the bottom of the toast and the bottom of the screen.
104e41f4b71Sopenharmony_ci
105e41f4b71Sopenharmony_ci**Example**
106e41f4b71Sopenharmony_ci
107e41f4b71Sopenharmony_ci```ts
108e41f4b71Sopenharmony_ciimport promptAction from '@ohos.promptAction';
109e41f4b71Sopenharmony_ci@Entry
110e41f4b71Sopenharmony_ci@Component
111e41f4b71Sopenharmony_cistruct Index {
112e41f4b71Sopenharmony_ci  build() {
113e41f4b71Sopenharmony_ci    Row() {
114e41f4b71Sopenharmony_ci      Button()
115e41f4b71Sopenharmony_ci      .onClick(() => {
116e41f4b71Sopenharmony_ci        try {
117e41f4b71Sopenharmony_ci          promptAction.showToast({
118e41f4b71Sopenharmony_ci            message: 'Message Info',
119e41f4b71Sopenharmony_ci            duration: 2000
120e41f4b71Sopenharmony_ci          });
121e41f4b71Sopenharmony_ci        } catch (error) {
122e41f4b71Sopenharmony_ci          console.error(`showToast args error code is ${error.code}, message is ${error.message}`);
123e41f4b71Sopenharmony_ci        };
124e41f4b71Sopenharmony_ci      })
125e41f4b71Sopenharmony_ci    }
126e41f4b71Sopenharmony_ci  }
127e41f4b71Sopenharmony_ci}
128e41f4b71Sopenharmony_ci```
129e41f4b71Sopenharmony_ci
130e41f4b71Sopenharmony_ci**Change Impacts**
131e41f4b71Sopenharmony_ci
132e41f4b71Sopenharmony_ciIn the **PromptAction** module, the same value for the **bottom** attribute may result in different toast appearances, depending on whether the API version used by the compiler is earlier than 10 or not.
133e41f4b71Sopenharmony_ci
134e41f4b71Sopenharmony_ci**Key API/Component Changes**
135e41f4b71Sopenharmony_ci
136e41f4b71Sopenharmony_ciN/A
137e41f4b71Sopenharmony_ci
138e41f4b71Sopenharmony_ci**Adaptation Guide**
139e41f4b71Sopenharmony_ci
140e41f4b71Sopenharmony_ciWhen setting the **bottom** attribute, account for the definition change.
141e41f4b71Sopenharmony_ci
142e41f4b71Sopenharmony_ci## cl.arkui.4 Content Layout Change of AlertDialog
143e41f4b71Sopenharmony_ci
144e41f4b71Sopenharmony_ciThe content layout of the alert dialog box varies according to the following conditions: 1. whether there is a title. 2. whether the text is on a single line.
145e41f4b71Sopenharmony_ci
146e41f4b71Sopenharmony_ciCurrently, only the single-line text without a title is centered. In other cases, the text is left-aligned.
147e41f4b71Sopenharmony_ci
148e41f4b71Sopenharmony_ci**Example**
149e41f4b71Sopenharmony_ci
150e41f4b71Sopenharmony_ci```ts
151e41f4b71Sopenharmony_ci// xxx.ets
152e41f4b71Sopenharmony_ci@Entry
153e41f4b71Sopenharmony_ci@Component
154e41f4b71Sopenharmony_cistruct AlertDialogExample {
155e41f4b71Sopenharmony_ci  build() {
156e41f4b71Sopenharmony_ci    Column({ space: 5 }) {
157e41f4b71Sopenharmony_ci      Button('one button dialog')
158e41f4b71Sopenharmony_ci        .onClick(() => {
159e41f4b71Sopenharmony_ci          AlertDialog.show(
160e41f4b71Sopenharmony_ci            {
161e41f4b71Sopenharmony_ci              title: 'title',
162e41f4b71Sopenharmony_ci              message: 'text'.repeat(20),
163e41f4b71Sopenharmony_ci              autoCancel: true,
164e41f4b71Sopenharmony_ci              alignment: DialogAlignment.Bottom,
165e41f4b71Sopenharmony_ci              offset: { dx: 0, dy: -20 },
166e41f4b71Sopenharmony_ci              gridCount: 3,
167e41f4b71Sopenharmony_ci              confirm: {
168e41f4b71Sopenharmony_ci                value: 'button',
169e41f4b71Sopenharmony_ci                action: () => {
170e41f4b71Sopenharmony_ci                  console.info('Button-clicking callback')
171e41f4b71Sopenharmony_ci                }
172e41f4b71Sopenharmony_ci              },
173e41f4b71Sopenharmony_ci              cancel: () => {
174e41f4b71Sopenharmony_ci                console.info('Closed callbacks')
175e41f4b71Sopenharmony_ci              }
176e41f4b71Sopenharmony_ci            }
177e41f4b71Sopenharmony_ci          )
178e41f4b71Sopenharmony_ci        })
179e41f4b71Sopenharmony_ci        .backgroundColor(0x317aff)
180e41f4b71Sopenharmony_ci    }.width('100%').margin({ top: 5 })
181e41f4b71Sopenharmony_ci  }
182e41f4b71Sopenharmony_ci}
183e41f4b71Sopenharmony_ci```
184e41f4b71Sopenharmony_ci
185e41f4b71Sopenharmony_ci**Change Impacts**
186e41f4b71Sopenharmony_ci
187e41f4b71Sopenharmony_ciThe layout for the text specified by the **message** attribute of the alert dialog box is subject to the title and number of lines of the text.
188e41f4b71Sopenharmony_ci
189e41f4b71Sopenharmony_ci**Key API/Component Changes**
190e41f4b71Sopenharmony_ci
191e41f4b71Sopenharmony_ciN/A
192e41f4b71Sopenharmony_ci
193e41f4b71Sopenharmony_ci**Adaptation Guide**
194e41f4b71Sopenharmony_ci
195e41f4b71Sopenharmony_ciNo proactive adaptation is required. You can also use **customDialog** for related implementation.
196e41f4b71Sopenharmony_ci
197e41f4b71Sopenharmony_ci## cl.arkui.5 Avoidance Behavior Optimization of Popup
198e41f4b71Sopenharmony_ci
199e41f4b71Sopenharmony_ciBefore the change, the popup preferentially uses the lower area for avoidance. As a result, it cannot be displayed in the upper area even if the space is sufficient.
200e41f4b71Sopenharmony_ci
201e41f4b71Sopenharmony_ciAfter the change: The popup preferentially uses the upper area for avoidance when it is configured to show above the target component; it preferentially uses the upper or lower area for avoidance when it is configured to show below the target component.
202e41f4b71Sopenharmony_ci
203e41f4b71Sopenharmony_ci**Change Impacts**
204e41f4b71Sopenharmony_ci
205e41f4b71Sopenharmony_ciThe optimized popup avoidance behavior occurs when the **bindpopup** attribute is used.
206e41f4b71Sopenharmony_ci
207e41f4b71Sopenharmony_ci**Key API/Component Changes**
208e41f4b71Sopenharmony_ci
209e41f4b71Sopenharmony_ciN/A
210e41f4b71Sopenharmony_ci
211e41f4b71Sopenharmony_ci**Adaptation Guide**
212e41f4b71Sopenharmony_ci
213e41f4b71Sopenharmony_ciIf the popup position is not as expected, you can adjust the **placement** settings.
214