Gathering detailed insights and metrics for react-native-device-screen-switcher
Gathering detailed insights and metrics for react-native-device-screen-switcher
Gathering detailed insights and metrics for react-native-device-screen-switcher
Gathering detailed insights and metrics for react-native-device-screen-switcher
Run app in iPhone 6 Plus simulator and auto-scale the viewport to iPhone 4, 5, and 6 sizes while running
npm install react-native-device-screen-switcher
Typescript
Module System
Node Version
NPM Version
37
Supply Chain
51
Quality
69
Maintenance
50
Vulnerability
94.1
License
JavaScript (100%)
Total Downloads
144,939
Last Day
1
Last Week
49
Last Month
182
Last Year
3,987
MIT License
49 Stars
15 Commits
8 Forks
3 Watchers
1 Branches
5 Contributors
Updated on Apr 08, 2024
Latest Version
0.2.0
Package Id
react-native-device-screen-switcher@0.2.0
Unpacked Size
11.09 kB
Size
4.50 kB
File Count
7
NPM Version
6.4.1
Node Version
10.15.2
Cumulative downloads
Total Downloads
Last Day
0%
1
Compared to previous day
Last Week
-7.5%
49
Compared to previous week
Last Month
-16.9%
182
Compared to previous month
Last Year
-59.7%
3,987
Compared to previous year
1
2
Testing your React Native UI layouts on different screen sizes can be quite time-consumning.
This library aims to make this much easier by allowing the run-time switching of the main app viewport to match the sizes of different devices.
This library requires React Native 0.43.0 or above. For versions older versions of React Native (from 0.34.0 up), use the 0.0.4 release.
npm i -S react-native-device-screen-switcher
In your root-level component, wrap the root component returned by render()
with <ScreenSwitcher>
.
1import ScreenSwitcher from 'react-native-device-screen-switcher'; 2 3class MyRoot extends Component { 4 ... 5 render() { 6 return ( 7 <ScreenSwitcher> 8 <MyRootComponent/> 9 </ScreenSwitcher> 10 ) 11 } 12}
1react-native run-ios --simulator="iPhone Pro Max"
The viewport is resized to the correct size.
Additionally, the app will render images using the density appropriate to the simulated device (@3x on iPhone 6 Plus, @2x on most others).
To hide the Switch
button use the hideButton
prop on ScreenSwitcher, e.g.
1<ScreenSwitcher hideButton> 2 ... 3</ScreenSwitcher>
For scale screen down to fit physical device dimensions, use scaleToFit
prop, e.g.
1<ScreenSwitcher scaleToFit> 2 ... 3</ScreenSwitcher>
If you want to scale up to fill device screen, use 'scaleUp' prop with addition to scaleToFit
, e.g.
1<ScreenSwitcher scaleToFit scaleUp> 2 ... 3</ScreenSwitcher>
In production builds the <ScreenSwitcher>
component simply passes through the child components without changing them using the same method as the react-redux
<Provider>
component.
This means it's not necessary to remove <ScreenSwitcher>
from your root component for production builds.
This library was inspired by https://github.com/machadogj/react-native-layout-tester, which performs a similar function by running your app on an iPad.
However, that library required that you did not use React Native's Dimensions
system, but used their own alternative system. It also required you to set your iPhone app to be Universal in Xcode. Neither of these are the case here.
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
0 existing vulnerabilities detected
Reason
license file detected
Details
Reason
Found 2/15 approved changesets -- score normalized to 1
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Score
Last Scanned on 2025-05-05
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More