---
name: "onGyroscopeChange"
mode: "kit"
versionRequirements:
  - { name: "BaseKit", version: "2.3.2" }
platform:
  - "iOS"
  - "Android"
async: true
---

## onGyroscopeChange

> [VERSION] BaseKit >= 2.3.2

> [PLATFORM] iOS, Android

> ⚡ **Supports Promise** — Returns a Promise when success / fail / complete callbacks are omitted.

### Description

Listen for gyroscope data change events (data provided by the system; precision may differ across platforms)

### Parameters

`(listener: Function)`

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `listener` | `(params: Object) => void` | Yes | - | Event listener callback function |

##### onGyroscopeChange.listener(params) properties

| Property | Type | Required | Default | Since | Description |
| --- | --- | --- | --- | --- | --- |
| `x` | `number` | Yes | - | `2.3.2` | X axis |
| `y` | `number` | Yes | - | `2.3.2` | Y axis |
| `z` | `number` | Yes | - | `2.3.2` | Z axis |


### Examples

```tsx
// Listen for gyroscope data changes: register onGyroscopeChange first, then startGyroscope to enable the sensor; x/y/z values will be returned via callbacks
ty.onGyroscopeChange(e => {
  console.log("Gyroscope x/y/z:", e.x, e.y, e.z);
});
ty.startGyroscope({
  interval: "normal",
  success: () => console.log("Started listening to gyroscope"),
  fail: error => console.error(error),
});
```
