Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mock StatusBarManager is missing getHeight() method #22385

Closed
marecar3 opened this issue Nov 22, 2018 · 5 comments
Closed

Mock StatusBarManager is missing getHeight() method #22385

marecar3 opened this issue Nov 22, 2018 · 5 comments
Labels
Bug Component: StatusBar Resolution: Locked This issue was locked by the bot.

Comments

@marecar3
Copy link

React Native Environment Info:
System:
OS: macOS High Sierra 10.13.6
CPU: (12) x64 Intel(R) Core(TM) i7-8850H CPU @ 2.60GHz
Memory: 110.67 MB / 16.00 GB
Shell: 3.2.57 - /bin/bash
Binaries:
Node: 8.12.0 - ~/.nvm/versions/node/v8.12.0/bin/node
Yarn: 1.10.1 - /usr/local/bin/yarn
npm: 6.4.1 - ~/.nvm/versions/node/v8.12.0/bin/npm
SDKs:
iOS SDK:
Platforms: iOS 11.4, macOS 10.13, tvOS 11.4, watchOS 4.3
Android SDK:
API Levels: 23, 26, 27, 28
Build Tools: 26.0.2, 26.0.3, 27.0.3, 28.0.2, 28.0.3
System Images: android-27 | Google APIs Intel x86 Atom
IDEs:
Android Studio: 3.2 AI-181.5540.7.32.5056338
Xcode: 9.4.1/9F2000 - /usr/bin/xcodebuild
npmPackages:
react: 16.6.1 => 16.6.1
react-native: 0.57.5 => 0.57.5

StatusBarManager is missing getHeight() when running jest, which result in failed tests.

Thanks.

@bartolkaruza
Copy link

It looks like the Android implementation also doesn't have this method and I can't find any references to that function being called from anywhere in the React Native code base. Are you directly calling this method in your code? If so, I suspect it will cause runtime issues on Android.

@marecar3
Copy link
Author

Hey @bartolkaruza,

Thanks for the fast response.

Are you directly calling this method in your code?

No, we are calling this method in file.ios.js and purpose of using it is to get status bar height which can be different on iPhone X devices, as KeyboardAvoidingView won't work good with top of keyboard components if you don't set keyboardVerticalOffset with + statusBarHeight.

@bartolkaruza
Copy link

bartolkaruza commented Nov 27, 2018

Ok, so maybe you can resolve this issue by simply using the HEIGHT constant instead of the method?
That one should work even in jest tests if you look at this old issue:
#11701

Alternatively, feel free to open a PR which adds that method to the mock :)

@marecar3
Copy link
Author

Ok thanks @bartolkaruza!

@rickhanlonii
Copy link
Member

Nice, thanks @bartolkaruza!

@facebook facebook locked as resolved and limited conversation to collaborators Mar 19, 2020
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Mar 19, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug Component: StatusBar Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

No branches or pull requests

5 participants