
Security News
Ruby's Bundler 4.0.18 Extends Cooldown to bundle lock and bundle cache
The supply chain control that delays freshly published gems now covers lockfile generation and gem vendoring in Ruby projects.
react-smartphone
Advanced tools


If you just want to see the showcase please jump to the DEMO!
Smartphone container, acts as a regular container with relative positioning, with a fixed height and width. I used it in a personal project and thought I might as well publish it to share with the community :)
Simply add to the container your React components and they will be rendered in the screen!
Features
Please add feedback if there is anything you might find missing.
Run
npm i react-smartphone
and import as usual
import SmartphoneContainer from 'react-smartphone'
In the DEMO I added the default react component that is generated whe you perform a create-react-app app-name to showcase the smartphone container.
You can either place it entirely as follows with/without props (see props section)
import SmartphoneContainer from 'react-smartphone'
...
<SmartphoneContainer>
<div className="App">
<header className="App-header">
<img src={logo} className="App-logo" alt="logo" />
<h1 className="App-title">Welcome to React</h1>
</header>
<p className="App-intro">
To get started, edit <code>src/App.js</code> and save to reload.
</p>
</div>
</SmartphoneContainer>
or in a cleaner way
import SmartphoneContainer from 'react-smartphone'
...
<SmartphoneContainer>
<App />
</SmartphoneContainer>
If you want to customiz the phone you can specify props like color and dimensions. All styling props are strings. This gives you the flexibility to add for example height in vh or % or px etc... Same goes for colors, you can either use rgb or hex. Example:
<SmartphoneContainer
height='700px'
width='380px'
caseColor='rgb(30,30,30)'
shadowColor='rgb(200,200,230)'
>
<!-- your component goes here -->
</SmartphoneContainer>
ALL props are OPTIONAL.
| Prop Name | Default Value | Type |
|---|---|---|
| height | 700px | string |
| width | 380px | string |
| caseColor | #f3f0dd | string |
| detailsColor | #374D5C | string |
| cameraColor | #f4745d | string |
| shadowColor | #b0b3b2 | string |
| volumeButtonsColor | Content Cell | string |
| text | Thanks for using react-phone. | string: if instead of a react component you just want to render a sentence you can pass a string and it will be rendered in the center of the phone screen |
| screenColor | 374D5C | string |
| children | none | React Component |
| content | none | React Component: if the are children, it will prioritize rendering children instead of content prop |
| onVolumeButtonPress | none | callback function ()=> {} |
| onHomeButtonPress | none | callback function ()=>{} |
Thanks and please do not forget to submit feedback if you something doesn't work properly or you simply want more fun features :)
FAQs

We found that react-smartphone 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
The supply chain control that delays freshly published gems now covers lockfile generation and gem vendoring in Ruby projects.

Security News
During a UK cyber test, a Mythos 5 agent used sockpuppets, social engineering, and prompt injection to try to get a maintainer to merge malware.

Company News
Socket is now in the AWS Security Hub Extended plan. Adopt it through AWS, apply committed spend, and block malicious open source packages.