Repository navigation
feat(react-native): add $react_native_version to captured events - #5206
Conversation
Reads Platform.constants.reactNativeVersion so we can see which React Native versions SDK users run before choosing support floors.
|
[Medium risk] Adds React Native version to event properties. The PR appears safe to merge; no new actionable issue remains. Reviews (2) · Last reviewed commit: "chore(react-native): regenerate referenc..." |
…rsion to JS events
|
Size Change: +1.09 kB (0%) Total Size: 23.5 MB 📦 View Changed
ℹ️ View Unchanged
|
Node SDK compliance v2Commit: f2c8870 Capture v0✅ 55 passed / ❌ 1 non-passing / Drill-down: run artifacts → ❌ migration:yaml-parity-v1:feature_flags:disable_geoip_omitted_defaults_to_false — failed_assertionFlags field differs Code: Failed step: migration/yaml-parity-v1/remote-flags-v1.feature:143 the first flags request field "geoip_disable" should equal JSON false Operation: Field: Expected: false Actual value: true Harness exit: 1; report validation exit: 1. Capture v1✅ 120 passed / ❌ 1 non-passing / Drill-down: run artifacts → ❌ migration:yaml-parity-v1:feature_flags:disable_geoip_omitted_defaults_to_false — failed_assertionFlags field differs Code: Failed step: migration/yaml-parity-v1/remote-flags-v1.feature:143 the first flags request field "geoip_disable" should equal JSON false Operation: Field: Expected: false Actual value: true Harness exit: 1; report validation exit: 1. |
posthog-js Compliance ReportDate: 2026-10-05 16:59:45 UTC ✅ All Tests Passed!26/26 tests passed Capture Tests✅ 26/26 tests passed View Details
|
Problem
We can't tell which React Native versions posthog-react-native users run. Events carry
$lib_version, OS, app and device fields, but no RN version. That leaves support-floor decisions to guesswork, such as the RN 0.71 floor in #5194 and how far back to fix the@posthog/core/surveysresolution failure on RN 0.70–0.78.Changes
$react_native_versionproperty on events captured from JavaScript, for example0.79.6, or0.80.0-rc.2for prereleases. It is read once fromPlatform.constants.reactNativeVersionalong with the other app properties (getAppProperties).0.79.4), so major.minor matches upstream RN but the patch number doesn't. Split by$os_namewhen comparing patch versions.$feature_flag_calledevents: added toMINIMAL_FLAG_CALLED_EVENT_PROPERTIESin@posthog/core(patch changeset), per the sdk-specs feature-flag-called-tracker rule that static runtime-identity properties survive minimization.$os_name,$os_version, …) that the spec's "static platform/runtime identity" category covers.PostHogCustomAppProperties, socustomAppPropertiescan change or remove it like the other app properties.$unity_version, which posthog-unity already sends on exception events. No sdk-specs spec covers default event properties.Release info Sub-libraries affected
Libraries affected
Checklist
test/react-native-version.spec.ts: version format, prerelease, missing or malformed value, throwing lookup, sent on JS events, omitted when absent)Platform.constants; web doesn't, so the property is left out)If releasing new changes
pnpm changesetto generate a changeset file🤖 Agent context
Autonomy: Human-driven (agent-assisted)
Written with Claude Code while reviewing the RN version floor for
@posthog/react-native-plugin3.0 (#5194), where we had no data on which RN versions are in use.Checks run: posthog-react-native unit tests (72 files, 1238 tests),
@posthog/coreunit tests (2075 passed), posthog-node unit tests (1105) and the browser feature-flag tests (285),check-types, lint andoxfmt. The new "sent with every event" test fails when thegetAppPropertieschange is reverted. On an RN 0.70.15 Android emulator,Platform.constants.reactNativeVersionreported{"major":0,"minor":70,"patch":15,"prerelease":null}, which is the shape this formats. This exact build was not run on a device.🤖 Generated with Claude Code