Skip to content

Commit

Permalink
[RNMobile] Story block: added use of mediaFilesBlockReplaceSync bridg…
Browse files Browse the repository at this point in the history
…e method (#18540)

* added new bridge method to sync block replacement mediaFilesBlockReplaceSync

* added es-lint skip line directive
  • Loading branch information
mzorz authored Feb 5, 2021
1 parent e99c0d4 commit 609c992
Showing 1 changed file with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import {
requestMediaFilesUploadCancelDialog,
mediaUploadSync,
mediaSaveSync,
mediaFilesBlockReplaceSync,
requestMediaFilesEditorLoad,
} from '@wordpress/react-native-bridge';

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

useEffect( mediaSaveSync, [] );

// also sync in case we need to replace this block
useEffect( () => {
mediaFilesBlockReplaceSync( mediaFiles, clientId );
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [ clientId ] );

function onEditButtonTapped() {
// let's open the Story Creator and load this block in there
requestMediaFilesEditorLoad( mediaFiles, clientId );
Expand Down

0 comments on commit 609c992

Please sign in to comment.