@wordpress/components
Version:
UI components for WordPress.
56 lines (51 loc) • 1.6 kB
JavaScript
import _extends from "@babel/runtime/helpers/esm/extends";
import { createElement } from "@wordpress/element";
/**
* External dependencies
*/
import { TouchableWithoutFeedback, View, Platform } from 'react-native';
/**
* WordPress dependencies
*/
import { Icon } from '@wordpress/components';
import { __ } from '@wordpress/i18n';
/**
* Internal dependencies
*/
import { MediaEdit } from '../media-edit';
import SvgIconCustomize from './icon-customize';
import styles from './style.scss';
const accessibilityHint = Platform.OS === 'ios' ? __('Double tap to open Action Sheet to edit, replace, or clear the image') : __('Double tap to open Bottom Sheet to edit, replace, or clear the image');
const ImageEditingButton = ({
onSelectMediaUploadOption,
openMediaOptions,
pickerOptions,
url
}) => {
return createElement(MediaEdit, {
onSelect: onSelectMediaUploadOption,
source: {
uri: url
},
openReplaceMediaOptions: openMediaOptions,
render: ({
open,
mediaOptions
}) => createElement(TouchableWithoutFeedback, {
accessibilityHint: accessibilityHint,
accessibilityLabel: __('Edit image'),
accessibilityRole: 'button',
onPress: open
}, createElement(View, {
style: styles.editContainer
}, createElement(View, {
style: styles.edit
}, mediaOptions(), createElement(Icon, _extends({
size: 16,
icon: SvgIconCustomize
}, styles.iconCustomise))))),
pickerOptions: pickerOptions
});
};
export default ImageEditingButton;
//# sourceMappingURL=image-editing-button.native.js.map