diff --git a/packages/block-library/src/cover/edit.native.js b/packages/block-library/src/cover/edit.native.js
index 33e513314bd75..f460cf494390c 100644
--- a/packages/block-library/src/cover/edit.native.js
+++ b/packages/block-library/src/cover/edit.native.js
@@ -22,6 +22,7 @@ import {
ToolbarGroup,
Gradient,
ColorPalette,
+ ColorPicker,
} from '@wordpress/components';
import {
BlockControls,
@@ -102,6 +103,7 @@ const Cover = ( {
overlayColor,
setAttributes,
openGeneralSidebar,
+ closeSettingsBottomSheet,
} ) => {
const {
backgroundType,
@@ -269,6 +271,20 @@ const Cover = ( {
);
+ const colorPickerControls = (
+
+ {} }
+ shouldDisableBottomSheetMaxHeight={ () => {} }
+ setColor={ () => {} }
+ onApply={ setColor }
+ onNavigationBack={ closeSettingsBottomSheet }
+ onCloseBottomSheet={ () => {} }
+ isBottomSheetContentScrolling={ () => {} }
+ />
+
+ );
+
const renderBackground = ( {
open: openMediaOptions,
getMediaOptions,
@@ -338,6 +354,7 @@ const Cover = ( {
if ( ! hasBackground ) {
return (
+ { colorPickerControls }
- openGeneralSidebar( 'edit-post/block' ),
+ openGeneralSidebar: () => openGeneralSidebar( 'edit-post/block' ),
+ closeSettingsBottomSheet() {
+ dispatch( 'core/edit-post' ).closeGeneralSidebar();
+ },
};
} ),
withPreferredColorScheme,
diff --git a/packages/components/src/color-picker/index.native.js b/packages/components/src/color-picker/index.native.js
index e95d2b4d770f6..aeeddcd59404c 100644
--- a/packages/components/src/color-picker/index.native.js
+++ b/packages/components/src/color-picker/index.native.js
@@ -26,6 +26,7 @@ function ColorPicker( {
isGradientColor,
onNavigationBack,
onCloseBottomSheet,
+ onApply,
} ) {
const isIOS = Platform.OS === 'ios';
const hitSlop = { top: 22, bottom: 22, left: 22, right: 22 };
@@ -98,7 +99,12 @@ function ColorPicker( {
onNavigationBack();
onCloseBottomSheet( null );
shouldDisableBottomSheetMaxHeight( true );
- setColor( action === 'apply' ? currentColor : savedColor );
+ if ( action === 'apply' ) {
+ setColor( currentColor );
+ if ( onApply !== undefined ) onApply( currentColor );
+ } else {
+ setColor( savedColor );
+ }
}
return (
diff --git a/packages/components/src/index.native.js b/packages/components/src/index.native.js
index 2e74337bbf8fb..af13a8d2f02f6 100644
--- a/packages/components/src/index.native.js
+++ b/packages/components/src/index.native.js
@@ -10,6 +10,7 @@ export {
} from '@wordpress/primitives';
export { default as ColorIndicator } from './color-indicator';
export { default as ColorPalette } from './color-palette';
+export { default as ColorPicker } from './color-picker';
export { default as Dashicon } from './dashicon';
export { default as Dropdown } from './dropdown';
export { default as DropdownMenu } from './dropdown-menu';