Skip to content

Commit

Permalink
Reformat
Browse files Browse the repository at this point in the history
  • Loading branch information
Tug committed Apr 2, 2020
1 parent 76866b5 commit f051533
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 18 deletions.
33 changes: 17 additions & 16 deletions packages/element/src/react-platform.native.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* External dependencies
*/
import { AppRegistry } from "react-native";
import { AppRegistry } from 'react-native';
import { isEmpty, omit } from 'lodash';

/**
Expand All @@ -14,25 +14,26 @@ import { applyFilters, doAction } from '@wordpress/hooks';
*/
import { cloneElement } from './react';

const render = ( element, id ) => AppRegistry.registerComponent( id, () => ( propsFromNative ) => {
const nativeProps = omit( propsFromNative || {}, [ 'rootTag' ] );
const render = ( element, id ) =>
AppRegistry.registerComponent( id, () => ( propsFromNative ) => {
const nativeProps = omit( propsFromNative || {}, [ 'rootTag' ] );

doAction( 'native.render', nativeProps );
doAction( 'native.render', nativeProps );

// if we have not received props from a parent native app
// just render the element as it is
if ( isEmpty( nativeProps ) ) {
return element;
}
// if we have not received props from a parent native app
// just render the element as it is
if ( isEmpty( nativeProps ) ) {
return element;
}

// Otherwise overwrite the existing props using a filter hook
const filteredProps = applyFilters(
'native.block_editor_props',
nativeProps
);
// Otherwise overwrite the existing props using a filter hook
const filteredProps = applyFilters(
'native.block_editor_props',
nativeProps
);

return cloneElement( element, filteredProps );
} );
return cloneElement( element, filteredProps );
} );

/**
* Render a given element on Native.
Expand Down
3 changes: 1 addition & 2 deletions packages/react-native-editor/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ const setupInitHooks = () => {
wpHooks.doAction( 'native.setup-init-hooks' );

wpHooks.addAction( 'native.render', 'core/react-native-editor', ( props ) => {
setupLocale( props.locale, props.translations );
setupLocale( 'fr', props.translations );
} );

// Map native props to Editor props
Expand Down Expand Up @@ -89,5 +89,4 @@ const setupLocale = ( locale, extraTranslations ) => {
};

reactNativeSetup();

gutenbergSetup();

0 comments on commit f051533

Please sign in to comment.