Skip to content

Feat/picker item label style #1332

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

Merged
merged 3 commits into from
Jun 6, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
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
4 changes: 2 additions & 2 deletions demo/src/screens/componentScreens/PickerScreen.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import _ from 'lodash';
import React, {Component} from 'react';
import {ScrollView, Image} from 'react-native';
import {View, Colors, Dialog, Text, Picker, Avatar, Assets, PanningProvider} from 'react-native-ui-lib'; //eslint-disable-line
import {View, Colors, Dialog, Text, Picker, Avatar, Assets, PanningProvider, Typography} from 'react-native-ui-lib'; //eslint-disable-line
import contactsData from '../../data/conversations';
import tagIcon from '../../assets/icons/tags.png';
import dropdown from '../../assets/icons/chevronDown.png';
Expand Down Expand Up @@ -162,7 +162,7 @@ export default class PickerScreen extends Component {
renderCustomModal={this.renderDialog}
>
{_.map(options, option => (
<Picker.Item key={option.value} value={option} label={option.label} disabled={option.disabled}/>
<Picker.Item key={option.value} value={option} label={option.label} labelStyle={Typography.text65} disabled={option.disabled}/>
))}
</Picker>

Expand Down
9 changes: 7 additions & 2 deletions src/components/picker/PickerItem.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import _ from 'lodash';
import PropTypes from 'prop-types';
import React, {useCallback, useEffect, useMemo, useContext} from 'react';
import {StyleSheet} from 'react-native';
import {StyleSheet, Text as RNText} from 'react-native';
import {LogService} from '../../services';
import {Colors, Typography} from '../../style';
import * as Modifiers from '../../commons/modifiers';
Expand All @@ -23,6 +23,7 @@ const PickerItem = props => {
const {
value,
label,
labelStyle,
disabled,
selectedIcon = Assets.icons.check,
selectedIconColor = Colors.primary,
Expand Down Expand Up @@ -72,7 +73,7 @@ const PickerItem = props => {
const _renderItem = () => {
return (
<View style={styles.container} flex row spread centerV>
<Text numberOfLines={1} style={[styles.labelText, isItemDisabled && styles.labelTextDisabled]}>
<Text numberOfLines={1} style={[styles.labelText, isItemDisabled && styles.labelTextDisabled, labelStyle]}>
{itemLabel}
</Text>
{selectedIndicator}
Expand Down Expand Up @@ -123,6 +124,10 @@ PickerItem.propTypes = {
* Item's label
*/
label: PropTypes.string,
/**
* Item's label style
*/
labelStyle: RNText.propTypes.style,
/**
* Custom function for the item label (e.g (value) => customLabel)
*/
Expand Down