Skip to content

Commit f4f01ab

Browse files
author
danish1658
committed
Keyboard Dismiss before dropdown opening
1 parent 8cf4ea3 commit f4f01ab

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

components/MultipleSelectList.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@ import {
99
Animated,
1010
TextInput,
1111
ViewStyle,
12-
Pressable} from 'react-native';
12+
Pressable,
13+
Keyboard
14+
} from 'react-native';
1315

1416
import { MultipleSelectListProps } from '..';
1517

@@ -167,7 +169,7 @@ const MultipleSelectList: React.FC<MultipleSelectListProps> = ({
167169
(selectedval?.length > 0 )
168170

169171
?
170-
<TouchableOpacity style={[styles.wrapper,boxStyles]} onPress={() => { if(!dropdown){ slidedown() }else{ slideup() } }} >
172+
<TouchableOpacity style={[styles.wrapper,boxStyles]} onPress={() => { if(!dropdown){ Keyboard.dismiss(); slidedown() }else{ slideup() } }} >
171173
<View>
172174
<Text style={[{fontWeight:'600',fontFamily},labelStyles]}>{ label }</Text>
173175
<View style={{flexDirection:'row',marginBottom:8,flexWrap:'wrap'}}>
@@ -184,7 +186,7 @@ const MultipleSelectList: React.FC<MultipleSelectListProps> = ({
184186
</View>
185187
</TouchableOpacity>
186188
:
187-
<TouchableOpacity style={[styles.wrapper,boxStyles]} onPress={() => { if(!dropdown){ slidedown() }else{ slideup() } }}>
189+
<TouchableOpacity style={[styles.wrapper,boxStyles]} onPress={() => { if(!dropdown){ Keyboard.dismiss(); slidedown() }else{ slideup() } }}>
188190
<Text style={[{fontFamily},inputStyles]}>{ (selectedval == "") ? (placeholder) ? placeholder : 'Select option' : selectedval }</Text>
189191
{
190192
(!arrowicon)

components/SelectList.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import {
88
ScrollView,
99
Animated,
1010
TextInput,
11+
Keyboard
1112
} from 'react-native';
1213

1314
import { SelectListProps } from '..';
@@ -168,7 +169,7 @@ const SelectList: React.FC<SelectListProps> = ({
168169

169170
</View>
170171
:
171-
<TouchableOpacity style={[styles.wrapper,boxStyles]} onPress={() => { if(!dropdown){ slidedown() }else{ slideup() } }}>
172+
<TouchableOpacity style={[styles.wrapper,boxStyles]} onPress={() => { if(!dropdown){ Keyboard.dismiss(); slidedown() }else{ slideup() } }}>
172173
<Text style={[{fontFamily},inputStyles]}>{ (selectedval == "") ? (placeholder) ? placeholder : 'Select option' : selectedval }</Text>
173174
{
174175
(!arrowicon)

0 commit comments

Comments
 (0)