Skip to content

React Native: Support shuffle questions and shuffle options in surveys #3162

@adboio

Description

@adboio

🚨 IMPORTANT

This issue is likely user-facing in the main PostHog app, see surveyVersionRequirements.ts. If you delete or close this issue, be sure to update the version requirements list here.

Summary

The posthog-react-native SDK does not support shuffling questions or shuffling choice options in surveys. Both features have explicit // TODO comments with commented-out implementation code in packages/react-native/src/surveys/surveys-utils.ts.

Current State

  • getDisplayOrderQuestions() has // TODO: shuffle questions and returns unshuffled questions
  • getDisplayOrderChoices() has // TODO: shuffle choices and returns unshuffled choices
  • The commented-out code shows the intended implementation pattern

Expected Behavior

  • When survey.appearance.shuffleQuestions is true, questions should be presented in a randomized order (unless enable_partial_responses is true)
  • When question.shuffleOptions is true on a choice question, the choices should be randomized (keeping open-ended choice at end)

Reference Implementation

See posthog-js browser: packages/browser/src/extensions/surveys/surveys-extension-utils.tsx

  • getDisplayOrderQuestions() for question shuffling
  • getDisplayOrderChoices() for option shuffling

Tracking

This is tracked in the survey SDK feature parity issue: PostHog/posthog#45658

This issue was generated by Claude using the /survey-sdk-audit skill.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions