Playlist block can't open the native media library

Open Beginner friendly
#940 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
74/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Domain
mobile-dev

Research direction

Start in useNativeMediaLibrary, where the openMediaLibrary bridge message is built, and trace how the multiple value from the Playlist block's edit.jsx (multiple="add" on MediaPlaceholder and MediaReplaceFlow) reaches it. Compare against the native decoders named in the issue — OpenMediaLibraryAction on iOS and parseMediaLibraryConfig on Android — which both expect a Boolean, and note the onSelect callback already treats multiple as truthy. Normalize multiple to a Boolean before sending; done means tapping "Media Library" and "Add track" opens the picker and the selected audio is added on both platforms.

Written by the indexing model from the issue text.

Description

[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
Dominant language
JavaScript
Stars
29
Forks
6
Avg merge
2d 1h
Merged PRs (30d)
76

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from wordpress-mobile/GutenbergKit

All issues in wordpress-mobile/GutenbergKit

Similar issues

More JavaScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.