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-native-device-mockup

v1.1.2

Published

react-native-device-mockup

Downloads

86

Readme

react-native-device-mockup

Static Badge Static Badge

GitHub Tag NPM Version NPM Unpacked Size

Static Badge GitHub top language GitHub License

You can check out the 🌐 full-demo-here
Package for React is 🌐 here

Index

  1. Introduction
  2. Installation
  3. How to use
  4. Props
  5. Demo
  6. License

Introduction

react-native-device-mockup provides frame mockups for Android and iOS devices.
You can use this library when you need a device demo for your app.
Every mockup is rendered as a pure react-native View component.

react-native-device-mockup provides the following mockups:

  1. Android
    1. Phone: 19.5:9 aspect ratio, AndroidMockup
    2. Tablet: 16:10 aspect ratio, AndroidTabMockup
  2. iOS
    1. iPhone, IPhoneMockup
      1. legacy iPhone: iPhone SE3
      2. notched iPhone: iPhone 14
      3. Dynamic island iPhone: iPhone 15 Pro
    2. iPad, IPadMockup
      1. legacy iPad 4:3 aspect ratio (home button)
      2. modern iPad: 4.3:3 aspect ratio (no home button)

Installation

No dependencies. Just install it

npm install react-native-device-mockup

or if you use yarn

yarn add react-native-device-mockup

How to use

import {
    AndroidMockup,
    AndroidTabMockup,
    IPhoneMockup,
    IPadMockup
}
from "react-native-device-mockup"


return (
  <>
    {/* Android Phone */}
    <AndroidMockup screenWidth={200}>
        {/* your demo */}
        <YourComponent>
          {...}
        </YourComponent>
    </AndroidMockup>

    {/* Android Tablet */}
    <AndroidTabMockup screenWidth={200}>
        {/* your demo */}
        <YourComponent>
          {...}
        </YourComponent>
    </AndroidTabMockup>

    {/* iPhone */}
    <IPhoneMockup screenWidth={200}>
        {/* your demo */}
        <YourComponent>
          {...}
        </YourComponent>
    </IPhoneMockup>

    {/* iPad */}
    <IPadMockup screenWidth={200}>
        {/* your demo */}
        <YourComponent>
          {...}
        </YourComponent>
    </IPadMockup>
  </>
)

Props

AndroidMockup & AndroidTabMockup

You can check demo

| prop | Required | Type | Default | Description | | ------------------ | :------: |----- | ------- | ----------- | | screenWidth | O | number | | Width of mockup screen details | | noRoundedScreen | X | boolean | false | No use rounded screen corners | | isLandscape | X | boolean | false | portrait or landscapefalse means portrait | | containerStlye | X | ViewStyle | | Styles for mockup container | | frameColor | X | ColorValue | "#666666" | Color of Frame | | frameOnly | X | boolean | false | Only the frame is shown.Power button and volume buttons are hidden | | statusbarColor | X | ColorValue | "#CCCCCC" | Color of status bar | | hideStatusBar | X | boolean | false | Hide the status bardetails | | navBar | X | "swipe""bhr""rhb" | "swipe" | Type of navigation bardetails | | navBarColor | X | ColorValue | "#CCCCCC" | Color of navigation bar | | transparentNavBar | X | boolean | false | Make the navigation bar transparent.details | | hideNavBar | X | boolean | false | Hide the navigation bardetails | | transparentCamArea | X | boolean | false | NOTE: AndroidMockup only.Make the area around the camera transparent.Only works when isLandscape=true.details | | children | X | ReactNode | | Components to be rendered on the mockup screen |

IPhoneMockup & IPadMockup

You can check demo

| prop | Required | Type | Default | Description | | ----- | :------: |----- | ------- | ----------- | | screenWidth | O | number | | Width of mockup screen details | | screenType | X | "legacy""notch""island" | "island" | for IPhoneMokcup"legacy": Classic iphone such as iPhone SE3"notch": Notched iPhone such as iPhone 14"island": Dynamic island iPhone such as iPhone 15 Pro | | screenType | X | "legacy""modern" | "modern" | for IPadMockup"legacy": Classic iPad such as iPad 9th"modern": Modern iPad such as iPad Pro 13' | | isLandscape | X | boolean | false | portrait or landscapefalse means portrait | | containerStlye | X | ViewStyle | | Styles for mockup container | | frameColor | X | ColorValue | "#666666" | Color of Frame | | frameOnly | X | boolean | false | Only the frame is shown.Power button and volume buttons are hidden | | statusbarColor | X | ColorValue | "#CCCCCC" | Color of status bar | | hideStatusBar | X | boolean | false | Hide the status bardetails | | transparentNavBar | X | boolean | false | Make the navigation bar transparent.details | | hideNavBar | X | boolean | false | Hide the navigation bardetails | | children | X | ReactNode | | Components to be rendered on the mockup screen |

