Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: proper types for userAgent and vendor #6361

Merged
merged 1 commit into from
Aug 1, 2024

Conversation

WoLewicki
Copy link
Member

@WoLewicki WoLewicki commented Jul 31, 2024

Summary

PR restoring proper types for Navigator.

When this code would be removed, VSCode takes me to definitions from TS, which show it the same way:
image

Test plan

@szydlovsky
Copy link
Contributor

@WoLewicki I'm not sure if we can just change it this way, see:

detectPlatform() {
const userAgent = navigator.userAgent || navigator.vendor || window.opera;
if (userAgent === undefined) {
this.platform = Platform.UNKNOWN;
} else if (/iPad|iPhone|iPod/.test(userAgent)) {
this.platform = Platform.WEB_IOS;
} else if (/android/i.test(userAgent)) {
this.platform = Platform.WEB_ANDROID;
} else {
this.platform = Platform.WEB;
}
}

Copy link
Contributor

@szydlovsky szydlovsky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:shipit:

@WoLewicki WoLewicki added this pull request to the merge queue Aug 1, 2024
Merged via the queue into main with commit 594479e Aug 1, 2024
7 checks passed
@WoLewicki WoLewicki deleted the @wolewicki/fix-type-for-reanimated-2 branch August 1, 2024 11:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants