Skip to content
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
Refactor to workaround test failures
The UI tests in Gutenberg Mobile were failing as 'styles' returns 'undefined' (in the tests) when called from the 'PickerComponent' function. Example: https://app.circleci.com/pipelines/github/wordpress-mobile/gutenberg-mobile/18255/workflows/16df0260-7972-465b-b400-ec37603dfd9e/jobs/100060

This commit seeks to workaround that error by only calling the internal styles from the main Picker class.
  • Loading branch information
SiobhyB committed Aug 5, 2022
commit f4610d164a24e9882495ea9d86faea5d23971356
15 changes: 8 additions & 7 deletions packages/components/src/mobile/picker/index.ios.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,16 @@ class Picker extends Component {
isBottomSheetOpened,
closeBottomSheet,
onHandleClosingBottomSheet,
tintColor,
colorScheme,
} = this.props;
const labels = options.map( ( { label } ) => label );
const fullOptions = [ __( 'Cancel' ) ].concat( labels );

const buttonTitleColor =
colorScheme === 'light'
? styles[ 'components-picker__button-title' ].color
: styles[ 'components-picker__button-title--dark' ].color;

ActionSheetIOS.showActionSheetWithOptions(
{
title,
Expand All @@ -42,7 +47,7 @@ class Picker extends Component {
destructiveButtonIndex,
disabledButtonIndices,
anchor: getAnchor && getAnchor(),
tintColor,
tintColor: buttonTitleColor,
},
( buttonIndex ) => {
if ( buttonIndex === 0 ) {
Expand Down Expand Up @@ -75,10 +80,6 @@ const PickerComponent = forwardRef( ( props, ref ) => {
const { onHandleClosingBottomSheet } = useContext( BottomSheetContext );

const colorScheme = usePreferredColorScheme();
const buttonTitleColor =
colorScheme === 'light'
? styles[ 'components-picker__button-title' ].color
: styles[ 'components-picker__button-title--dark' ].color;

return (
<Picker
Expand All @@ -87,7 +88,7 @@ const PickerComponent = forwardRef( ( props, ref ) => {
isBottomSheetOpened={ isBottomSheetOpened }
closeBottomSheet={ closeGeneralSidebar }
onHandleClosingBottomSheet={ onHandleClosingBottomSheet }
tintColor={ buttonTitleColor }
colorScheme={ colorScheme }
/>
);
} );
Expand Down