API for real-time detection of widget dimensions (width and height), with automatic updates upon every resize

オープン
#374 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
5/5
見積もり時間
1週間以上
初心者へのやさしさ
22/100
issue の種類
機能追加
明瞭さ
おおむね明確
活発さ
活発
技術スタック
ios, react-native, swift, typescript
領域
mobile-dev

調査の方向性

Start by tracing how widget cell dimensions are computed on the Swift side and how any values currently cross into JS — look for the existing native module/bridge and the VoltraAndroid component definitions the example references. Read the widget layout code and the example app that renders VoltraAndroid.LazyVerticalGrid to see where a size hook would attach. Done means a documented hook or callback returning live { width, height } in cells that fires on resize, plus an example and tests showing the value updating.

索引モデルが issue の本文から書いたものです。

説明

enhancement
Feature Description

I would like an API that provides the actual number of cells occupied by the widget in terms of width and height, in real time.

These values ​​should update automatically and immediately whenever the user resizes the widget, allowing the layout to be dynamically adjusted based on the actual dimensions.

Problem Statement

Currently, it is not possible to determine the actual number of cells occupied by a widget when it is resized.
This limits the ability to create dynamic and responsive layouts.

Being able to access the width and height in real time would allow for the automatic adjustment of content and the number of columns based on the widget's actual dimensions, eliminating the need for manual calculations and approximate solutions.

Proposed Solution

Add an API or callback that returns the actual number of cells occupied by the widget, in terms of both width and height.

These values ​​must update in real time whenever the user resizes the widget.

For example, if the widget occupies 2 columns, the API should return width = 2
if it is resized to 5 columns, it should automatically return width = 5.

This will make it possible to dynamically adapt components, such as VoltraAndroid.LazyVerticalGrid to the widget's actual dimensions.

const [widgetSize, setWidgetSize] = useState({
    width: 2,
    height: 2
});

VoltraAndroid.onWidgetResize((size) => {
    setWidgetSize({
        width: size.width,
        height: size.height
    });
});

<VoltraAndroid.LazyVerticalGrid
    columns={widgetSize.width}
>
</VoltraAndroid.LazyVerticalGrid>
Alternatives Considered

No response

Current Library Version

2.6.0

Implementation
  • I would be willing to submit a pull request for this feature
Additional Context

No response

主要言語
TypeScript
スター
865
フォーク
50
平均マージ
2日 22時間
マージ済み PR(30日)
18

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

callstackincubator/voltra のほかの issue

callstackincubator/voltra の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。