(dim)
| 1 | import { NativeModules, Platform } from 'react-native'; |
| 2 | |
| 3 | export function get(dim) { |
| 4 | if (Platform.OS !== 'android') { |
| 5 | |
| 6 | console.warn('react-native-extra-dimensions-android is only available on Android. Trying to access', dim); |
| 7 | return 0; |
| 8 | } else { // android |
| 9 | try { |
| 10 | if (!NativeModules.ExtraDimensions) { |
| 11 | throw "ExtraDimensions not defined. Try rebuilding your project. e.g. react-native run-android"; |
| 12 | } |
| 13 | const result = NativeModules.ExtraDimensions[dim]; |
| 14 | |
| 15 | if (typeof result !== 'number') { |
| 16 | return result; |
| 17 | } |
| 18 | return result; |
| 19 | } catch (e) { |
| 20 | console.error(e); |
| 21 | } |
| 22 | } |
| 23 | } |
| 24 | |
| 25 | export function getRealWindowHeight() { |
| 26 | return get('REAL_WINDOW_HEIGHT'); |
no outgoing calls
no test coverage detected