Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[RNMobile] Native mobile release v1.8.0 #16344

Merged
merged 2 commits into from
Jun 28, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -55,15 +55,12 @@ export default compose(
order: getBlockIndex( clientId ),
};
} ),
withDispatch( ( dispatch, { clientId, rootClientId, onDelete } ) => {
withDispatch( ( dispatch, { clientId, rootClientId } ) => {
const { removeBlock } = dispatch( 'core/block-editor' );
return {
onDelete() {
onDelete: () => {
Keyboard.dismiss();
removeBlock( clientId, rootClientId );
if ( onDelete ) {
onDelete( clientId );
}
},
};
} ),
Expand Down
7 changes: 4 additions & 3 deletions packages/block-library/src/image/edit.native.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import {
mediaUploadSync,
requestImageFailedRetryDialog,
requestImageUploadCancelDialog,
requestImageUploadCancel,
} from 'react-native-gutenberg-bridge';
import { isEmpty } from 'lodash';

Expand All @@ -31,6 +30,7 @@ import {
} from '@wordpress/block-editor';
import { __, sprintf } from '@wordpress/i18n';
import { isURL } from '@wordpress/url';
import { doAction, hasAction } from '@wordpress/hooks';

/**
* Internal dependencies
Expand Down Expand Up @@ -92,8 +92,9 @@ class ImageEdit extends React.Component {
}

componentWillUnmount() {
if ( this.state.isUploadInProgress ) {
requestImageUploadCancel( this.props.attributes.id );
// this action will only exist if the user pressed the trash button on the block holder
if ( hasAction( 'blocks.onRemoveBlockCheckUpload' ) && this.state.isUploadInProgress ) {
doAction( 'blocks.onRemoveBlockCheckUpload', this.props.attributes.id );
}
}

Expand Down
7 changes: 4 additions & 3 deletions packages/block-library/src/video/edit.native.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import {
mediaUploadSync,
requestImageFailedRetryDialog,
requestImageUploadCancelDialog,
requestImageUploadCancel,
} from 'react-native-gutenberg-bridge';

/**
Expand All @@ -32,6 +31,7 @@ import {
} from '@wordpress/block-editor';
import { __ } from '@wordpress/i18n';
import { isURL } from '@wordpress/url';
import { doAction, hasAction } from '@wordpress/hooks';

/**
* Internal dependencies
Expand Down Expand Up @@ -70,8 +70,9 @@ class VideoEdit extends React.Component {
}

componentWillUnmount() {
if ( this.state.isUploadInProgress ) {
requestImageUploadCancel( this.props.attributes.id );
// this action will only exist if the user pressed the trash button on the block holder
if ( hasAction( 'blocks.onRemoveBlockCheckUpload' ) && this.state.isUploadInProgress ) {
doAction( 'blocks.onRemoveBlockCheckUpload', this.props.attributes.id );
}
}

Expand Down
10 changes: 10 additions & 0 deletions packages/edit-post/src/index.native.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/**
* External dependencies
*/
import { Platform } from 'react-native';

/**
* WordPress dependencies
*/
Expand All @@ -24,6 +29,11 @@ export function initializeEditor() {
// eslint-disable-next-line no-undef
if ( typeof __DEV__ === 'undefined' || ! __DEV__ ) {
unregisterBlockType( 'core/code' );

// Disable Video block except for iOS for now.
if ( Platform.OS !== 'ios' ) {
unregisterBlockType( 'core/video' );
}
}
}