refactor(Parser): Update view models to use RendererContext.ts

May or may not be a breaking change for some.
This commit is contained in:
Luan
2024-12-31 06:41:17 -03:00
parent 3c28c0d2c2
commit f76a8e5d75
6 changed files with 36 additions and 32 deletions

View File

@@ -12,17 +12,20 @@ export type AccessibilityContext = {
export default class RendererContext {
public command_context: CommandContext;
public accessibility_context: AccessibilityContext;
constructor(data: RawNode) {
constructor(data?: RawNode) {
this.command_context = {};
this.accessibility_context = {};
if (!data)
return;
if (Reflect.has(data, 'commandContext')) {
if (Reflect.has(data.commandContext, 'onTap')) {
this.command_context.on_tap = new NavigationEndpoint(data.commandContext.onTap);
}
}
if (Reflect.has(data, 'accessibilityContext')) {
if (Reflect.has(data.accessibilityContext, 'label')) {
this.accessibility_context.label = data.accessibilityContext.label;