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

react-native-extra-dimensions-android

Package Overview
Dependencies
Maintainers
2
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-native-extra-dimensions-android - npm Package Compare versions

Comparing version 0.17.0 to 0.18.0

6

index.js

@@ -1,3 +0,3 @@

const React = require('react-native');
const { NativeModules: { ExtraDimensions }, Platform } = React;
const React = require('react');
import { NativeModules, Platform } from 'react-native';

@@ -7,3 +7,3 @@ if (Platform.OS === 'android') {

get(dim) {
return ExtraDimensions[dim];
return NativeModules.ExtraDimensions[dim];
}

@@ -10,0 +10,0 @@ };

{
"name": "react-native-extra-dimensions-android",
"version": "0.17.0",
"version": "0.18.0",
"description": "Access additional display metrics on Android devices: status bar height, soft menu bar height, real screen size.",

@@ -8,3 +8,3 @@ "main": "index.js",

"type": "git",
"url": "https://github.com/jaysoo/react-native-extra-dimensions-android"
"url": "https://github.com/Sunhat/react-native-extra-dimensions-android"
},

@@ -22,4 +22,9 @@ "files": [

],
"rnpm": {
"android": {
"packageInstance": "new ExtraDimensionsPackage()"
}
},
"author": "Jack Hsu <jack.hsu@gmail.com> (http://jaysoo.ca/)",
"license": "ISC"
}
## ExtraDimensions
This module allows you to access additional display metrics on Android devices.
This module allows you to access additional display metrics on Android devices. (RN 0.29.0+)

@@ -8,3 +8,5 @@ - Actual width and height of the screen (including elements such as soft menu bar)

- Status bar height
- Smart bar height (MeiZu)
### Why?

@@ -20,56 +22,39 @@

1. In `android/setting.gradle`
1. Install with npm
```
npm install react-native-extra-dimensions-android --save
```
2. link using rnpm
```
...
include ':ExtraDimensions', ':app'
project(':ExtraDimensions').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-extra-dimensions-android/android')
rnpm link react-native-extra-dimensions-android
```
2. In `android/app/build.gradle`
3. You may have to register the module (in android/app/src/main/java/com/YOUR-PROJECT-NAME/MainApplication.java)
```
...
dependencies {
...
compile project(':ExtraDimensions')
}
```
3. Register module (in MainActivity.java)
```
import ca.jaysoo.extradimensions.ExtraDimensionsPackage; // <--- import
public class MainActivity extends Activity implements DefaultHardwareBackBtnHandler {
public class MainApplication extends Application implements ReactApplication {
......
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mReactRootView = new ReactRootView(this);
mReactInstanceManager = ReactInstanceManager.builder()
.setApplication(getApplication())
.setBundleAssetName("index.android.bundle")
.setJSMainModuleName("index.android")
.addPackage(new MainReactPackage())
.addPackage(new ExtraDimensionsPackage(this)) // <------ add here
.setUseDeveloperSupport(BuildConfig.DEBUG)
.setInitialLifecycleState(LifecycleState.RESUMED)
.build();
mReactRootView.startReactApplication(mReactInstanceManager, "ExampleRN", null);
setContentView(mReactRootView);
protected List<ReactPackage> getPackages() {
return Arrays.<ReactPackage>asList(
new MainReactPackage(),
new ExtraDimensionsPackage() // <--- add here
);
}
......
}
```
4. Whenever you want to use it within React Native code now you can:
Whenever you want to use it within React Native code now you can:
`var ExtraDimensions = require('react-native-extra-dimensions-android');`
Or, if you are using ES6
`import ExtraDimensions from 'react-native-extra-dimensions-android';`
### Demo

@@ -89,1 +74,2 @@

- `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

Sorry, the diff of this file is not supported yet

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