Konu
React React Native ile object log okuma için yardım
04-03-2021, 20:48:22
#7
eminberkay
Kimlik doğrulama veya yönetimden onay bekliyor.
gecko adlı üyeden alıntı:
mesajı görüntüle
kod parçasını atabilir misin
import
React
, {
useState
,
useEffect
}
from
'react'
;
import
*
as
Location
from
'expo-location'
;
function
MapScreen
() {
const
[
location
,
setLocation
] =
useState
(
null
);
useEffect
(()
=>
{(
async
()
=>
{
let
{
status
} =
await
Location
.
requestPermissionsAsync
();
if
(
status
!==
'granted'
) {
console
.
log
(
"izin verilmemiş!"
)
return
;
}
let
location
=
await
Location
.
getCurrentPositionAsync
({});
setLocation
(
location
);
console
.
log
(
"izin verilmiş"
)
})();
}, []);
console
.
log
(location);
}