Multi-Line Activity
The multi-line activity is designed to capture a block of text or a detailed message.
This can be used for providing feedback, writing descriptions, or any scenario where more than a single line of text is needed.
Inputs
The MultiLineActivity
expects the following input properties:
- Title (
string
): The main heading that indicates what input is required (e.g., "Provide Feedback"). - Description (
string
): Additional context or instructions for the user regarding what information is being requested. - Placeholder (
string
): A placeholder text that gives a hint about the expected content. - ButtonCancelText (
string
): Text displayed on the cancel button (e.g., "Cancel"). - ButtonOKText (
string
): Text displayed on the confirmation button (e.g., "Submit").
Example Code
multiLineActivity: async (data: MultiLineActivityOptions) => {
console.log('MultiLineActivity from agent:', data);
await delay(300);
return new Promise<{ action: WorkflowActivityUserAction; result: string }>((resolve) => {
RootNavigation.navigate('WorkflowActivity', {
type: 'multiLine',
data,
onReject: () => {
console.log('MultiLineActivity result:', 'Rejected');
resolve({
action: WorkflowActivityUserAction.Cancel,
result: '',
});
},
onConfirm: (result: string) => {
console.log('MultiLineActivity result:', result);
resolve({
action: WorkflowActivityUserAction.OK,
result,
});
},
});
});
}
Handling and Layout
When the user navigates to the WorkflowActivityScreen
for a Multi-Line Activity, the layout includes:
- Title: Displayed at the top to indicate the context of the multi-line input (e.g., "Feedback").
- Description: Provides additional instructions or context to guide the user.
- Multi-Line Text Input: An input box where the user can enter their text over multiple lines.
- A placeholder text is shown to give an example of the expected input.
- The input is formatted for multi-line entry, making it easier for users to write more text.
- Action Buttons:
- Cancel Button: Allows the user to cancel their entry, returning a
Cancel
action. - Confirm Button: Submits the user’s multi-line entry, returning an
OK
action with the entered text.
- Cancel Button: Allows the user to cancel their entry, returning a
Output
The output for a Multi-Line Activity depends on the user's interaction:
- If the user confirms, the resolved result will look like this:
{
action: WorkflowActivityUserAction.OK,
result: "This is an example of multi-line text input.", // Example text input by the user
}
- If the user cancels, the resolved result will look like this:
{
action: WorkflowActivityUserAction.Cancel,
result: "",
}