Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

mx-artifacts

Package Overview
Dependencies
Maintainers
1
Versions
28
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mx-artifacts - npm Package Compare versions

Comparing version 0.0.12 to 0.0.13

5

components/device/index.js

@@ -8,2 +8,4 @@ var React = require('react-native');

var ExtraDimensions = require('react-native-extra-dimensions-android');
// Although dimensions are available immediately, they may change (e.g due to device rotation) so any

@@ -21,3 +23,4 @@ // rendering logic or styles that depend on these constants should try to call this function on every

//var statusBarHeight = (Platform.OS === 'ios' ? 0 : PixelRatio.getPixelSizeForLayoutSize(24));
var statusBarHeight = (Platform.OS === 'ios' ? 0 : 25);
// var statusBarHeight = (Platform.OS === 'ios' ? 0 : 25);
var statusBarHeight = (Platform.OS === 'ios' ? 0 : ExtraDimensions.get('STATUS_BAR_HEIGHT'));
var innerStatusBarSize = (Platform.OS === 'ios' ? 20 : 0);

@@ -24,0 +27,0 @@ var navBarHeight = (Platform.OS === 'ios' ? 64 : 44);

77

components/device/index.md

@@ -16,1 +16,78 @@ ## MxDevice

```
Refered from [react-native-extra-dimensions-android](https://github.com/jaysoo/react-native-extra-dimensions-android)
## ExtraDimensions
This module allows you to access additional display metrics on Android devices.
- Actual width and height of the screen (including elements such as soft menu bar)
- Soft menu height
- Status bar height
- Smart bar height(MeiZu)
### Why?
There is currently a bug in React Native where [`Dimensions.get('window').height` sometimes returns
the wrong value](https://github.com/facebook/react-native/issues/4934).
Also, some apps may want to set the background of status bar and soft menu bar to transparent, thus the top-level
view needs to fill up the real screen size.
### Installation
1. In `android/setting.gradle`
```
...
include ':ExtraDimensions', ':app'
project(':ExtraDimensions').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-extra-dimensions-android/android')
```
2. In `android/app/build.gradle`
```
...
dependencies {
...
compile project(':ExtraDimensions')
}
```
3. Register module (in MainActivity.java)
```
import ca.jaysoo.extradimensions.ExtraDimensionsPackage; // <--- import
public class MainActivity extends ReactActivity {
......
protected List<ReactPackage> getPackages() {
return Arrays.<ReactPackage>asList(
new MainReactPackage(),
new ExtraDimensionsPackage(this) // <--- add here
);
}
......
}
```
Whenever you want to use it within React Native code now you can:
`var ExtraDimensions = require('react-native-extra-dimensions-android');`
### Demo
![](./demo.png)
### API
There is only one method `get(dimension: string)` that takes in a dimension name, and returns its value as a `number`.
Supported dimensions are:
- `REAL_WINDOW_HEIGHT` - Actual height of screen including system decor elements
- `REAL_WINDOW_WIDTH` - Actual width of screen including system decor elements
- `STATUS_BAR_HEIGHT` - Height of the status bar
- `SOFT_MENU_BAR_HEIGHT` - Height of the soft menu bar (supported on most new Android devices)
- `SMART_BAR_HEIGHT` - Height of the MeiZu's device smart bar
{
"name": "mx-artifacts",
"version": "0.0.12",
"version": "0.0.13",
"description": "Artifacts of mx.",

@@ -21,3 +21,5 @@ "main": "./index.js",

"private": false,
"dependencies": {},
"dependencies": {
"react-native-extra-dimensions-android": "^0.17.0"
},
"devDependencies": {

@@ -24,0 +26,0 @@ "lodash": "^4.6.1",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc