Skip to content

Commit

Permalink
fix form item's label not picking evaluated value (#854)
Browse files Browse the repository at this point in the history
  • Loading branch information
anserwaseem authored Oct 1, 2024
1 parent e1cb8b3 commit 489ed91
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 5 deletions.
6 changes: 6 additions & 0 deletions .changeset/unlucky-bugs-tie.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@ensembleui/react-kitchen-sink": patch
"@ensembleui/react-runtime": patch
---

fix form item's label not picking evaluated value
15 changes: 11 additions & 4 deletions apps/kitchen-sink/src/ensemble/screens/forms.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
Import:
- common

View:
styles:
scrollableView: true
Expand Down Expand Up @@ -205,9 +208,13 @@ View:
format: DD-MM-YY
- Date:
id: date2
label: Date 2
label: ${getDateLabel(dropdown.selectedValue)}
labelStyle:
color: ${dropdown.selectedValue === 'option2' ? 'green' :'blue'}
required: true
value: "2024/04/04"
hintText: Choose date 2
format: MM/DD/YYYY
hintText: ${ensemble.storage.get('inputVal')}
- TextInput:
id: customNumberInput
required: true
Expand Down Expand Up @@ -397,7 +404,7 @@ View:
label: Call API!
onTap:
invokeAPI:
name: ${ensemble.storage.get('mockApiName')}
name: testMockResponse
onResponse:
executeCode: console.log("Mock API called ", response);
- Button:
Expand All @@ -406,7 +413,7 @@ View:
label: Call API from executeCode!
onTap:
executeCode: |
ensemble.invokeAPI(ensemble.storage.get('mockApiName'));
ensemble.invokeAPI('testMockResponse');
- Spacer:
styles:
size: 20
Expand Down
4 changes: 4 additions & 0 deletions apps/kitchen-sink/src/ensemble/scripts/common.js
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
const productTitleName = "SgrDvr";

const getDateLabel = (val) => {
return `i am a date label ${val}`
}
2 changes: 1 addition & 1 deletion packages/runtime/src/widgets/Form/FormItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export const EnsembleFormItem: React.FC<EnsembleFormItemProps<unknown>> = (
: EnsembleRuntime.render([unwrapWidget(values.label)])}
</label>
);
}, []);
}, [values?.label, values?.labelStyle, values?.id]);

return (
<AntForm.Item
Expand Down

0 comments on commit 489ed91

Please sign in to comment.