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] Support Theme Colors and Gradients #22197

Merged
merged 15 commits into from
Jun 3, 2020
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Modify button to support theme gradients
  • Loading branch information
chipsnyder committed May 8, 2020
commit 7e37b7a9d2e0be96d6d85efec87b77d0e229a0d0
12 changes: 5 additions & 7 deletions packages/block-library/src/button/edit.native.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import {
withColors,
InspectorControls,
BlockControls,
SETTINGS_DEFAULTS,
__experimentalUseGradient,
} from '@wordpress/block-editor';
import {
TextControl,
Expand Down Expand Up @@ -174,16 +174,12 @@ class ButtonEdit extends Component {
}

getBackgroundColor() {
const { backgroundColor, attributes } = this.props;
const { backgroundColor, attributes, gradientValue } = this.props;
const { gradient, customGradient } = attributes;
const defaultGradients = SETTINGS_DEFAULTS.gradients;

if ( customGradient || gradient ) {
return (
customGradient ||
defaultGradients.find(
( defaultGradient ) => defaultGradient.slug === gradient
).gradient
customGradient || gradientValue
);
}
return (
Expand Down Expand Up @@ -548,6 +544,7 @@ export default compose( [
withInstanceId,
withColors( 'backgroundColor', { textColor: 'color' } ),
withSelect( ( select, { clientId } ) => {
const { gradientValue } = __experimentalUseGradient();
const { isEditorSidebarOpened } = select( 'core/edit-post' );
const {
getSelectedBlockClientId,
Expand All @@ -560,6 +557,7 @@ export default compose( [
const numOfButtons = getBlockCount( parentId );

return {
gradientValue,
selectedId,
editorSidebarOpened: isEditorSidebarOpened(),
numOfButtons,
Expand Down