
Security News
AGENTS.md Gains Traction as an Open Format for AI Coding Agents
AGENTS.md is a fast-growing open format giving AI coding agents a shared, predictable way to understand project setup, style, and workflows.
react-native-device-specs
Advanced tools
Detect the specifications of a device on iOS or android in react-native.
RNDeviceSpecs detects the specifications of the device it is running on. Requiring or importing the module will give you an object with properties that describe the user's device.
npm install react-native-device-specs --save
Open your project in XCode, right click on Libraries
, click Add files to (Your Project Name)
, and select RNDeviceSpecs.xcodeproj
Add libRNDeviceSpecs.a
to Build Phases
--> Link Binary With Libraries
In android/settings.gradle
below include ':app'
add:
...
include ':react-native-device-specs'
project(':react-native-device-specs').projectDir = new File(settingsDir, '../node_modules/react-native-device-specs')
In android/app/build.gradle
dependencies {
...
compile project(':react-native-device-specs')
}
In android/app/src/main/java/com/YourProject/MainActivity.java
add:
import com.joinpeach.react.device.specs.*; // <--- add this
public class MainActivity extends Activity implements DefaultHardwareBackBtnHandler {
...
@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 RNDeviceSpecsModule()) // <- and add this
.setUseDeveloperSupport(BuildConfig.DEBUG)
.setInitialLifecycleState(LifecycleState.RESUMED)
.build();
mReactRootView.startReactApplication(mReactInstanceManager, "YourProject", null);
setContentView(mReactRootView);
}
}
Use import specs from 'react-native-device-specs'
or var specs = require('react-native-device-specs')
in your project!
platform
: The platform code.storageSize
: The quoted storage size (GB) given by Apple (Ex: 32, 64, 128)diskSpace
: The actual size of the disk.carrier
: The carrier of device or 'No Carrier'
for Simulators or Devices without a carrier.Feel free to submit a pull request with feature suggestions or device updates. Please maintain a consistent syntax for new devices (See lib/iosModels.js for examples)
FAQs
Detect the specifications of a device on iOS or android in react-native.
The npm package react-native-device-specs receives a total of 0 weekly downloads. As such, react-native-device-specs popularity was classified as not popular.
We found that react-native-device-specs demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
AGENTS.md is a fast-growing open format giving AI coding agents a shared, predictable way to understand project setup, style, and workflows.
Security News
/Research
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
Security News
This episode explores the hard problem of reachability analysis, from static analysis limits to handling dynamic languages and massive dependency trees.