Skip to content

Commit e12e3d6

Browse files
Feat/picker item label style (#1332)
* add labelStyle prop * labelStyle type * Update demo/src/screens/componentScreens/PickerScreen.js Co-authored-by: Miki Leib <[email protected]> Co-authored-by: Miki Leib <[email protected]>
1 parent 54c2e5e commit e12e3d6

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

demo/src/screens/componentScreens/PickerScreen.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import _ from 'lodash';
22
import React, {Component} from 'react';
33
import {ScrollView, Image} from 'react-native';
4-
import {View, Colors, Dialog, Text, Picker, Avatar, Assets, PanningProvider} from 'react-native-ui-lib'; //eslint-disable-line
4+
import {View, Colors, Dialog, Text, Picker, Avatar, Assets, PanningProvider, Typography} from 'react-native-ui-lib'; //eslint-disable-line
55
import contactsData from '../../data/conversations';
66
import tagIcon from '../../assets/icons/tags.png';
77
import dropdown from '../../assets/icons/chevronDown.png';
@@ -162,7 +162,7 @@ export default class PickerScreen extends Component {
162162
renderCustomModal={this.renderDialog}
163163
>
164164
{_.map(options, option => (
165-
<Picker.Item key={option.value} value={option} label={option.label} disabled={option.disabled}/>
165+
<Picker.Item key={option.value} value={option} label={option.label} labelStyle={Typography.text65} disabled={option.disabled}/>
166166
))}
167167
</Picker>
168168

src/components/picker/PickerItem.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import _ from 'lodash';
22
import PropTypes from 'prop-types';
33
import React, {useCallback, useEffect, useMemo, useContext} from 'react';
4-
import {StyleSheet} from 'react-native';
4+
import {StyleSheet, Text as RNText} from 'react-native';
55
import {LogService} from '../../services';
66
import {Colors, Typography} from '../../style';
77
import * as Modifiers from '../../commons/modifiers';
@@ -23,6 +23,7 @@ const PickerItem = props => {
2323
const {
2424
value,
2525
label,
26+
labelStyle,
2627
disabled,
2728
selectedIcon = Assets.icons.check,
2829
selectedIconColor = Colors.primary,
@@ -72,7 +73,7 @@ const PickerItem = props => {
7273
const _renderItem = () => {
7374
return (
7475
<View style={styles.container} flex row spread centerV>
75-
<Text numberOfLines={1} style={[styles.labelText, isItemDisabled && styles.labelTextDisabled]}>
76+
<Text numberOfLines={1} style={[styles.labelText, isItemDisabled && styles.labelTextDisabled, labelStyle]}>
7677
{itemLabel}
7778
</Text>
7879
{selectedIndicator}
@@ -123,6 +124,10 @@ PickerItem.propTypes = {
123124
* Item's label
124125
*/
125126
label: PropTypes.string,
127+
/**
128+
* Item's label style
129+
*/
130+
labelStyle: RNText.propTypes.style,
126131
/**
127132
* Custom function for the item label (e.g (value) => customLabel)
128133
*/

0 commit comments

Comments
 (0)