[SOLVED] Incoming call (phone or skype) or a connection sharing when the app is loaded


#1

Hi, did someone here experienced an incoming call (phone or skype) or a connection sharing when the app is loaded ?


It add another status bar above the existing status bar and then my layout is moved down the height of this additional status bar, leaving a gray space at top and moving down the buttons at the bottom of my app, getting them unreachable …


#2

I’ve noticed that the phone/navigation bar can have inconsistent results. A way to detect this would be to observe when the screen size changes.

import { Dimensions } from 'react-native';
let currentScreenSize = Dimensions.get('window');
Dimensions.addEventListener(
  'change',
  ({ screen: { width, height, scale } }) => {
     if (height != currentScreenSize.height) {
       ///Do something with the new screen height
     }
  },
);


#3

Hi @bacon,
I’ve tested this idea with this snack : https://snack.expo.io/@lc3t35/screen-change
There is no screen change with an incoming call :wink:

As I was looking at the code of StatusBar, I noticed this comment

// TODO(janic): Provide a real API to deal with status bar height. See the
// discussion in #6195.

Then I bet i was refering to an issue in react-native :

This is how I found this https://github.com/jgkim/react-native-status-bar-size

hold on I’m testing …


#4

Interesting, this should work as it uses React Native https://github.com/jgkim/react-native-status-bar-size. This relays the events you would use to handle this in native! Good find!!

Also this library is pretty dated. It would be cool if you could PR it :grin:
Finally here is a snack test: https://snack.expo.io/@bacon/status-bar-incoming-call


#5

There is already a PR to correct the willChange (https://github.com/jgkim/react-native-status-bar-size/pull/20), when you reload manually the app during an incoming call, the height is 40 instead of 20, but with the current version it’s not dynamically updated when the incoming call starts (should update to 40) and stop (should update to 20). This fork should be tested within IDE…


#6

Ok, I think it also looks like StatusBarIOS needs to be StatusBar


#7

@bacon, it’s not possible to attach an event listener to StatusBar, I had to rollback with StatusBarIOS in my test fork : https://github.com/lc3t35/react-native-status-bar-size.
Behaviour is rather strange… not sure the willChange was a good idea…


#8

@lc3t35 I put this together yesterday :grin: https://github.com/expo/status-bar-height

StatusBarHeight.addEventListener(height => {});

I also wrote a blog post explaining the weirdness surrounding this problem, the “willChange” is related to some weirdness in the iOS API so there isn’t much that can be done there. :flushed: Hope this helps


#9

@bacon as far I tested it for now, the problem is solved with your module ! Thank you.


closed #10

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.