bestiejs / platform.js

A platform detection library.
https://mths.be/platform
MIT License
3.22k stars 408 forks source link

Example on react native #129

Closed marcelo-tm closed 7 years ago

marcelo-tm commented 7 years ago

Is there any example on how to set the script on react native? I'm trying to import the library and include a log on the render function, but it prints an empty object.

Ex: import platform from 'platform';

render() { console.log(platform);

Prints: {}

marcelo-tm commented 7 years ago

Hello, I think I found the problem myself here. The first test I made, I was using the Expo XDE, now I tried with vanilla React Native and got the right info:

{"description":"Chrome 57.0.2987.133 on OS X 10.12.4 64-bit","layout":"Blink","manufacturer":null,"name":"Chrome","prerelease":null,"product":null,"ua":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.133 Safari/537.36","version":"57.0.2987.133","os":{"architecture":64,"family":"OS X","version":"10.12.4"}}

So, the problem is the Expo XDE... Sorry for the rushed question here.

marcelo-tm commented 7 years ago

Sadly it just only worked on the ios simulator. Android emulator and running directly on ios device don't return any values...