[Bug] iOS Reddit app resets boolean form fields to defaultValue when scrolled out of view

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

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

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
56/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
ios, typescript
領域
mobile

調査の方向性

Start by tracing how Devvit.createForm and context.ui.showForm pass boolean field state to the iOS form controls, then find where recycled cells initialize their toggle values. Compare that path with the working Android or desktop behavior. Done means a toggled value stays visible after scrolling off-screen and is submitted correctly on iOS; verify with the reproduction steps in the issue.

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

説明

Description

When using Devvit.createForm (or context.ui.showForm), fields of type: "boolean" reset to their defaultValue when scrolled out of the visible viewport in the iOS Reddit app.

When a user toggles a boolean switch, scrolls down to complete the rest of the form, and taps the submit button, the reset defaultValue is submitted in the FormOnSubmitEvent.values payload rather than the user's toggled state.

Platform Comparison

  • iOS Reddit app (Bug): Toggling a boolean, scrolling it out of view, and scrolling back up shows the toggle visibly snapped back to defaultValue. Submitting sends defaultValue.
  • Android Reddit app: Works properly. Toggled state is preserved across scrolling/view recycling.
  • Desktop Web: Works properly.

Steps to Reproduce

  1. Define a form with enough fields to require scrolling on mobile, placing a type: "boolean" field with defaultValue: true at the top:
Devvit.createForm(
  {
    title: "Test Form",
    acceptLabel: "Save",
    fields: [
      {
        name: "enable_feature",
        label: "Enable Feature",
        type: "boolean",
        defaultValue: true,
      },
      { name: "field_1", label: "Option 1", type: "string" },
      { name: "field_2", label: "Option 2", type: "string" },
      { name: "field_3", label: "Option 3", type: "string" },
      { name: "field_4", label: "Option 4", type: "string" },
      { name: "field_5", label: "Option 5", type: "string" },
    ],
  },
  (event, context) => {
    console.log("Submitted values:", event.values);
  }
);
  1. Open the form on the iOS Reddit app.
  2. Toggle enable_feature from true to false.
  3. Scroll down until the enable_feature switch is completely off-screen.
  4. Either scroll back up (the toggle will have visibly snapped back to true), or tap "Save".
  5. Inspect the submitted event.values in logs.

Expected Behavior

Form field state should persist across list/cell recycling on iOS, matching Android and Desktop Web.

Observed Behavior

On iOS, event.values.enable_feature arrives as true (defaultValue). The native iOS cell recycling re-initializes the toggle control from field.defaultValue rather than reading from the active form state model.

Environment

  • Devvit version: 0.14.8
  • Client: Reddit Mobile App (iOS)
主要言語
TypeScript
スター
217
フォーク
89
PR マージ指標
30日以内にマージされた PR はありません

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

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

reddit/devvit のほかの issue

reddit/devvit の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

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

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