-
Notifications
You must be signed in to change notification settings - Fork 46
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add KeyboardAvoidingView to SurveyModal #405
base: feat/surveys
Are you sure you want to change the base?
Add KeyboardAvoidingView to SurveyModal #405
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR Summary
This PR addresses keyboard interaction and survey filtering issues in the React Native survey implementation, focusing on modal visibility and survey activation state.
- Added
KeyboardAvoidingView
in/posthog-react-native/src/surveys/components/SurveyModal.tsx
to prevent keyboard from obscuring text input fields - Modified
useFeedbackSurvey
hook in/posthog-react-native/src/surveys/PostHogSurveyProvider.tsx
to filter for active surveys usingstart_date
andend_date
checks - Adjusted modal layout with proper margin handling between backdrop and content for better keyboard interaction
- Improved survey visibility by using
statusBarTranslucent={true}
for full-screen modal display
💡 (2/5) Greptile learns from your feedback when you react with 👍/👎!
2 file(s) reviewed, 1 comment(s)
Edit PR Review Bot Settings | Greptile
<View style={styles.topIconContainer}> | ||
<Cancel onPress={onClose} appearance={appearance} /> | ||
<Pressable style={[styles.modalBackdrop]} onPress={onClose} accessible={false}> | ||
<KeyboardAvoidingView behavior={'padding'} style={{ marginBottom: insets.bottom + 10, marginHorizontal: 10 }}> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
style: Consider platform-specific behavior - Android may need 'height' instead of 'padding'
<KeyboardAvoidingView behavior={'padding'} style={{ marginBottom: insets.bottom + 10, marginHorizontal: 10 }}> | |
<KeyboardAvoidingView behavior={Platform.OS === 'ios' ? 'padding' : 'height'} style={{ marginBottom: insets.bottom + 10, marginHorizontal: 10 }}> |
survey.start_date !== null && | ||
survey.end_date === null |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should call getActiveMatchingSurveys
instead, passing context?.surveys
.
Since the survey should only be shown in certain conditions, and this is a subset of it but, everything should apply right, even if you call useFeedbackSurvey
yourself.
Pulling over a couple of bug fixes from my fork:
useFeedbackSurvey
hook was returning surveys which were not launched/enabled in PostHog#110