Fork me on GitHub

in react native, i access the global data global.HermesInternal like this (.-HermesInternal js/global), but the console shows that ReferenceError: global is not defined


oh that might be a side effect of the loading changes I did


@titov the same way you would get it with JS React Native. Look at itโ€™s a bit outdated though in terms of accessing javascript objects. For that you can check:


I'm trying to import js module inside my app with this code:

(def Geolocation (js/require "react-native-geolocation-service"))
and it says there is no such module, although I have installed it with npm. It's so strange cause react and react-native I can import easily


i remember that some weeks ago i can access by this method


Yes and I can't import it, here is my code: (def Geolocation (js/require "react-native-geolocation-service"))


I installed js module with npm


if u read first sentence


As a browser polyfill, this API is available through the navigator.geolocation global - you do not need to import it.


and there is nothing to be installed


Yeah, you right, so how can I access methods of this module? I've tried

(.-requestAuthorization  (.-geolocation js/navigator))
for getting access but it's an object not a method ๐Ÿ˜•

Maksym11:08:31>  (.-requestAuthorization  (.-geolocation js/navigator))
#object[requestAuthorization]> (.-geolocation js/navigator)
#js {:setRNConfiguration #object[setRNConfiguration], :requestAuthorization #object[requestAuthorization], :getCurrentPosition #object[getCurrentPosition], :watchPosition #object[watchPosition], :clearWatch #object[clearWatch], :stopObserving #object[stopObserving]}


have a look into those interop articles shared by @U0AU4CPTN


Sorry I still don't understand. I try to call navigation.geolocation.requestAuthorization() but it's impossible, there is only object navigation.geolocation.requestAutorization:> (.requestAutorization (.-requestAuthorization (.-geolocation js/navigator))) #object[TypeError TypeError: navigator.geolocation.requestAuthorization.requestAutorization is not a function. (In 'navigator.geolocation.requestAuthorization.requestAutorization()', 'navigator.geolocation.requestAuthorization.requestAutorization' is undefined)]

eval code
[email protected][native code]
nil> (.requestAuthorization  (.-geolocation js/navigator))
#object[TypeError TypeError: RCTLocationObserver.requestAuthorization is not a function. (In 'RCTLocationObserver.requestAuthorization()', 'RCTLocationObserver.requestAuthorization' is undefined)]
[email protected]://localhost:8081/


u should really read articles people here are sending you. If something doesn't work it means u are doing something wrong. As i am getting strong vibes that u are beginner i will explain in detail how to call the fn. Read articles again and bookmark them use them as reference whenever you are using anything JS in CLJS. in order to get call that fn u need do the the following (.requestAuthorization js/navigator.geolocation) any global variable or object in JS world is accessed by using js namespace so here u are saying "give me navigator.geolocation object from js namespace and call requestAuthorization function


You are right, I'm beginner, I set a goal and I want to understand how this technology works, I really try to do my best, I read article and man, you write me code which does not work. I assume that there is no such function like requestAuthorization:> (.requestAuthorization js/navigator.geolocation)
#object[TypeError TypeError: RCTLocationObserver.requestAuthorization is not a function] unknown protocol: blob
        at java.base/<init>(
        at java.base/<init>(
        at cljs.repl$mapped_frame.invokeStatic(repl.cljc:332)
I checked it after connecting to react native debugger and working with navigator.geolocation object. Now I'm trying to just get current position with: (.getCurrentPosition js/navigator.geolocation #(fn [pos] (.alert (.-Alert ReactNative) pos)))


I like your ambition. good, this is good for getting the coordinates. Be sure to set optional settings as i had bug where cached values was taken after first position request. That should've worked 'cause the logic is the same when u call other functions (in ur case getCurrentPosition) If you inspect the object navigator.geolocation - it contains object getCurrentPosition The reason why requestAuthorization doesn't work could be many things 1. you didn't add permission 2. there is a problem with RN and your desired device I should've tested the code on my side before posting it. Apologies for that