diff --git a/packages/block-editor/src/components/media-replace-flow/index.native.js b/packages/block-editor/src/components/media-replace-flow/index.native.js index 49e98a3b3b9ca..ca2ce4ee78c63 100644 --- a/packages/block-editor/src/components/media-replace-flow/index.native.js +++ b/packages/block-editor/src/components/media-replace-flow/index.native.js @@ -1,3 +1,12 @@ -// MediaReplaceFlow component is not yet implemented in the native version, -// so we return an empty component instead. -export default () => null; +/** + * External dependencies + */ +import { View } from 'react-native'; + +// MediaReplaceFlow component is not yet implemented in the native version. +// For testing purposes, we are using an empty View component with a testID prop. +const MediaReplaceFlow = () => { + return ; +}; + +export default MediaReplaceFlow; diff --git a/packages/block-library/src/gallery/edit.js b/packages/block-library/src/gallery/edit.js index 5ae8cd2d6820d..198892e286aba 100644 --- a/packages/block-library/src/gallery/edit.js +++ b/packages/block-library/src/gallery/edit.js @@ -635,25 +635,27 @@ function GalleryEdit( props ) { /> ) } - - image.id ) - .map( ( image ) => image.id ) } - addToGallery={ hasImageIds } - /> - { Platform.isWeb && ( - + <> + + image.id ) + .map( ( image ) => image.id ) } + addToGallery={ hasImageIds } + /> + + + ) } { expect( getEditorHtml() ).toMatchSnapshot(); } ); + it( 'does not display MediaReplaceFlow component within the block toolbar', async () => { + const screen = await initializeWithGalleryBlock( { + numberOfItems: 3, + media, + } ); + const { queryByTestId } = screen; + + fireEvent.press( getBlock( screen, 'Gallery' ) ); + + // Expect the native MediaReplaceFlow component to not be present in the block toolbar + const mediaReplaceFlow = queryByTestId( 'media-replace-flow' ); + expect( mediaReplaceFlow ).toBeNull(); + } ); + // Test cases related to TC013 - Settings - Columns // Reference: https://github.com/wordpress-mobile/test-cases/blob/trunk/test-cases/gutenberg/gallery.md#tc013 describe( 'Columns setting', () => { diff --git a/packages/react-native-editor/CHANGELOG.md b/packages/react-native-editor/CHANGELOG.md index 4ddfda16c8c78..b13b21a698a8e 100644 --- a/packages/react-native-editor/CHANGELOG.md +++ b/packages/react-native-editor/CHANGELOG.md @@ -10,6 +10,7 @@ For each user feature we should also add a importance categorization label to i --> ## Unreleased +- [*] Remove visual gap in mobile toolbar when a Gallery block is selected [#52966] ## 1.100.1 - [**] Add WP hook for registering non-core blocks [#52791]