screenWidth

  • AndroidMockup, AndroidTabMockup, IPhoneMockup, IPadMockup

Width of mockup screen.
The height is automatically calculated according to the ratio.

NOTE
It does not mean the full width of the mockup being rendered.

hideStatusBar

  • AndroidMockup, AndroidTabMockup, IPhoneMockup, IPadMockup

Hide the status bar.

  • false: Status bar occupies its own space with statusbarColor. (default)
  • true: Status bar no longer occupies its own area, but becomes part of the screen area.

NOTE
When isLandscape=true and screenType="legacy" in iPhoneMockup,
the status bar is always hidden regardless of hideStatusBar.
Even on the classic iPhone, the status bar is always hidden when in landscape mode.

navBar

  • AndroidMockup, AndroidTabMockup

Type of navigation bar.

  • "swipe": swipe gesture navigation bar. (modern style)
  • "bhr": back-home-recent buttons. (classic style)
  • "rhb": recent-home-back. (classic style)

transparentNavBar

  • AndroidMockup, AndroidTabMockup, IPhoneMockup, IPadMockup

Make the navigation bar transparent.

  • false: Navigation bar occupies its own space with navBarColor. (default)
  • true: Navigation bar no longer occupies its own area, but becomes part of the screen area.
    • NOTE: Swipe bar or buttons are rendered according to the type specified by navBar props.

NOTE
When screenType="legacy" in iPhoneMockup, transparentNavBar is always ignored.

hideNavBar

  • AndroidMockup, AndroidTabMockup, IPhoneMockup, IPadMockup

Hide the navigation bar.

  • false: Show the navigation bar. (default)
  • true: Hide the navigation bar.
    • Navigation bar no longer occupies its own area,
      but becomes part of the screen area.
    • NOTE: Swipe bar or buttons are NOT rendered according to the type specified by navBar props.

NOTE
When screenType="legacy" in iPhoneMockup, hideNavBar is always ignored.

transparentCamArea

  • AndroidMockup

AndroidMockup only.
Make the area around the camera transparent.
It only works when isLandscape=true.
It is ignored when isLandscape=false

CamArea (Camera area)
The part that was the status bar when in Portrait.
When in Landscape, in Android Native, this part is simply expressed as an empty (blank) area.

Demo

🌐 full-demo

Demo: Android

  • AndroidMockup
  • AndroidTabMockup

AndroidMockup default mockups

| isLandscape=false | isLandscape=true | | :--: | :--: | |and_default | and_default_land |

AndroidTabMockup default mockups

| isLandscape=false | isLandscape=true | | :--: | :--: | | and_tab | and_tab_land |

hideStatusBar & hideNavBar

hideStatusBar={true}
hideNavBar={true}

| isLandscape=false | isLandscape=true | | :--: | :--: | | and_all_hide | and_all_hide_land |

other props

| noRoundedScreen | frameColor="green"statusbarColor="red"navBarColor="blue" | | :--: | :--: | | and_noRoundedScreen | and_colors |

default with child

| isLandscape=false | isLandscape=true | | :--: | :--: | | and_default_child | and_land_default_child |

props.hideStatusBar

| isLandscape=false | isLandscape=true | | :--: | :--: | | hidestatusbar | hidestatusbar_land |

props.transparentNavBar

| isLandscape=false | isLandscape=true | | :--: | :--: | | trans_navinavBar="bhr" | trans_navi_landnavBar="bhr" |

props.hideNavBar

| isLandscape=false | isLandscape=true | | :--: | :--: | | hide_navi | hide_navi_land |

props.transparentCamArea

AndroidMockup, landscape only | isLandscape=false | isLandscape=true | | :--: | :--: | | none | transparentCamArea |

Demo: iOS

  • IPhoneMockup
  • IPadMockup

IPhoneMockup

All props not mentioned are default.
Props with the same name as props in AnroidMockup work the same way.

| screenType | isLandscape=false | isLandscape=true | | :--: | :--: | :--: | | "island" | iphone_island | iphone_island_land | | "notch" | iphone_notch | iphone_notch_land | | "legacy" | iphone_legacy | iphone_legacy_land |

IPadMockup

All props not mentioned are default.
Props with the same name as props in AnroidMockup work the same way.

| screenType | isLandscape=false | isLandscape=true | | :--: | :--: | :--: | | "modern" | ipad_modern | ipad_modern_land | | "legacy" | ipad_legacy | ipad_legacy_land |

License

MIT license