diff --git a/packages/block-editor/src/components/rich-text/index.native.js b/packages/block-editor/src/components/rich-text/index.native.js index 41e5a7635d2f07..1be6551302edf6 100644 --- a/packages/block-editor/src/components/rich-text/index.native.js +++ b/packages/block-editor/src/components/rich-text/index.native.js @@ -655,29 +655,32 @@ export function RichTextWrapper( ); } -const ForwardedRichTextContainer = withDeprecations( +// This export does not actually implement a private API, but was exported +// under this name for interoperability with the web version of the RichText +// component. +export const PrivateRichText = withDeprecations( forwardRef( RichTextWrapper ) ); -ForwardedRichTextContainer.Content = Content; +PrivateRichText.Content = Content; -ForwardedRichTextContainer.isEmpty = ( value ) => { +PrivateRichText.isEmpty = ( value ) => { return ! value || value.length === 0; }; -ForwardedRichTextContainer.Content.defaultProps = { +PrivateRichText.Content.defaultProps = { format: 'string', value: '', }; -ForwardedRichTextContainer.Raw = forwardRef( ( props, ref ) => ( +PrivateRichText.Raw = forwardRef( ( props, ref ) => ( ) ); /** * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/rich-text/README.md */ -export default ForwardedRichTextContainer; +export default PrivateRichText; export { RichTextShortcut } from './shortcut'; export { RichTextToolbarButton } from './toolbar-button'; export { __unstableRichTextInputEvent } from './input-event'; diff --git a/packages/block-editor/src/private-apis.native.js b/packages/block-editor/src/private-apis.native.js index 7a0328eba2f6fb..f99d523933106b 100644 --- a/packages/block-editor/src/private-apis.native.js +++ b/packages/block-editor/src/private-apis.native.js @@ -5,6 +5,7 @@ import * as globalStyles from './components/global-styles'; import { ExperimentalBlockEditorProvider } from './components/provider'; import { getRichTextValues } from './components/rich-text/get-rich-text-values'; import { lock } from './lock-unlock'; +import { PrivateRichText } from './components/rich-text/'; /** * Private @wordpress/block-editor APIs. @@ -14,4 +15,5 @@ lock( privateApis, { ...globalStyles, ExperimentalBlockEditorProvider, getRichTextValues, + PrivateRichText, } ); diff --git a/test/native/setup.js b/test/native/setup.js index 54a416bd436607..4fd511f38e91b1 100644 --- a/test/native/setup.js +++ b/test/native/setup.js @@ -81,6 +81,7 @@ jest.mock( '@wordpress/api-fetch', () => { jest.mock( '@wordpress/react-native-bridge', () => { return { addEventListener: jest.fn(), + logException: jest.fn(), mediaUploadSync: jest.fn(), removeEventListener: jest.fn(), requestBlockTypeImpressions: jest.fn( ( callback ) => {