Skip to content

Commit

Permalink
Merge pull request #754 from frankemax/751-feedback
Browse files Browse the repository at this point in the history
fix(feedback-screen): close keyboard when click outside
  • Loading branch information
frankemax authored Apr 18, 2024
2 parents 5878505 + 53d9e95 commit 8af0447
Show file tree
Hide file tree
Showing 3 changed files with 72 additions and 67 deletions.
2 changes: 1 addition & 1 deletion ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -688,4 +688,4 @@ SPEC CHECKSUMS:

PODFILE CHECKSUM: 2150a475300a6ab8ed132d21f86d021d893dd86c

COCOAPODS: 1.11.3
COCOAPODS: 1.15.2
55 changes: 28 additions & 27 deletions src/screens/feedback-screen/problem-feedback-screen/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -199,14 +199,10 @@ const ProblemFeedbackScreen = ({ route }) => {

return (
<TouchableWithoutFeedback onPress={Keyboard.dismiss} accessible={false}>
<KeyboardAvoidingView
behavior={Platform.OS === 'ios' ? 'padding' : 'height'}
>
<Styled.ContainerView>
<Styled.Title>{questionTitle}</Styled.Title>

<Styled.OptionsContainer>
{
<Styled.ContainerView>
<Styled.Title>{questionTitle}</Styled.Title>
<Styled.OptionsContainer>
{
feedbackOptions.map((option) => {
return (
<Styled.CheckContainerItem key={option.code}>
Expand All @@ -220,8 +216,12 @@ const ProblemFeedbackScreen = ({ route }) => {
);
})
}
</Styled.OptionsContainer>
</Styled.OptionsContainer>

<KeyboardAvoidingView
style={{ width: '100%' }}
behavior={Platform.OS === 'ios' ? 'padding' : 'height'}
>
<Styled.TextInputOther
onFocus={() => checkOption('other')}
multiline
Expand All @@ -230,25 +230,26 @@ const ProblemFeedbackScreen = ({ route }) => {
setStepDetalied(newText);
}}
/>
</KeyboardAvoidingView>

<Styled.ButtonContainer>
<Styled.ConfirmButton
disabled={!activateSendProblem()}
onPress={handleSendProblem}
>
{t('app.customFeedback.defaultButtons.next')}
</Styled.ConfirmButton>
</Styled.ButtonContainer>

<Styled.QuitSessionButtonContainer>
<Styled.QuitSessionButton
onPress={handleSkip}
>
{skipButton}
</Styled.QuitSessionButton>
</Styled.QuitSessionButtonContainer>
</Styled.ContainerView>

<Styled.ButtonContainer>
<Styled.ConfirmButton
disabled={!activateSendProblem()}
onPress={handleSendProblem}
>
{t('app.customFeedback.defaultButtons.next')}
</Styled.ConfirmButton>
</Styled.ButtonContainer>

<Styled.QuitSessionButtonContainer>
<Styled.QuitSessionButton
onPress={handleSkip}
>
{skipButton}
</Styled.QuitSessionButton>
</Styled.QuitSessionButtonContainer>
</Styled.ContainerView>
</KeyboardAvoidingView>
</TouchableWithoutFeedback>
);
};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import React, { useCallback, useState } from 'react';
import { BackHandler, KeyboardAvoidingView, Platform } from 'react-native';
import {
BackHandler, KeyboardAvoidingView, Platform, TouchableWithoutFeedback, Keyboard
} from 'react-native';
import { useFocusEffect, useNavigation } from '@react-navigation/native';
import { useHeaderHeight } from '@react-navigation/elements';
import { useTranslation } from 'react-i18next';
Expand Down Expand Up @@ -203,45 +205,47 @@ const SpecificProblemFeedbackScreen = ({ route }) => {
};

return (
<Styled.ContainerView>
<Styled.Title>{questionTitle}</Styled.Title>

<Styled.OptionsContainer>
{renderOptions()}
</Styled.OptionsContainer>

<KeyboardAvoidingView
behavior={Platform.OS === 'ios' ? 'padding' : 'height'}
keyboardVerticalOffset={height + 100}
style={{ width: '100%' }}
>
<Styled.TextInputOther
onFocus={() => checkOption('other')}
multiline
value={stepDetalied}
onChangeText={(newText) => {
setStepDetalied(newText);
}}
/>
</KeyboardAvoidingView>

<Styled.ButtonContainer>
<Styled.ConfirmButton
disabled={!activateSendProblem()}
onPress={handleSendProblem}
<TouchableWithoutFeedback onPress={Keyboard.dismiss} accessible={false}>
<Styled.ContainerView>
<Styled.Title>{questionTitle}</Styled.Title>

<Styled.OptionsContainer>
{renderOptions()}
</Styled.OptionsContainer>

<KeyboardAvoidingView
behavior={Platform.OS === 'ios' ? 'padding' : 'height'}
keyboardVerticalOffset={height + 100}
style={{ width: '100%' }}
>
{t('app.customFeedback.defaultButtons.next')}
</Styled.ConfirmButton>
</Styled.ButtonContainer>

<Styled.QuitSessionButtonContainer>
<Styled.QuitSessionButton
onPress={handleSkip}
>
{skipButton}
</Styled.QuitSessionButton>
</Styled.QuitSessionButtonContainer>
</Styled.ContainerView>
<Styled.TextInputOther
onFocus={() => checkOption('other')}
multiline
value={stepDetalied}
onChangeText={(newText) => {
setStepDetalied(newText);
}}
/>
</KeyboardAvoidingView>

<Styled.ButtonContainer>
<Styled.ConfirmButton
disabled={!activateSendProblem()}
onPress={handleSendProblem}
>
{t('app.customFeedback.defaultButtons.next')}
</Styled.ConfirmButton>
</Styled.ButtonContainer>

<Styled.QuitSessionButtonContainer>
<Styled.QuitSessionButton
onPress={handleSkip}
>
{skipButton}
</Styled.QuitSessionButton>
</Styled.QuitSessionButtonContainer>
</Styled.ContainerView>
</TouchableWithoutFeedback>
);
};

Expand Down

0 comments on commit 8af0447

Please sign in to comment.