> For AI agents: the complete documentation index is available at /next/llms.txt, the full documentation bundle is available at /next/llms-full.txt.

# updateViewport

APISummary
The client updates the `LynxView` view size.

## Syntax

### Android

```java
public void updateViewport(int widthMeasureSpec, int heightMeasureSpec);
```

#### Parameters

- `widthMeasureSpec`: Current `LynxView` width.
- `heightMeasureSpec`: Current `LynxView` height.

### iOS

```objc
- (void)updateViewportWithPreferredLayoutWidth:(CGFloat)preferredLayoutWidth
                         preferredLayoutHeight:(CGFloat)preferredLayoutHeight
                                    needLayout:(BOOL)needLayout;
```

#### Parameters

- `preferredLayoutWidth`: Current `LynxView` width.
- `preferredLayoutHeight`: Current `LynxView` height.
- `needLayout`: Whether layout needs to be triggered.

### Desktop (C++)

Desktop public API uses `SetFrame(...)` for the view rectangle, and exposes `UpdateScreenMetrics(...)` separately for screen metrics.

```cpp
void SetFrame(float x, float y, float width, float height);
```

#### Parameters

- `x`: The x coordinate of the `LynxView`.
- `y`: The y coordinate of the `LynxView`.
- `width`: Current `LynxView` width.
- `height`: Current `LynxView` height.

## Compatibility

**Compatibility Table**

**Query:** `lynx-native-api.lynx-view.update-viewport`

[Source](https://github.com/lynx-family/lynx-website/tree/main/packages/lynx-compat-data/lynx-native-api/lynx-view/update-viewport.json)

| Feature | Android | HarmonyOS | iOS | macOS | Windows | Web |
| --- | --- | --- | --- | --- | --- | --- |
| update-viewport | Yes (2.1) | Yes (3.4) | Yes (2.1) | Yes (3.7) | Yes (3.7) | No |

**`update-viewport`**

update viewport of lynxView

**Specifications:**

