npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

react-device-emulator

v1.1.3

Published

A device emulator for ReactJS apps

Downloads

507

Readme

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

2. Tab device with Rotator only.

3. Tab device without the chrome

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

| Attributes | Type | Default | Description | | :--------- | :--: | :-----: | :----------- | | withoutChrome | boolean | false | removes the device chrome and shows only the frame for the display | | type | string | mobile | the type of device. It can be mobile or tab | | withDeviceSwitch | boolean | false | show device switches for switching between device types | | withRotator | boolean | false | show the rotate button for rotating the device | | url | string | '' | for specifying the url of the website to be displayed in the emulator | | isRotated | boolean | false | used to initialize the emulator in a rotated state | | children | object | null | the 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)