# NativeUIModule

The `NativeUI` module exposes editable text.

## Example

```
//==============================================================================
// The following example demonstrates how to get and set the value of editable
// text through scripting and keyboard input.
//
// Project setup:
// - Insert text
// - Set the text to 'Editable' in the inspector
// - Add the 'Editable text' capability under 'Native UI Control'
// - Add the 'Tap Gesture' capability under 'Touch Gestures'
//==============================================================================

// Load in the required modules
const Diagnostics = require('Diagnostics');
const NativeUI = require('NativeUI');
const TouchGestures = require('TouchGestures');

// Set the initial text value
NativeUI.setText('text0','Default Text');

// Subscribe to tap gestures
TouchGestures.onTap().subscribe(function () {

  // Enter text editing mode
  NativeUI.enterTextEditMode('text0');

});

// Subscribe to changes in the text
NativeUI.getText('text0').monitor().subscribe(function(textUpdate){

  // Log the new text value to the console
  Diagnostics.log('You entered ' + textUpdate.newValue);

});
```

## Properties

| Property | Description                                                               |
| -------- | ------------------------------------------------------------------------- |
| `picker` | `(get) picker: Picker (set) picker: Picker` Represents the picker object. |
| `slider` | `(get) slider: Slider (set) slider: Slider` Represents the slider object. |

## Methods

| Method              | Description                                                                                                         |
| ------------------- | ------------------------------------------------------------------------------------------------------------------- |
| `enterTextEditMode` | `enterTextEditMode(nodeName: String): void` Requests user input for given node.                                     |
| `getText`           | `getText(nodeName: String): StringSignal` Gets the user edited text of the given node.                              |
| `setText`           | `setText(nodeName: String, text: String): void` Sets the text to the provided value for the node with a given name. |

## Classes

| Class                                                                                           | Description                                                                |
| ----------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------- |
| [`Picker`](https://sparkar.facebook.com/docs/ar-studio/reference/classes/nativeuimodule.picker) | The `Picker` class describes an object controlling native picker behavior. |
| [`Slider`](https://sparkar.facebook.com/docs/ar-studio/reference/classes/nativeuimodule.slider) | The `Slider` class describes an object controlling native slider behavior. |


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://sparkar-community.gitbook.io/docs/nativeuimodule.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
