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] Button Block #18823

Merged
merged 55 commits into from
Feb 6, 2020
Merged
Show file tree
Hide file tree
Changes from 54 commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
4db1d06
Initial work on Button block
lukewalczak Nov 18, 2019
529c5c5
Some button styling
lukewalczak Nov 20, 2019
93b20ee
Do some tweaks on android
lukewalczak Nov 20, 2019
2c20d97
Some styling and connect link settings
lukewalczak Nov 21, 2019
4d1ec1a
Support borderRadius
lukewalczak Nov 21, 2019
a63deac
Adjust to dark mode
lukewalczak Nov 22, 2019
b40e1dc
Add a RichText wrapper with LinearGradient
lukewalczak Nov 25, 2019
41460ce
Merge branch 'master' into rnmobile/button-block
lukewalczak Nov 25, 2019
829b492
Extract RichText wrapper
lukewalczak Nov 29, 2019
efe4e1f
Update test setup.js
lukewalczak Nov 29, 2019
1fc7530
Refactor border width
lukewalczak Dec 2, 2019
7dba9e2
Set max and min width for ios RichText
lukewalczak Dec 2, 2019
c3267a6
Add comments and set max width when screen has horizontal orientation
lukewalczak Dec 3, 2019
f85d2d8
Extract NotificationSheet to separate file
lukewalczak Dec 4, 2019
148ff59
Move NotifcationSheet to components
lukewalczak Dec 6, 2019
7c2fe18
Merge branch 'master' into rnmobile/button-block
lukewalczak Dec 9, 2019
2e1593b
Set isFocused on true by default
lukewalczak Dec 9, 2019
8fef323
fix jumping height android
dratwas Dec 10, 2019
3c5c33f
Improve a11y and small refactor
lukewalczak Dec 10, 2019
8408db3
Merge branch 'rnmobile/button-block' of github.com:WordPress/gutenber…
lukewalczak Dec 10, 2019
8e6d119
Move variables to styles
lukewalczak Dec 10, 2019
c54f727
Update setting background color
lukewalczak Dec 13, 2019
79e3fa9
Merge branch 'master' into rnmobile/button-block
lukewalczak Dec 13, 2019
133a70e
Changes in NotificationSheet and Settings
lukewalczak Dec 17, 2019
bc812a6
Rewrite mobile button block to class component
lukewalczak Dec 17, 2019
31c38b4
Rewrite functions
lukewalczak Dec 17, 2019
a1695a5
Use isFocused() method
lukewalczak Dec 17, 2019
0f314dd
Merge branch 'master' into rnmobile/button-block
lukewalczak Jan 7, 2020
04fda2b
Rename files
lukewalczak Jan 9, 2020
f63a741
Create separate settings for mobile Button
lukewalczak Jan 13, 2020
5820f83
Remove notification bottom sheet
lukewalczak Jan 13, 2020
4ad4755
Rename component and comment logic
lukewalczak Jan 14, 2020
4ddfa2a
Merge branch 'master' into rnmobile/button-block
lukewalczak Jan 14, 2020
f8780c5
Replace MissingControl in favor of UnsupportedFooterControl
lukewalczak Jan 15, 2020
39eb5dd
Adjust link modal for Button block purposes
lukewalczak Jan 16, 2020
0e4c4d2
Small cleanup
lukewalczak Jan 16, 2020
483c6e8
Fix test
lukewalczak Jan 17, 2020
10f41e3
Merge branch 'master' into rnmobile/button-block
lukewalczak Jan 17, 2020
7fc9a61
Try to fix mobile test
lukewalczak Jan 17, 2020
8b20d5e
Adjust button styling after uploading the latest changes
lukewalczak Jan 17, 2020
f02b085
Replace Dashicon in favor of Icon in native cell component
lukewalczak Jan 21, 2020
71a365b
Fix overriding existing URL in bottom sheet
lukewalczak Jan 22, 2020
cc54861
Making handlers more consistent
lukewalczak Jan 22, 2020
26a50e1
Revert changes in link settings and build custom adjusted for Button …
lukewalczak Jan 23, 2020
9b9c8db
Fix test
lukewalczak Jan 23, 2020
e0eb655
Correct condition
lukewalczak Jan 23, 2020
ecc442e
Correct focusing RichText within Button
lukewalczak Jan 24, 2020
ee1d767
Unify isButtonFocused for both platforms
lukewalczak Jan 24, 2020
dff4a05
Merge branch 'master' into rnmobile/button-block
lukewalczak Jan 28, 2020
829fd08
Merge branch 'master' into rnmobile/button-block
lukewalczak Jan 31, 2020
a28a322
Merge branch 'master' into rnmobile/button-block
lukewalczak Feb 3, 2020
e758b9c
Fix lint issues after merge
lukewalczak Feb 3, 2020
e6452d4
Reuse controls
lukewalczak Feb 4, 2020
3b27ecf
Adjust reused components and add caret color
lukewalczak Feb 4, 2020
a646031
Merge branch 'master' into rnmobile/button-block
lukewalczak Feb 6, 2020
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
1 change: 1 addition & 0 deletions packages/block-editor/src/components/index.native.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ export { default as BlockFormatControls } from './block-format-controls';
export { default as BlockIcon } from './block-icon';
export { default as BlockVerticalAlignmentToolbar } from './block-vertical-alignment-toolbar';
export * from './colors';
export * from './gradients';
export * from './font-sizes';
export { default as AlignmentToolbar } from './alignment-toolbar';
export { default as InnerBlocks } from './inner-blocks';
Expand Down
65 changes: 65 additions & 0 deletions packages/block-library/src/button/color-background.native.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
/**
* External dependencies
*/
import { View } from 'react-native';
import LinearGradient from 'react-native-linear-gradient';
/**
* WordPress dependencies
*/
import { __experimentalUseGradient } from '@wordpress/block-editor';
/**
* Internal dependencies
*/
import styles from './editor.scss';

function ColorBackground( { children, borderRadiusValue, backgroundColor } ) {
const wrapperStyles = [
styles.richTextWrapper,
{
borderRadius: borderRadiusValue,
backgroundColor,
},
];

const { gradientValue } = __experimentalUseGradient();

function transformGradient() {
const matchColorGroup = /(rgba|rgb|#)(.+?)[\%]/g;
const matchDeg = /(\d.+)deg/g;

const colorGroup = gradientValue
.match( matchColorGroup )
.map( ( color ) => color.split( ' ' ) );

const colors = colorGroup.map( ( color ) => color[ 0 ] );
const locations = colorGroup.map(
( location ) => Number( location[ 1 ].replace( '%', '' ) ) / 100
);
const angle = Number( matchDeg.exec( gradientValue )[ 1 ] );

return {
colors,
locations,
angle,
};
}

if ( gradientValue ) {
const { colors, locations, angle } = transformGradient();
return (
<LinearGradient
colors={ colors }
useAngle={ true }
angle={ angle }
locations={ locations }
angleCenter={ { x: 0.5, y: 0.5 } }
style={ wrapperStyles }
>
{ children }
</LinearGradient>
);
}
return <View style={ wrapperStyles }>{ children }</View>;
}

export default ColorBackground;
Loading