@@ -25,7 +25,7 @@ import Logger from './Logger';
25
25
export const TAG = "Picker";
26
26
27
27
@Builder
28
- function buildGlobalDialogComponent() {
28
+ function buildGlobalDialogComponent(params: Params ) {
29
29
Column() {
30
30
Flex({ direction: FlexDirection.Row, justifyContent: FlexAlign.SpaceBetween, alignItems: ItemAlign.Center }) {
31
31
Text(content.pickerCancelBtnText)
@@ -54,7 +54,7 @@ function buildGlobalDialogComponent() {
54
54
.height(FIVE_PERCENT)
55
55
.width(HUNDRED_PERCENT)
56
56
57
- TextPicker({ range: content.pickerData, value: content.selectedValue })
57
+ TextPicker({ range: content.pickerData, value: params.selected })
58
58
.onChange((value: string | string[]) => {
59
59
changeSelect(value);
60
60
})
@@ -107,6 +107,14 @@ let pickerCtx: TurboModuleContext;
107
107
let uiContext: UIContext;
108
108
let showPicker: boolean = false;
109
109
110
+ class Params {
111
+ selected: string | string[] = '';
112
+
113
+ constructor(selected: string | string[]) {
114
+ this.selected = selected;
115
+ }
116
+ }
117
+
110
118
export class GlobalDialog {
111
119
static contentNode: ComponentContent<GlobalDialogParam>;
112
120
protected ctx: TurboModuleContext;
@@ -122,7 +130,8 @@ export class GlobalDialog {
122
130
123
131
static show() {
124
132
try {
125
- GlobalDialog.contentNode = new ComponentContent(uiContext, wrapBuilder(buildGlobalDialogComponent));
133
+ GlobalDialog.contentNode =
134
+ new ComponentContent(uiContext, wrapBuilder(buildGlobalDialogComponent), new Params(content.selectedValue));
126
135
const promptAction = uiContext.getPromptAction();
127
136
promptAction.openCustomDialog(GlobalDialog.contentNode, {
128
137
alignment: DialogAlignment.Bottom,
@@ -159,6 +168,11 @@ export class GlobalDialog {
159
168
return content;
160
169
}
161
170
171
+ update(array: Array<string>) {
172
+ content.selectedValue = array;
173
+ GlobalDialog.contentNode.update(new Params(content.selectedValue));
174
+ }
175
+
162
176
processData(data: object[]): ResultItem[] {
163
177
try {
164
178
const result = data.map((item: object) => {
0 commit comments