Skip to content
Merged
Show file tree
Hide file tree
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
[RNMobile] List block v2: Fix text color inconsistencies with list it…
…ems (#43244)

* List block v2: use default color for preferred color scheme
* Use usePreferredColorSchemeStyle hook for List Item style
* Remove unneeded font-size value from list item styles
  • Loading branch information
derekblank authored and Gerardo committed Aug 25, 2022
commit 201e83a8e5be0aab10dbe71baca5aed5b1c91127
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { View, Text } from 'react-native';
*/
import { Icon } from '@wordpress/components';
import { Platform } from '@wordpress/element';
import { usePreferredColorSchemeStyle } from '@wordpress/compose';

/**
* Internal dependencies
Expand Down Expand Up @@ -109,9 +110,15 @@ export default function ListStyleType( {
style?.fontSize ? style.fontSize : defaultFontSize,
10
);

const colorWithPreferredScheme = usePreferredColorSchemeStyle(
styles[ 'wp-block-list-item__list-item--default' ],
styles[ 'wp-block-list-item__list-item--default--dark' ]
);

const defaultColor = style?.baseColors?.color?.text
? style.baseColors.color.text
: styles[ 'wp-block-list-item__list-item--default' ].color;
: colorWithPreferredScheme.color;
const color = style?.color ? style.color : defaultColor;

if ( ordered ) {
Expand Down
4 changes: 4 additions & 0 deletions packages/block-library/src/list-item/style.native.scss
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@
font-size: $editor-font-size;
}

.wp-block-list-item__list-item--default--dark {
color: $white;
}

.wp-block-list-item__list-item-ordered--default {
margin-top: 2;
}
Expand Down