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: Consolidate logic hiding blocks from release builds to one location #19516

Merged
merged 1 commit into from
Jan 13, 2020
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
9 changes: 6 additions & 3 deletions packages/block-library/src/index.native.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,10 @@ const registerBlock = ( block ) => {
} );
};

// only enable code block for development
// eslint-disable-next-line no-undef
const devOnly = ( block ) => !! __DEV__ ? block : null;

/**
* Function to register core blocks provided by the block editor.
*
Expand All @@ -132,7 +136,7 @@ export const registerCoreBlocks = () => {
[
paragraph,
heading,
code,
devOnly( code ),
missing,
more,
image,
Expand All @@ -144,8 +148,7 @@ export const registerCoreBlocks = () => {
mediaText,
preformatted,
gallery,
// eslint-disable-next-line no-undef
!! __DEV__ ? group : null,
devOnly( group ),
spacer,
].forEach( registerBlock );

Expand Down
8 changes: 0 additions & 8 deletions packages/edit-post/src/index.native.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import '@wordpress/editor';
import '@wordpress/viewport';
import '@wordpress/notices';
import { registerCoreBlocks } from '@wordpress/block-library';
import { unregisterBlockType } from '@wordpress/blocks';
import '@wordpress/format-library';

/**
Expand All @@ -27,13 +26,6 @@ export function initializeEditor() {

// register and setup blocks
registerCoreBlocks();

// disable Code block for the release
// eslint-disable-next-line no-undef
if ( typeof __DEV__ === 'undefined' || ! __DEV__ ) {
unregisterBlockType( 'core/code' );
}

blocksRegistered = true;
}

Expand Down