RN picker - implement background color

Summary:
add support to the android implementation of the Picker component for setting the background color.

Changelog: [Android] [Added] - Support item background color in Dialog Picker

Differential Revision: D20566131

fbshipit-source-id: d693b40803fa1051ec955c5728994c820fecd9e9
This commit is contained in:
Eddie Dugan
2020-03-23 08:37:16 -07:00
committed by Facebook GitHub Bot
parent 327fbd0509
commit 22eb711c84
9 changed files with 47 additions and 0 deletions
@@ -41,6 +41,7 @@ type NativeProps = $ReadOnly<{|
// Props
color?: ?ColorValue,
backgroundColor?: ?ColorValue,
enabled?: WithDefault<boolean, true>,
items: $ReadOnlyArray<PickerItem>,
prompt?: WithDefault<string, ''>,
@@ -41,6 +41,7 @@ type NativeProps = $ReadOnly<{|
// Props
color?: ?ColorValue,
backgroundColor?: ?ColorValue,
enabled?: WithDefault<boolean, true>,
items: $ReadOnlyArray<PickerItem>,
prompt?: WithDefault<string, ''>,
+6
View File
@@ -96,6 +96,12 @@ type PickerProps = $ReadOnly<{|
*/
itemStyle?: ?TextStyleProp,
/**
* Color of the item background.
* @platform android
*/
backgroundColor?: ColorValue,
/**
* Prompt string for this picker, used on Android in dialog mode as the title of the dialog.
* @platform android
@@ -21,6 +21,7 @@ import StyleSheet from '../../StyleSheet/StyleSheet';
import invariant from 'invariant';
import processColor from '../../StyleSheet/processColor';
import type {ColorValue} from '../../StyleSheet/StyleSheetTypes';
import type {SyntheticEvent} from '../../Types/CoreEventTypes';
import type {TextStyleProp} from '../../StyleSheet/StyleSheet';
@@ -36,6 +37,7 @@ type Props = $ReadOnly<{|
accessibilityLabel?: ?Stringish,
children?: React.Node,
style?: ?TextStyleProp,
backgroundColor?: ?ColorValue,
selectedValue?: ?PickerItemValue,
enabled?: ?boolean,
mode?: ?('dialog' | 'dropdown'),
@@ -123,6 +125,7 @@ function PickerAndroid(props: Props): React.Node {
styles.pickerAndroid,
props.style,
),
backgroundColor: props.backgroundColor,
testID: props.testID,
};
return props.mode === 'dropdown' ? (