VisualTree

Use the React Native native bridge VisualTree tools to inspect native hierarchy, capture screenshots, and manage diagnostic overlays.

Install

npm install @ansight/react-native
npx pod-install

Register the Suite

React Native VisualTree tools are opt-in. Register them from app code when Studio needs native hierarchy, native screenshots, or diagnostic overlays.

await Ansight.initializeAndActivate(
  Ansight.createOptionsBuilder()
    .withReadOnlyToolAccess()
    .withVisualTreeTools()
    .build(),
);

Registration API

  • withVisualTreeTools(): registers the native VisualTree suite on iOS and Android.
  • withoutVisualTreeTools(): explicitly disables native VisualTree registration when options are composed.
  • remoteTools.visualTree: accepts true, false, or { enabled: boolean }.
  • withReadOnlyToolAccess(): exposes visual tree, screenshot, node inspection, and read-only overlay tools.
  • withReadWriteToolAccess(): also exposes overlay creation and update.
  • withAllToolAccess(): also exposes delete-scoped Android overlay removal tools and native delete tools.

Specific Concerns

  • This is the native hierarchy, not the React component tree. Use React Inspection for Fiber component and React Native host trees.
  • Screenshot capture exports rendered UI content.
  • Overlay removal scope differs by native platform: iOS exposes ui.remove_overlay and ui.clear_overlays as Write; Android exposes them as Delete.

Important: Calling screenshot tools will result in an FPS drop while native frames are captured, encoded, and transferred. Avoid screenshot-heavy investigations during performance measurements unless visual evidence is required.

Tool Matrix

NameIdScopeDescriptionSecurity
Get Visual Treeui.get_visual_treeReadReturns the current native UI hierarchy.High
Get Screenshotui.get_screenshotReadCaptures a native screenshot and streams bytes over binary transfer.High
Inspect Nodeui.inspect_nodeReadReturns one native visual-tree node.High
Show Overlayui.show_overlayWriteShows a diagnostic overlay.Critical
Get Overlayui.get_overlayReadReturns one overlay.High
Query Overlaysui.query_overlaysReadLists active overlays.High
Update Overlayui.update_overlayWriteUpdates an overlay.Critical
Remove Overlayui.remove_overlayWrite on iOS, Delete on AndroidRemoves an overlay.Critical
Clear Overlaysui.clear_overlaysWrite on iOS, Delete on AndroidClears overlays.Critical

Tool Details

Use native VisualTree tools when Studio needs the platform view hierarchy or native screenshot evidence. Use React Inspection when the workflow needs component names, props, state, or React Navigation state.