Skip to content

Commit f24e2a1

Browse files
authored
Merge pull request hossein-zare#503 from TommysG/dev-5.x
feat: Added badgeProps to picker
2 parents 274ccdd + 81b34c4 commit f24e2a1

File tree

3 files changed

+6
-1
lines changed

3 files changed

+6
-1
lines changed

index.d.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ declare module 'react-native-dropdown-picker' {
7878
export interface RenderBadgeItemPropsInterface {
7979
label: string;
8080
value: ValueType;
81+
props: TouchableOpacityProps,
8182
IconComponent: () => JSX.Element;
8283
textStyle: StyleProp<TextStyle>;
8384
badgeStyle: StyleProp<ViewStyle>;
@@ -230,6 +231,7 @@ declare module 'react-native-dropdown-picker' {
230231
activityIndicatorColor?: string;
231232
props?: TouchableOpacityProps;
232233
itemProps?: TouchableOpacityProps;
234+
badgeProps?: TouchableOpacityProps;
233235
modalProps?: ModalProps;
234236
flatListProps?: Partial<FlatListProps<ItemType>>;
235237
scrollViewProps?: ScrollViewProps;

src/components/Picker.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ function Picker({
128128
activityIndicatorColor = Colors.GREY,
129129
props = {},
130130
itemProps = {},
131+
badgeProps= {},
131132
modalProps = {},
132133
flatListProps = {},
133134
scrollViewProps = {},
@@ -957,6 +958,7 @@ function Picker({
957958
*/
958959
const __renderBadge = useCallback(({item}) => (
959960
<RenderBadgeComponent
961+
props={badgeProps}
960962
rtl={rtl}
961963
label={item[_schema.label]}
962964
value={item[_schema.value]}

src/components/RenderBadgeItem.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import { RTL_DIRECTION, RTL_STYLE } from '../constants';
1313
function RenderBadge({
1414
rtl,
1515
label,
16+
props,
1617
value,
1718
textStyle,
1819
badgeStyle,
@@ -61,7 +62,7 @@ function RenderBadge({
6162
]), [textStyle, badgeTextStyle]);
6263

6364
return (
64-
<TouchableOpacity style={_badgeStyle} onPress={__onPress}>
65+
<TouchableOpacity style={_badgeStyle} {...props} onPress={__onPress}>
6566
{showBadgeDot && <View style={_badgeDotStyle} />}
6667
<Text style={_badgeTextStyle}>{label}</Text>
6768
</TouchableOpacity>

0 commit comments

Comments
 (0)