fix(react-native): flip Android survey keyboard default to padding, restore wait-period gating#3633
Draft
posthog[bot] wants to merge 2 commits into
Draft
fix(react-native): flip Android survey keyboard default to padding, restore wait-period gating#3633posthog[bot] wants to merge 2 commits into
posthog[bot] wants to merge 2 commits into
Conversation
…estore wait-period gating Three small, surgical fixes addressing Zendesk #58005 (Zoop Live RN survey reports): - SurveyModal.tsx / PostHogSurveyProvider.tsx: change the default `androidKeyboardBehavior` from `'height'` to `'padding'`. The legacy `'height'` behavior thrashes the modal layout on every keyboardWillShow/keyboardDidShow event and produces the flicker pattern users described as the modal "fluttering between the middle and bottom of the screen". The 8fd7c76 fix already shipped `'padding'` as an opt-in; this changes the default so the typical install picks up the working behavior automatically. Users who explicitly opted into `'height'` are unaffected. - PostHogSurveyProvider.tsx: key `SurveyModal` by `activeContext.survey.id` so a fresh `activeContext` memo reference cannot accidentally remount the modal mid-flow (one of the suspected paths behind the "modal vanishes mid-answer with no submission" report). - getActiveMatchingSurveys.ts: restore the `seenSurveyWaitPeriodInDays` block that has been commented out since the cc68676 migration. The React Native SDK was silently ignoring the wait-period condition while Web/iOS/Android/Flutter honor it. The function now takes an optional `lastSeenSurveyDate` argument (backwards compatible - all existing 4-arg callers and tests continue to work). Provider wires the value from `useSurveyStorage`, which already persists it. - posthog-core.ts: remove the `@deprecated` tag on `renderSurvey`. The method is a perfectly fine narrow inline-rendering entry point; marking it deprecated steered users toward `displaySurvey` even when inline-without-conditions was the right tool. Docstring now points to `displaySurvey` for the broader/popover case without flagging `renderSurvey` as going away. Tests: - New `getNextSurveyStep` regression locking in the open-rating two-question advance-then-End traversal. - New `getActiveMatchingSurveys` regressions for the wait-period gating (inside/outside window, undefined lastSeenSurveyDate, no wait-period condition). Generated-By: PostHog Code Task-Id: 4bf1d321-914f-422e-a0b5-7fd4df626960
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
|
Contributor
Contributor
|
Size Change: +493 B (0%) Total Size: 16 MB
ℹ️ View Unchanged
|
…tier; add changeset Lint failure on the previous commit was a prettier line-length error on the SurveyModal props destructure — adding the `androidKeyboardBehavior = 'padding'` default pushed the line over the 120-char limit. Wraps the destructure across multiple lines per the autofixer. Also adds a changeset for `posthog-react-native` covering the flicker default, the restored `seenSurveyWaitPeriodInDays` gating, and the `SurveyModal` keying — all user-visible behavior changes that should land in the next release notes. Generated-By: PostHog Code Task-Id: 4bf1d321-914f-422e-a0b5-7fd4df626960
Contributor
|
This PR hasn't seen activity in a week! Should it be merged, closed, or further worked on? If you want to keep it open, post a comment or remove the |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes three concurrent React Native survey bugs reported by Zoop Live (Zendesk #58005) and an adjacent posthog-js docstring nit, all on the surveys surface:
androidKeyboardBehavior='height'default thrashes the modal layout on every keyboard event, producing the "popup fluttering between the middle and bottom of the screen" behavior users hit. The'padding'option already exists (added in 8fd7c76) but was opt-in; this PR flips the default so the typical install gets the working behavior automatically. Users who explicitly passed'height'are unaffected.SurveyModalis now keyed byactiveContext.survey.idinPostHogSurveyProvider, so a freshactiveContextmemo object can never cause an unexpected remount mid-answer (one of the suspected paths behind the "modal vanishes with no submission" report).seenSurveyWaitPeriodInDaysnot honored on RN — the wait-period gating block ingetActiveMatchingSurveyshas been commented out since the cc68676 lite migration, while Web/iOS/Android/Flutter all honor it. Restored, plumbedlastSeenSurveyDatethrough fromuseSurveyStorage(already persisted), and added regression tests. The newlastSeenSurveyDateparameter is optional so existing 4-arg callers and tests continue to work.renderSurveyno longer marked@deprecated— it is a perfectly fine narrow inline-rendering entry point; the@deprecatedtag was steering users towarddisplaySurveyeven when inline-without-conditions was the right tool. The docstring now points users todisplaySurveyfor the broader/popover case without flaggingrenderSurveyas going away.What this does NOT do
document.querySelector→querySelectorAllchange called out in the signal report is a meaningfully larger refactor (listener-tracking maps key on a single element) and is left for a follow-up.'padding'should remove the layout thrash on its own without needing it.Test plan
pnpm test:unitinpackages/react-native— full survey suite (120 tests) passes, including the newopen → rating → Endtraversal regression ingetNextSurveyStep.spec.tsand the new wait-period gating regressions ingetActiveMatchingSurveys.spec.ts.pnpm typecheckinpackages/browser— clean.tsc --noEmitinpackages/react-native— clean (afterprebuildgeneratesversion.ts).survey sentevent fires with both responses.seenSurveyWaitPeriodInDays = 7, see one, dismiss, confirm it is suppressed for the wait window and re-eligible after.Created with PostHog Code