Skip to content

Commit 6b0aabf

Browse files
authored
fix: React Native on web should report hardware type as Desktop or Mobile, not Web. (#2769)
1 parent 3462c10 commit 6b0aabf

File tree

16 files changed

+395
-381
lines changed

16 files changed

+395
-381
lines changed

.changeset/clear-flowers-itch.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'posthog-react-native': patch
3+
---
4+
5+
fix: React Native on web should report hardware type as Desktop or Mobile, not Web

.changeset/polite-towns-march.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@posthog/core': patch
3+
---
4+
5+
chore: move the user-agent-utils from the browser to the core package

examples/example-expo-53/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ Or...
3232
```bash
3333
npx expo run:ios
3434
npx expo run:android
35+
npx expo start --web
3536
```
3637

3738
If your RN SDK changes are not picked up:

examples/example-expo-53/pnpm-lock.yaml

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/browser/src/__tests__/utils.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import { expect } from '@jest/globals'
1313

1414
import { _base64Encode } from '../utils/encode-utils'
1515
import { getPersonPropertiesHash, propertyComparisons } from '../utils/property-utils'
16-
import { detectDeviceType } from '../utils/user-agent-utils'
16+
import { detectDeviceType } from '@posthog/core'
1717
import { getEventProperties } from '../utils/event-utils'
1818

1919
function userAgentFor(botString: string) {

packages/browser/src/__tests__/utils/user-agent-utils.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import uaParserDeviceTestCases from './device.test.json'
22
import { isUndefined } from '@posthog/core'
33
import uaParserOSTestCases from './os-test.json'
4-
import { detectBrowser, detectBrowserVersion, detectDeviceType, detectOS } from '../../utils/user-agent-utils'
4+
import { detectBrowser, detectBrowserVersion, detectDeviceType, detectOS } from '@posthog/core'
55

66
describe('user-agent-utils', () => {
77
describe('user agent', () => {

packages/browser/src/extensions/surveys/surveys-extension-utils.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import {
2222
} from '../../utils/survey-utils'
2323
import { isArray, isNullish } from '@posthog/core'
2424

25-
import { detectDeviceType } from '../../utils/user-agent-utils'
25+
import { detectDeviceType } from '@posthog/core'
2626
import { propertyComparisons } from '../../utils/property-utils'
2727
import { PropertyMatchType } from '../../types'
2828
import { prepareStylesheet } from '../utils/stylesheet-loader'

packages/browser/src/utils/event-utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { Properties } from '../types'
44
import Config from '../config'
55
import { each, extend, extendArray, stripEmptyProperties } from './index'
66
import { document, location, userAgent, window } from './globals'
7-
import { detectBrowser, detectBrowserVersion, detectDevice, detectDeviceType, detectOS } from './user-agent-utils'
7+
import { detectBrowser, detectBrowserVersion, detectDevice, detectDeviceType, detectOS } from '@posthog/core'
88
import { cookieStore } from '../storage'
99

1010
const URL_REGEX_PREFIX = 'https?://(.*)'

0 commit comments

Comments
 (0)