question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Mock StatusBarManager is missing getHeight() method

See original GitHub issue

React Native Environment Info: System: OS: macOS High Sierra 10.13.6 CPU: (12) x64 Intel® Core™ 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.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
bartolkaruzacommented, 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: https://github.com/facebook/react-native/issues/11701

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

0reactions
rickhanloniicommented, Mar 19, 2019

Nice, thanks @bartolkaruza!

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to mock StatusBarManager.getHeight in Jest test?
Is it any way to mock StatusBarManager.getHeight in jest? I've tried to create jest-setup.js in my root folder import { ...
Read more >
The Status Bar Manager in React Native - Expo Blog
The Status Bar Manager in React Native ... want to call the async `getHeight` method, the last value is cached and accessible. ......
Read more >
How to hoist a jest dependency mock over actual dependency?
How to mock Picker and Picker.Item with jest in React-Native? ... How to mock StatusBarManager.getHeight in Jest test? ... How do I mock...
Read more >
AssistStructure.ViewNode - Android Developers
public float getElevation (). Returns the visual elevation of the view, used for shadowing and other visual characterstics, as set by ViewStructure.
Read more >
packages/SystemUI/src/com/android/systemui/statusbar ...
StatusBarManager. ... public boolean shouldHideOnTouch() {. return ! ... Currently there is no accelerometer sensor on non-default display.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found