-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: React Native for macOS support
- Loading branch information
1 parent
7000825
commit 06fb643
Showing
8 changed files
with
35 additions
and
9 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,11 @@ | ||
import type ExpoApplication from 'expo-application' | ||
import { Platform } from 'react-native' | ||
|
||
export let OptionalExpoApplication: typeof ExpoApplication | undefined = undefined | ||
|
||
try { | ||
OptionalExpoApplication = require('expo-application') | ||
// macos not supported | ||
if (Platform.OS !== 'macos') { | ||
OptionalExpoApplication = require('expo-application') | ||
} | ||
} catch (e) {} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,11 @@ | ||
import type ExpoDevice from 'expo-device' | ||
import { Platform } from 'react-native' | ||
|
||
export let OptionalExpoDevice: typeof ExpoDevice | undefined = undefined | ||
|
||
try { | ||
OptionalExpoDevice = require('expo-device') | ||
// macos not supported | ||
if (Platform.OS !== 'macos') { | ||
OptionalExpoDevice = require('expo-device') | ||
} | ||
} catch (e) {} |
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,11 @@ | ||
import type ExpoLocalization from 'expo-localization' | ||
import { Platform } from 'react-native' | ||
|
||
export let OptionalExpoLocalization: typeof ExpoLocalization | undefined = undefined | ||
|
||
try { | ||
OptionalExpoLocalization = require('expo-localization') | ||
// macos not supported | ||
if (Platform.OS !== 'macos') { | ||
OptionalExpoLocalization = require('expo-localization') | ||
} | ||
} catch (e) {} |
6 changes: 5 additions & 1 deletion
6
posthog-react-native/src/optional/OptionalReactNativeDeviceInfo.ts
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,11 @@ | ||
import { Platform } from 'react-native' | ||
import type ReactNativeDeviceInfo from 'react-native-device-info' | ||
|
||
export let OptionalReactNativeDeviceInfo: typeof ReactNativeDeviceInfo | undefined = undefined | ||
|
||
try { | ||
OptionalReactNativeDeviceInfo = require('react-native-device-info') // No Web support | ||
// macos not supported | ||
if (Platform.OS !== 'macos') { | ||
OptionalReactNativeDeviceInfo = require('react-native-device-info') // No Web support, returns unknown | ||
} | ||
} catch (e) {} |
7 changes: 6 additions & 1 deletion
7
posthog-react-native/src/optional/OptionalReactNativeNavigation.ts
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,12 @@ | ||
import type ReactNativeNavigation from '@react-navigation/native' | ||
import { Platform } from 'react-native' | ||
|
||
export let OptionalReactNativeNavigation: typeof ReactNativeNavigation | undefined = undefined | ||
|
||
try { | ||
OptionalReactNativeNavigation = require('@react-navigation/native') | ||
// macos not supported | ||
if (Platform.OS !== 'macos') { | ||
// experimental support for web https://reactnavigation.org/docs/web-support/ | ||
OptionalReactNativeNavigation = require('@react-navigation/native') | ||
} | ||
} catch (e) {} |
6 changes: 5 additions & 1 deletion
6
posthog-react-native/src/optional/OptionalReactNativeNavigationWix.ts
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,11 @@ | ||
import { Platform } from 'react-native' | ||
import type ReactNativeNavigationWix from 'react-native-navigation' | ||
|
||
export let OptionalReactNativeNavigationWix: typeof ReactNativeNavigationWix | undefined = undefined | ||
|
||
try { | ||
OptionalReactNativeNavigationWix = require('react-native-navigation') | ||
// macos/web not supported | ||
if (Platform.OS !== 'web' && Platform.OS !== 'macos') { | ||
OptionalReactNativeNavigationWix = require('react-native-navigation') | ||
} | ||
} catch (e) {} |