I am attempting to get the return value of a function.
I am doing it like this:
let barHeight;
componentDidMount() {
barHeight = StatusBarManager.getHeight(statusBarHeight => statusBarHeight);
console.log({ mounted: barHeight });
}
componentDidUpdate() {
barHeight = StatusBarManager.getHeight(statusBarHeight => statusBarHeight);
console.log({ update: barHeight });
}
The curious thing is that if I do:
StatusBarManager.getHeight(statusBarHeight => console.log(statusBarHeight));
I see how it logs {height: 20}
, but with both console logs inside those 2 methods: console.log({ update: barHeight });
all I see is undefined
.
So how can I grab the value returned by StatusBarManager.getHeight
in order to use it in another function?