react-native-select-dropdown
Advanced tools
Comparing version 3.0.3 to 3.1.0
@@ -43,2 +43,6 @@ import type * as React from "react"; | ||
/** | ||
* disable click all Rows index in the list | ||
*/ | ||
disabledIndexs?: number[]; | ||
/** | ||
* function fires when dropdown is opened | ||
@@ -102,3 +106,3 @@ */ | ||
*/ | ||
renderCustomizedRowChild?: (selectedItem: any, index: number) => React.ReactNode; | ||
renderCustomizedRowChild?: (selectedItem: any, index: number, isSelected?: boolean) => React.ReactNode; | ||
/** | ||
@@ -105,0 +109,0 @@ * enable search functionality |
{ | ||
"name": "react-native-select-dropdown", | ||
"version": "3.0.3", | ||
"version": "3.1.0", | ||
"description": "react-native-select-dropdown is a highly customized dropdown | select | picker | menu for react native that works for andriod and iOS platforms.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
# react-native-select-dropdown | ||
react-native-select-dropdown is a highly customized dropdown | select | picker | menu for react native that works for andriod and iOS platforms. | ||
react-native-select-dropdown is a highly customized dropdown | select | picker | menu for react native that works for android and iOS platforms. | ||
@@ -79,2 +79,4 @@ ## Installation | ||
- [`disabledIndexs`](#disabledIndexs) | ||
- [`onFocus`](#onFocus) | ||
@@ -229,2 +231,12 @@ | ||
### disabledIndexs | ||
disable choose all Rows index in the list | ||
| Type | Required | | ||
| ----- | -------- | | ||
| array | No | | ||
--- | ||
### onFocus | ||
@@ -231,0 +243,0 @@ |
@@ -47,2 +47,6 @@ import {useEffect, useState, useMemo} from 'react'; | ||
return { | ||
...{ | ||
borderTopWidth: 0, | ||
overflow: 'hidden', | ||
}, | ||
...dropdownStyle, | ||
@@ -54,4 +58,2 @@ ...{ | ||
width: dropdownWIDTH, | ||
borderTopWidth: 0, | ||
overflow: 'hidden', | ||
}, | ||
@@ -58,0 +60,0 @@ ...(I18nManager.isRTL ? {right: dropdownStyle?.right || dropdownPX} : {left: dropdownStyle?.left || dropdownPX}), |
@@ -24,2 +24,3 @@ import React, {forwardRef, useImperativeHandle} from 'react'; | ||
disableAutoScroll /* boolean */, | ||
disabledIndexs /* array of disabled Row index */, | ||
onFocus /* function */, | ||
@@ -141,10 +142,12 @@ onBlur /* function */, | ||
const renderFlatlistItem = ({item, index}) => { | ||
const isSelected = index == selectedIndex; | ||
return ( | ||
isExist(item) && ( | ||
<TouchableOpacity | ||
disabled={disabledIndexs?.includes(index)} | ||
activeOpacity={0.8} | ||
style={{...styles.dropdownRow, ...rowStyle, ...(index == selectedIndex && selectedRowStyle)}} | ||
style={{...styles.dropdownRow, ...rowStyle, ...(isSelected && selectedRowStyle)}} | ||
onPress={() => onSelectItem(item, index)}> | ||
{renderCustomizedRowChild ? ( | ||
<View style={styles.dropdownCustomizedRowParent}>{renderCustomizedRowChild(item, index)}</View> | ||
<View style={styles.dropdownCustomizedRowParent}>{renderCustomizedRowChild(item, index, isSelected)}</View> | ||
) : ( | ||
@@ -154,3 +157,3 @@ <Text | ||
allowFontScaling={false} | ||
style={{...styles.dropdownRowText, ...rowTextStyle, ...(index == selectedIndex && selectedRowTextStyle)}}> | ||
style={{...styles.dropdownRowText, ...rowTextStyle, ...(isSelected && selectedRowTextStyle)}}> | ||
{rowTextForSelection ? rowTextForSelection(item, index) : item.toString()} | ||
@@ -157,0 +160,0 @@ </Text> |
38296
832
506