Let the touch area of ​​the button in React Native go to the status bar (ios)

I have a return button (using TouchableOpacity) in the upper left corner of the screen. I want his hit area to fall into the status bar, as other applications do, and it is easy to accidentally press the button a little too hard by touching the status bar a little higher and make the application feel unresponsive.

I have an area that expands beyond the status bar, but the status bar still captures touch events. Is there a way to do this wrong (at least on the left side, I would still like the “touch to the beginning” to work when you touch it elsewhere)?

+4
source share
1 answer

UINavigationBar- this is UIWindow(not a UIView), which is higher UIWindowin which you act. Therefore, it is impossible to imagine UIViewsfrom yours UIWindow.

What you can do is add transparent in UIBarButtonItemaddition to your button, causing the same action:

var button = UIBarButtonItem(title: "", style: .Plain, target:  action: #selector(yourAction(_:)))
button.tintColor = UIColor.clear
navigationController?.navigationItem.leftBarButtonItem = button
0
source

Source: https://habr.com/ru/post/1657511/


All Articles