fable-compiler / fable-react-native

Fable bindings and helpers for React Native projects
Apache License 2.0
49 stars 11 forks source link

How to get user's current position? #27

Closed thitemple closed 6 years ago

thitemple commented 6 years ago

Hi there,

I'm trying to get the current position of my phone doing this: Fable.Import.ReactNative.Globals.Geolocation.getCurrentPosition (fun pos -> Browser.console.log ("currentPosition", pos))

But this yields the following error: undefined is not an object (evaluating _reactNative.Geolocation.getCurrentPosition

How can I do it?

thitemple commented 6 years ago

Nevermind, I realized now i just need to use this:

Fable.Import.Browser.navigator.geolocation.getCurrentPosition

alfonsogarciacaro commented 6 years ago

Great that you found the solution! I'm closing the issue for now, but please feel free to reopen if you have another question :+1: