Skip to content

Commit

Permalink
chore: remove keyboard on press
Browse files Browse the repository at this point in the history
  • Loading branch information
joseph-mccombs committed Nov 23, 2020
1 parent 6014a48 commit 1c15121
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 56 deletions.
108 changes: 53 additions & 55 deletions components/FormikFields/PaperInputPicker/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as React from 'react';
import {
View, Text, StyleSheet, TouchableWithoutFeedback, Keyboard
View, Text, StyleSheet
} from 'react-native';
import {
TextInput, Button, Headline
Expand Down Expand Up @@ -131,68 +131,66 @@ const PaperInputPicker = ({
</View>
)}
{fieldType === 'select' && (
<TouchableWithoutFeedback onPress={Keyboard.dismiss} accessible={false}>
<View>
<Text style={layout.selectLabel}>{translatedLabel}</Text>
<View style={layout.buttonGroupContainer}>
{data.options.map((result) => (
<View key={result.value}>
{/* selected value */}
{result.value === values[formikKey] && (
<View>
<Button
style={layout.buttonGroupButtonStyle}
key={result.value}
mode="contained"
onPress={() => setFieldValue(formikKey, result.value)}
>
<Text style={{ color: 'white' }}>{customForm ? result.label : I18n.t(result.label)}</Text>
</Button>
</View>
)}
{/* non-selected value */}
{result.value !== values[formikKey] && (
<View style={styles}>
<Button
style={layout.buttonGroupButtonStyle}
key={result.value}
mode="outlined"
onPress={() => setFieldValue(formikKey, result.value)}
>
<Text style={{ color: theme.colors.primary }}>
{customForm ? result.label : I18n.t(result.label)}
</Text>
</Button>
</View>
)}
</View>
))}
</View>
{/* text input option along with select option */}
<View>
<Text style={layout.selectLabel}>{translatedLabel}</Text>
<View style={layout.buttonGroupContainer}>
{data.options.map((result) => (
<View key={result.value}>
{result.text === true && result.value === values[formikKey] && (
<View style={styles} key={result.textKey}>
<TextInput
label={customForm ? result.label : I18n.t(result.label)}
onChangeText={handleChange(result.textKey)}
onBlur={handleBlur(result.textKey)}
{...rest} //eslint-disable-line
{/* selected value */}
{result.value === values[formikKey] && (
<View>
<Button
style={layout.buttonGroupButtonStyle}
key={result.value}
mode="contained"
onPress={() => setFieldValue(formikKey, result.value)}
>
<Text style={{ color: 'white' }}>{customForm ? result.label : I18n.t(result.label)}</Text>
</Button>
</View>
)}
{/* non-selected value */}
{result.value !== values[formikKey] && (
<View style={styles}>
<Button
style={layout.buttonGroupButtonStyle}
key={result.value}
mode="outlined"
theme={{ colors: { placeholder: theme.colors.primary }, text: 'black' }}
/>
<Text style={{ color: 'red' }}>
{errors[result.textKey]}
</Text>
onPress={() => setFieldValue(formikKey, result.value)}
>
<Text style={{ color: theme.colors.primary }}>
{customForm ? result.label : I18n.t(result.label)}
</Text>
</Button>
</View>
)}
</View>
))}
<Text style={{ color: 'red' }}>
{errors[formikKey]}
</Text>
</View>
</TouchableWithoutFeedback>
{/* text input option along with select option */}
{data.options.map((result) => (
<View key={result.value}>
{result.text === true && result.value === values[formikKey] && (
<View style={styles} key={result.textKey}>
<TextInput
label={customForm ? result.label : I18n.t(result.label)}
onChangeText={handleChange(result.textKey)}
onBlur={handleBlur(result.textKey)}
{...rest} //eslint-disable-line
mode="outlined"
theme={{ colors: { placeholder: theme.colors.primary }, text: 'black' }}
/>
<Text style={{ color: 'red' }}>
{errors[result.textKey]}
</Text>
</View>
)}
</View>
))}
<Text style={{ color: 'red' }}>
{errors[formikKey]}
</Text>
</View>
)}
{fieldType === 'selectMulti' && (
<View>
Expand Down
2 changes: 1 addition & 1 deletion domains/DataCollection/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ const DataCollection = ({ navigation }) => {
behavior={Platform.OS === 'ios' ? 'padding' : 'height'}
style={{ flex: 1 }}
>
<ScrollView keyboardShouldPersistTaps="always" scrollEnabled={scrollViewScroll}>
<ScrollView keyboardShouldPersistTaps="never" scrollEnabled={scrollViewScroll}>
{view === 'Root'
&& (
<View>
Expand Down

0 comments on commit 1c15121

Please sign in to comment.