Playlist block can't open the native media library

オープン 初心者向け
#940 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

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

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

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
74/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
領域
mobile-dev

調査の方向性

useNativeMediaLibrary から始めてください。そこでは openMediaLibrary ブリッジメッセージが構築されるので、Playlist ブロックの multiple 値が、edit.jsx で multiple="add" を MediaPlaceholder と MediaReplaceFlow に指定している箇所からそこにどのように届くかを追跡してください。イシューで示されているネイティブデコーダー — iOS の OpenMediaLibraryAction と Android の parseMediaLibraryConfig — と比較してください。どちらも Boolean を期待しており、onSelect コールバックがすでに multiple を truthy として扱っていることに注意してください。送信前に multiple を Boolean に正規化してください。完了条件は、「Media Library」と「Add track」をタップするとピッカーが開き、選択したオーディオが両方のプラットフォームで追加されることです。

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

説明

[Type] Bug
Description

Choosing "Media Library" in a Playlist block should open the native media picker and add the selected audio to the playlist. Nothing happens instead, on both iOS and Android.

The Playlist block passes multiple="add" to MediaUpload. Upstream types this as boolean | 'add'. GutenbergKit forwards the string unchanged in the openMediaLibrary bridge message, but both native decoders expect a Boolean:

  • iOS: OpenMediaLibraryAction fails to decode. Before #917 this hit a fatalError and crashed the app. Since #917 the message is logged and dropped.
  • Android: parseMediaLibraryConfig throws on requireBoolean("multiple"), and the message is logged and dropped.

A likely fix is to normalize multiple to a Boolean in useNativeMediaLibrary before sending it, which covers both platforms. The onSelect callback already passes an array when multiple is truthy.

Step-by-step reproduction instructions
  1. Open the editor in a host app or the demo app.
  2. Insert a Playlist block.
  3. Tap "Media Library" in the placeholder, or "Add track" in the toolbar on an existing playlist.
  4. The media picker doesn't open. The native logs show a dropped openMediaLibrary message.
Screenshots, screen recording, code snippet
// @wordpress/block-library/src/playlist/edit.jsx
<MediaPlaceholder multiple="add" … />
<MediaReplaceFlow multiple="add" … />
Environment info

GutenbergKit trunk (@wordpress/block-library 12.2.0). The crash was reported on the iOS app's 27.5 beta, before #917.

Please confirm that you have searched existing issues in the repo.
  • Yes
主要言語
JavaScript
スター
29
フォーク
6
平均マージ
2日 1時間
マージ済み PR(30日)
76

環境構築

はじめの一歩

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

wordpress-mobile/GutenbergKit のほかの issue

wordpress-mobile/GutenbergKit の issue をすべて見る

似ている issue

JavaScript の issue をもっと見る

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

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