Skip to content

Commit

Permalink
shared the destructiveButton logic between the Image & Cover block.
Browse files Browse the repository at this point in the history
  • Loading branch information
jd-alexander committed Sep 3, 2020
1 parent 9f3269b commit 7de89e0
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 22 deletions.
11 changes: 1 addition & 10 deletions packages/block-library/src/cover/edit.native.js
Original file line number Diff line number Diff line change
Expand Up @@ -486,16 +486,7 @@ const Cover = ( {
<ImageEditingButton
onSelectMediaUploadOption={ onSelectMedia }
openMediaOptions={ openMediaOptionsRef.current }
pickerOptions={ [
{
destructiveButton: true,
id: 'clearMedia',
label: __( 'Clear Media' ),
onPress: onClearMedia,
separated: true,
value: 'clearMedia',
},
] }
onClearMedia={ onClearMedia }
url={ url }
/>
</View>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { TouchableWithoutFeedback, View } from 'react-native';
* WordPress dependencies
*/
import { Icon } from '@wordpress/components';
import { __ } from '@wordpress/i18n';

/**
* Internal dependencies
Expand All @@ -18,7 +19,7 @@ import styles from './style.scss';
const ImageEditingButton = ( {
onSelectMediaUploadOption,
openMediaOptions,
pickerOptions,
onClearMedia,
url,
} ) => {
return (
Expand All @@ -40,7 +41,16 @@ const ImageEditingButton = ( {
</View>
</TouchableWithoutFeedback>
) }
pickerOptions={ pickerOptions }
pickerOptions={ [
{
destructiveButton: true,
id: 'clearMedia',
label: __( 'Clear Media' ),
onPress: onClearMedia,
separated: true,
value: 'clearMedia',
},
] }
/>
);
};
Expand Down
11 changes: 1 addition & 10 deletions packages/components/src/mobile/image/index.native.js
Original file line number Diff line number Diff line change
Expand Up @@ -225,16 +225,7 @@ const ImageComponent = ( {
}
openMediaOptions={ openMediaOptions }
url={ url }
pickerOptions={ [
{
destructiveButton: true,
id: 'clearMedia',
label: __( 'Clear Media' ),
onPress: onClearMedia,
separated: true,
value: 'clearMedia',
},
] }
onClearMedia={ onClearMedia }
/>
) }
</View>
Expand Down

0 comments on commit 7de89e0

Please sign in to comment.