Skip to content

Commit f0066fe

Browse files
authored
Used optional chaining for instance in create
1 parent f3efdcf commit f0066fe

File tree

1 file changed

+4
-3
lines changed
  • playground/forms/custom-toolbar-radio-button

1 file changed

+4
-3
lines changed

playground/forms/custom-toolbar-radio-button/index.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ const item = {
88
id: "add-radio-group",
99
title: "Add Radio Group",
1010
onPress: async () => {
11-
if (!instance) return;
12-
1311
const radioWidget1 = new window.NutrientViewer.Annotations.WidgetAnnotation(
1412
{
1513
id: window.NutrientViewer.generateInstantId(),
@@ -23,6 +21,7 @@ const item = {
2321
}),
2422
},
2523
);
24+
2625
const radioWidget2 = new window.NutrientViewer.Annotations.WidgetAnnotation(
2726
{
2827
id: window.NutrientViewer.generateInstantId(),
@@ -36,6 +35,7 @@ const item = {
3635
}),
3736
},
3837
);
38+
3939
const formField = new window.NutrientViewer.FormFields.RadioButtonFormField(
4040
{
4141
name: "MyFormField",
@@ -56,7 +56,8 @@ const item = {
5656
defaultValue: "1",
5757
},
5858
);
59-
await instance.create([radioWidget1, radioWidget2, formField]);
59+
60+
await instance?.create([radioWidget1, radioWidget2, formField]);
6061
},
6162
};
6263

0 commit comments

Comments
 (0)