0

I am trying the retrieve the top, right, left , bottom values of SafeAreaView in react native using this function:

If I directly console.log in my function inside the function like this

const SafeAreaSpecs = async () => {
    console.log(await SafeArea.getSafeAreaInsetsForRootView());
};

it gives me this:

enter image description here

Which is exactly what I want. But if I return SafeAreaSpecs() and call it somewhere else like this

const SafeAreaSpecs = async () => {
    return await SafeArea.getSafeAreaInsetsForRootView();
};

...
...
...

console.log(SafeAreaSpecs());

I get this:

enter image description here

As you can see, i can still access safeAreaInsets but I can't figure out how to get rid of _40. _65, _55, _72. What is the proper way of storing and calling the returned value?

I have looked at this post How do I return the response from an asynchronous call? but it didn't help. not sure what I'm doing wrong

HTB
  • 413
  • 1
  • 9
  • 22
  • @Quentin unfortunately that didn't solve my problem. I am still getting the same result – HTB Feb 27 '19 at 18:21
  • https://stackoverflow.com/a/30180679/5508175 This answer is the one what you are looking for. See the section on **ES2016 (ES7)** – Andrew Feb 27 '19 at 22:55

0 Answers0