getUserAgent() and getUserAgentSync() return different results
See original GitHub issueBug
When calling getUserAgent()
and getUserAgentSync()
on an iOS13.4 Simulator, I get the following results:
unknown
Mozilla/5.0 (iPhone; CPU iPhone OS 13_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148
Environment info
System:
OS: macOS 10.15.4
CPU: (8) x64 Intel(R) Core(TM) i5-8259U CPU @ 2.30GHz
Memory: 327.73 MB / 16.00 GB
Shell: 5.7.1 - /bin/zsh
Binaries:
Node: 12.12.0 - ~/.nvm/versions/node/v12.12.0/bin/node
Yarn: 1.22.0 - /usr/local/bin/yarn
npm: 6.11.3 - ~/.nvm/versions/node/v12.12.0/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
SDKs:
iOS SDK:
Platforms: iOS 13.4, DriverKit 19.0, macOS 10.15, tv
OS 13.4, watchOS 6.2
Android SDK: Not Found
IDEs:
Android Studio: 3.5 AI-191.8026.42.35.6010548
Xcode: 11.4/11E146 - /usr/bin/xcodebuild
Languages:
Python: 2.7.16 - /usr/bin/python
npmPackages:
@react-native-community/cli: Not Found
react: ^16.11.0 => 16.11.0
react-native: ^0.62.0 => 0.62.0
npmGlobalPackages:
*react-native*: Not Found
Library version: 5.5.3
Steps To Reproduce
- Simply call both the async and sync methods
- Log the results
Describe what you expected to happen:
Receive the same result from both functions.
Reproducible sample code
export default () => {
useEffect(() => {
console.log(DeviceInfo.getUserAgentSync());
DeviceInfo.getUserAgent().then(agent => console.log(agent));
}, []);
return (
<Fragment />
);
}
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (1 by maintainers)
Top Results From Across the Web
getUserAgent() and getUserAgentSync() return different results
When calling getUserAgent() and getUserAgentSync() on an iOS13.4 Simulator, I get the following results: unknown; Mozilla/5.0 (iPhone; CPU ...
Read more >react-native-device-info | Yarn - Package Manager
Method, Return Type, iOS, Android, Windows, Web ... Only getUserAgent() will return a correct value. All other API methods will return an "empty"...
Read more >Return the result value with fetch call function from another ...
Since getvals() is returning a Promise, you need to access it's value in a .then() method. Overall, your code should be like this:....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I checked source code and it seems
getUserAgentSync
is not available on iOS and therefore defaults tounknown
. Closing this as that’s by design.there you go 😄