• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# ArkUI Subsystem Changelog
2
3## cl.arkui.1 Default Style Change of the TextInput Component
4
5**Access Level**
6
7Public API
8
9**Reason for Change**
10
11The default style is changed.
12
13**Change Impact**
14
15This change is a non-compatible change.
16
17Before change: The **borderRadius** setting has no effect on the text box in underline mode, with a default radius of 0. The left and right padding for the text box in underline mode is 12 vp. The default height of the text box in non-underline mode is 48 vp.
18
19![Default style before change](figures/underlineBeforeAPI12.png)
20
21After change: The **borderRadius** setting is effective for the text box in underline mode, with a default radius of 0. The left and right padding for the text box in underline mode is 0 vp. The default height of the text box in non-underline mode is 40 vp.
22
23![Default style after change](figures/underlineAPI12.png)
24
25Example:
26
27```ts
28@Entry
29@Component
30struct TextInputExample {
31  @State Text: string = ''
32  build() {
33    Column({ space: 20 }) {
34      Text('Underline mode')
35        .width('95%')
36      // Show an underline.
37      TextInput({ placeholder: 'underline style' })
38        .showUnderline(true)
39        .backgroundColor(Color.Pink)
40        .width(360)
41        .borderRadius(10)
42      Text('Non-underline mode')
43        .width('95%')
44      TextInput({ placeholder: 'Enter user name', text: this.Text })
45        .showUnderline(false)
46        .width(360)
47        .borderRadius(10)
48
49    }.width('100%')
50  }
51}
52```
53
54**Start API Level**
55
5610
57
58**Change Since**
59
60OpenHarmony SDK 5.0.0.22
61
62**Key API/Component Changes**
63
64The default style of the **TextInput** component is changed.
65
66**Adaptation Guide**
67
68No adaptation is required. Yet, since the default display effect is changed, you need to check whether it meets your expectation. Change the display variables where necessary.
69
70## cl.arkui.2 Changes to Toast Styles
71
72**Access Level**
73
74Public API
75
76**Reason for Change**
77
78The toast UX display style is updated since API version 12.
79
80**Change Impact**
81
82This change is a non-compatible change.
83
84- In API version 11 and earlier versions, the background color of the toast is dark black, the font color is white, the maximum height is not limited, and the text is not truncated.<br>
85
86- Since API version 12, the toast has a transparent and blurry background and black font color in the normal bright color display style, and a transparent and blurry background and white font color in the dark color display style. The maximum height of the toast is calculated as follows: (Screen height - Signal bar - Navigation bar) x 0.65. The maximum width is adaptive based on the screen width minus the margin on the side, with a maximum value of 400 vp. If the UI text is too long, the font size is reduced to 12 fp, and the extra text is truncated.<br>
87
88- Attribute changes
89
90| Name| Before Change| After Change|
91|---------|---------|---------|
92| Background color| bg_color | COMPONENT_ULTRA_THICK |
93| Rounded corners| toast_border_radius | corner_radius_level9 |
94| padding-left | toast_padding_horizontal | padding_level8 |
95| padding-top | toast_padding_vertical | padding_level4 |
96| padding-right | toast_padding_horizontal | padding_level8 |
97| padding-bottom | toast_padding_vertical | padding_level4 |
98| Font size| text_font_size | Body_M |
99| Font color| text_color | font_primary |
100| Font weight| toast_text_font_weight | font_weight_regular |
101
102**Example**
103The following figures show the comparison before and after the change.
104
105| Before Change| After Change|
106|---------|---------|
107| ![](figures/toast_api11.png)  |  ![](figures/toast_api12.png)  |
108
109**API Level**
110
11112
112
113**Change Since**
114
115OpenHarmony SDK 5.0.0.22
116
117**Key API/Component Changes**
118
119Toast
120
121**Adaptation Guide**
122
123No adaptation is required.
124
125## cl.arkui.3 Default Value Change of the clip Attribute of the Text Component
126
127**Access Level**
128
129Public API
130
131**Reason for Change**
132
133The default value is set to **false** to accommodate more use cases.
134
135**Change Impact**
136
137This change is a non-compatible change.
138
139Before change: In API version 11 and earlier versions, the default value of the **clip** universal attribute for the **Text** component is **true**, truncating and hiding content that exceeds the component area.
140
141![Text component before the default value change](figures/textcliptrue.png)
142
143After change: Since API version 12, the default value of the **clip** universal attribute for the **Text** component is **false**, allowing content that exceeds the component area to be displayed without truncation.
144
145![Text component after the default value change](figures/textclipfalse.png)
146
147Example:
148
149```ts
150@Entry
151@Component
152struct TextClipExample {
153  build() {
154    Column({ space: 20 }) {
155      Text('This is set wordBreak to WordBreak text Taumatawhakatangihangakoauauotamateaturipukakapikimaungahoronukupokaiwhenuakitanatahu.')
156        .fontSize(12)
157        .border({ width: 1 })
158        .wordBreak(WordBreak.NORMAL)
159        .lineHeight(20)
160        .maxLines(2)
161    }.height(300).width(335).padding({ left: 35, right: 35, top: 35 })
162  }
163}
164```
165
166**Start API Level**
167
1687
169
170**Change Since**
171
172OpenHarmony SDK 5.0.0.22
173
174**Key API/Component Changes**
175
176Default value of the **clip** universal attribute of the **Text** component
177
178**Adaptation Guide**
179
180No adaptation is required. Yet, since the default display effect is changed, you need to check whether it meets your expectation. Change the display variables where necessary.
181
182## cl.arkui.4 Change in the Processing of Abnormal Values of the caretPosition API of the TextInput, TextArea, and Search Components
183
184**Access Level**
185
186Public API
187
188**Reason for Change**
189
190This change is made for optimization of the logic for processing abnormal values when setting the cursor position for **Search**, **TextInput**, and **TextArea** components.
191
192**Change Impact**
193
194This change is a non-compatible change.
195
196Before change: In API version 11 and earlier versions, if the input parameter for **TextInput.caretPosition()** is a negative number or undefined, the API has no effect.
197If the input parameters for **TextInputController.caretPosition()**, **TextAreaController.caretPosition()**, and **SearchController.caretPosition()** are negative numbers, the API takes effect by moving the cursor to position 0 and recording the cursor position as a negative number.
198
199After change: Since API version 12, if the input parameter for **TextInput.caretPosition()** is a negative number or undefined, it is processed as **0**, and the API takes effect.
200If the input parameters for **TextInputController.caretPosition()**, **TextAreaController.caretPosition()**, and **SearchController.caretPosition()** are negative numbers, they are processed as 0, and the API takes effect by moving the cursor to position 0 and recording the cursor position as 0.
201
202**Start API Level**
203
2048
205
206**Change Since**
207
208OpenHarmony SDK 5.0.0.22
209
210**Adaptation Guide**
211
212The visual effect of the cursor position remains unchanged.
213If the parameter value for setting the cursor position is a negative number or undefined and the cursor position does not need to be changed, you must modify the service code to enter a valid value.
214
215## cl.arkui.5 UX Behavior Change of the ListItem Component
216
217**Access Level**
218
219Public API
220
221**Reason for Change**
222
223The UX behavior of the **ListItem** component is updated since API version 12.
224
225**Change Impact**
226
227This change is a non-compatible change.
228
229- Before change: In API version 11 and earlier versions, after the **ListItem** component is swiped to expand and display the swipe action menu, clicking a non-menu area of the **List** component will not automatically collapse the swipe action menu, and the component at the clicked location can respond to the click event.<br>
230
231- After change: Since API version 12, after the **ListItem** component is swiped to expand and display the swipe action menu, clicking a non-menu area of the **List** component will automatically collapse the swipe action menu, and the component at the clicked location will not respond to the click event.<br>
232
233**Example**
234The following figures show the comparison before and after the change.
235
236| Before Change| After Change|
237|---------|---------|
238| ![](figures/swipeActionBeforeAPI12.gif)  |  ![](figures/swipeActionAPI12.gif)  |
239
240**API Level**
241
24212
243
244**Change Since**
245
246OpenHarmony SDK 5.0.0.22
247
248**Key API/Component Changes**
249
250**ListItem** component
251
252**Adaptation Guide**
253
254No adaptation is required.
255
256## cl.arkui.6 Processing Rule Change of Visibility.None in Relative Layout
257
258**Access Level**
259
260Public API
261
262**Reason for Change**
263
264This change is made for enhancement of UX specifications.
265
266**Change Impact**
267
268This change is a non-compatible change.
269
270Before change: If the **Visibility** attribute of any anchor point of component A is **None**, component A is not measured.
271
272After change: If the **Visibility** attribute of any anchor point of component A is **None**, component A is still measured. The position of the anchor component remains unchanged, and the width and height of the anchor component are considered as 0.
273
274**API Level**
275
276The feature is supported since API version 7, and the change takes effective since API version 12.
277
278**Change Since**
279
280OpenHarmony SDK 5.0.0.23
281
282**Adaptation Guide**
283
284If you want component A not to be measured after the **Visibility** attribute of the anchor component is set to **None**, set the **Visibility** attribute of component A to **Hidden** or **None**.
285
286## cl.arkui.7 C-API Change in Obtaining the API Set of Native Modules
287
288**Access Level**
289
290Public API
291
292**Reason for Change**
293
294This change is made to enhance compatibility.
295
296**Change Impact**
297
298This change is a non-compatible change.
299
300Before change: The native module API set can be obtained through **OH_ArkUI_GetNativeAPI**.
301
302After change: The native module API set can be obtained through **OH_ArkUI_GetModuleInterface** or **OH_ArkUI_QueryModuleInterfaceByName**.
303
304**Start API level**
305
306Both the feature and change are effective since API level 12.
307
308**Change Since**
309
310OpenHarmony SDK 5.0.0.22
311
312**Adaptation Guide**
313
314You can call the new APIs to obtain the native module API set as follows:
315
316Method 1:
317
318```
319auto nodeAPI = reinterpret_cast<ArkUI_NativeNodeAPI_1*>(
320  OH_ArkUI_QueryModuleInterfaceByName(ARKUI_NATIVE_NODE, "ArkUI_NativeNodeAPI_1"));
321```
322
323Method 2:
324
325```
326ArkUI_NativeNodeAPI_1* nodeAPI = nullptr;
327OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI);
328```
329
330## cl.arkui.8 C-API Change in the Event Registration API
331
332**Access Level**
333
334Public API
335
336**Reason for Change**
337
338This change is made to enhance compatibility.
339
340**Change Impact**
341
342This change is a non-compatible change.
343
344Before change:
345
346* Events can be bound to a component by calling **nodeAPI->registerNodeEvent(nodePtr, eventType, eventId)** with three parameters: the component node pointer, event type, and event ID.
347
348* After an event response, you can access the event callback data, which is a pointer to ArkUI_NodeEvent, and directly access the structure and data within the pointer.
349
350Example:
351
352```
353nodeAPI->registerNodeEvent(button, NODE_ON_CLICK, 1); // 1 indicates the ID of the event to register.
354auto onclick = [](ArkUI_NodeEvent *event) {
355  if (event->eventId == 1) {
356    auto offsetX = event->componentEvent.data[0].f32; // Obtain the X coordinate of the clicked position relative to the upper left corner of the clicked component.
357  }
358};
359nodeAPI->registerNodeEventReceiver (onclick); // Listen for event callbacks, and execute the custom onclick method when the Button component's click event is triggered.
360```
361
362After change:
363
364* The event registration API includes an additional pointer to a custom parameter, as in **nodeAPI->registerNodeEvent(nodePtr, eventType, eventId, userData)**.
365
366* After an event response, you can still access the event callback data, which is a pointer to **ArkUI_NodeEvent**, but the specific structure of the pointer is no longer exposed. You must use specific functions to obtain the required parameters.
367
368Example:
369
370```
371nodeAPI->registerNodeEvent(button, NODE_ON_CLICK, 1, nullptr); // If no custom data needs to be passed in, nullptr can be passed in instead.
372auto onclick = [](ArkUI_NodeEvent *event) {
373  if (OH_ArkUI_NodeEvent_GetTargetId(event) == 1) { // Obtain the event ID.
374    auto offsetX = OH_ArkUI_NodeEvent_GetNodeComponentEvent(event)->data[0].f32; // Obtain the X coordinate of the clicked position relative to the upper left corner of the clicked component.
375  }
376};
377nodeAPI->registerNodeEventReceiver(onclick);
378```
379
380**Start API level**
381
382Both the feature and change are effective since API level 12.
383
384**Change Since**
385
386OpenHarmony SDK 5.0.0.22
387
388**Adaptation Guide**
389
390* Globally search for the **registerNodeEvent** function and change all usage of this function to include four parameters, with the fourth parameter being a nullptr as a placeholder.
391
392* Globally search for the **ArkUI_NodeEvent** type and change **event->eventId** in the callback to **OH_ArkUI_NodeEvent_GetTargetId(event)**.
393
394* Globally search for the **ArkUI_NodeEvent** type and change **event->kind** in the callback to **OH_ArkUI_NodeEvent_GetEventType(event)**.
395
396* Globally search for the **ArkUI_NodeEvent** type and change **event->componentEvent.data** in the callback to **OH_ArkUI_NodeEvent_GetNodeComponentEvent(event)->data**.
397
398* Globally search for the **ArkUI_NodeEvent** type and change **event->stringEvent.pStr** in the callback to **OH_ArkUI_NodeEvent_GetStringAsyncEvent(event)->pStr**.
399
400* Globally search for the **ArkUI_NodeEvent** type and change **event->touchEvent** in the callback to first obtain a pointer to the **ArkUI_UIInputEvent** type using the **OH_ArkUI_NodeEvent_GetInputEvent(event)** method, then access detailed API data through various functions provided for obtaining **ArkUI_UIInputEvent** data.
401
402## cl.arkui.9 Specification Change for Handling Abnormal Parameters of visibility
403
404**Access Level**
405
406Public API
407
408**Reason for Change**
409
410This change is made to improve robustness.
411
412**Change Impact**
413
414Before change: Abnormal values are processed as **hidden**.
415
416After change: Abnormal values are processed as **visible**.
417
418**Start API Level**
419
420The feature is supported since API version 7, and the change takes effective since API version 12.
421
422**Change Since**
423
424OpenHarmony SDK 5.0.0.22
425
426**Adaptation Guide**
427
428No adaptation is required. Yet, since the default exception handling logic is changed, you need to check whether it meets your expectation. Change the variables where necessary.
429
430## cl.arkui.10 Behavior Change of the transform API
431
432**Access Level**
433
434Public API
435
436**Reason for Change**
437
438This change is made for improvement of API functionality.
439
440**Change Impact**
441
442Before change: Perspective projection transformations in the input matrix are not processed, that is, perspective projection transformations are not supported.
443
444After change: Perspective projection transformations in the input matrix are processed, that is, perspective projection transformations are supported.
445
446**Example**
447Refer to the code snippet below.
448```
449import matrix4 from '@ohos.matrix4'
450const matrixArr: [number, number, number, number,
451  number, number, number, number,
452  number, number, number, number,
453  number, number, number, number] = [
454  0.25, 0, 0, -0.0015,
455  0, 1, 0, 0,
456  0, 0, 1, 0,
457  0, 0, 0, 1];
458
459let matrix = matrix4.init(matrixArr);
460
461@Entry
462@Component
463struct Tests {
464  build() {
465    Column() {
466      Rect()
467        .fill(Color.Gray)
468        .scale({
469          x: 1,
470          centerX: 0,
471          centerY: 0,
472        })
473        .width('500px')
474        .height('500px')
475        .transform(matrix)
476    }.width('100%').height('100%').alignItems(HorizontalAlign.Center)
477  }
478}
479```
480The following figures show the comparison before and after the change.
481
482| Before Change| After Change|
483|---------|---------|
484| ![](figures/transform_before.png)  |  ![](figures/transform_after.png)  |
485
486**Start API Level**
487
488This feature is available since API version 7.
489
490**Change Since**
491
492OpenHarmony SDK 5.0.0.22
493
494**Adaptation Guide**
495
496If the input matrix involves perspective projection transformations, that is, the first three parameters of the last column of the matrix are not 0, there will be inconsistencies before and after the change.
497
498To maintain the original transformation effect, you need to modify the input matrix. Specifically, set the first three parameters of the last column in **Matrix4Transit** to 0.
499```
500const matrixArr: [number, number, number, number,
501  number, number, number, number,
502  number, number, number, number,
503  number, number, number, number] = [
504  0.25, 0, 0, -0.0015,
505  0, 1, 0, 0,
506  0, 0, 1, 0,
507  0, 0, 0, 1];
508
509for (let i = 3;i < 12;i += 4) {
510    matrixArr[i] = 0;
511}
512
513let matrix = matrix4.init(matrixArr);
514```
515