Exciting release!Introducing "safe npm". Learn more
Socket
Log inDemoInstall

react-device-emulator

Package Overview
Dependencies
2
Maintainers
1
Versions
7
Issues
File Explorer

Advanced tools

react-device-emulator

A device emulator for ReactJS apps

    1.1.1latest
    GitHub

Version published
Maintainers
1
Weekly downloads
564
decreased by-14.8%

Weekly downloads

Readme

Source

React Device Emulator

A lightweight device emulator for ReactJS web applications. It enables you to visualize websites (using the URL), React components and/or full React apps in mobile and tab devices.

npm version Build Status Test Coverage Maintainability

Installing as a package

npm install react-device-emulator --save

Usage

import React from 'react'; import ReactDOM from 'react-dom'; import DeviceEmulator from 'react-device-emulator'; import 'react-device-emulator/lib/styles/style.css'; const App = () => { return ( <div> <DeviceEmulator type="tab" withDeviceSwitch withRotator> <h1>Welcome to React Device Emulator</h1> </DeviceEmulator> <DeviceEmulator type="mobile" withDeviceSwitch withRotator url="www.worksfair.com"> <DeviceEmulator type="tab" withoutChrome url="www.worksfair.com"> </div> ); }; ReactDOM.render(<App />, document.querySelector('#root')); // Remember to include the css in your file // Using webpack // import 'react-device-emulator/lib/styles/style.css'; // Using html tag: // <link rel="stylesheet" href="<NODE_MODULES_FOLDER>/react-device-emulator/styles/style.css" />

=====================

1. Mobile device with switch button and rotator
Screenshot 2019-09-26 at 5 47 20 PM
2. Tab device with Rotator only.
Screenshot 2019-09-26 at 5 46 43 PM
3. Tab device without the chrome
Screenshot 2019-09-26 at 5 47 46 PM

=====================

AttributesTypeDefaultDescription
withoutChromebooleanfalseremoves the device chrome and shows only the frame for the display
typestringmobilethe type of device. It can be mobile or tab
withDeviceSwitchbooleanfalseshow device switches for switching between device types
withRotatorbooleanfalseshow the rotate button for rotating the device
urlstring''for specifying the url of the website to be displayed in the emulator
isRotatedbooleanfalseused to initialize the emulator in a rotated state
childrenobjectnullthe children to the emulator component. Typically the app or component you want to show on the emulator

NB: When both url and children are provided, url will used and children ignored.

=====================

Setting up development environment

  • git clone https://github.com/TheoOkafor/react-device-emulator.git
  • yarn
  • yarn start
  • Open localhost:8080 on your favorite browser
Running tests
  • yarn test

Raising issues

When raising an issue, please add as much details as possible. Screenshots, video recordings, or anything else that can make it easier to reproduce the bug you are reporting will be appreciated. You can also suggest the features you want included in the subsequent versions.

Demo

react-device-emulator (1)

Keywords

FAQs

Last updated on 10 Jan 2023

Did you know?

Socket installs a Github app to automatically flag issues on every pull request and report the health of your dependencies. Find out what is inside your node modules and prevent malicious activity before you update the dependencies.

Install Socket
Socket
support@socket.devSocket SOC 2 Logo

Product

  • Package Issues
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc