Skip to content

Commit 609c992

Browse files
authored
[RNMobile] Story block: added use of mediaFilesBlockReplaceSync bridge method (#18540)
* added new bridge method to sync block replacement mediaFilesBlockReplaceSync * added es-lint skip line directive
1 parent e99c0d4 commit 609c992

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

projects/plugins/jetpack/extensions/blocks/story/edit.native.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import {
2222
requestMediaFilesUploadCancelDialog,
2323
mediaUploadSync,
2424
mediaSaveSync,
25+
mediaFilesBlockReplaceSync,
2526
requestMediaFilesEditorLoad,
2627
} from '@wordpress/react-native-bridge';
2728

@@ -50,6 +51,12 @@ const StoryEdit = ( { attributes, isSelected, clientId, setAttributes, onFocus }
5051

5152
useEffect( mediaSaveSync, [] );
5253

54+
// also sync in case we need to replace this block
55+
useEffect( () => {
56+
mediaFilesBlockReplaceSync( mediaFiles, clientId );
57+
// eslint-disable-next-line react-hooks/exhaustive-deps
58+
}, [ clientId ] );
59+
5360
function onEditButtonTapped() {
5461
// let's open the Story Creator and load this block in there
5562
requestMediaFilesEditorLoad( mediaFiles, clientId );

0 commit comments

Comments
 (0)