New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

device-picker

Package Overview
Dependencies
Maintainers
19
Versions
33
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

device-picker

[![npm version](https://img.shields.io/npm/v/device-picker.svg?style=flat-square)](https://www.npmjs.com/package/device-picker)

  • 1.1.0
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
1
Maintainers
19
Weekly downloads
 
Created
Source

Device Picker

npm version

Device Picker Demo

Installation

npm install device-picker

Usage

import React from 'react';
import { View, DevicePicker } from 'device-picker';
import memoize from 'lodash/memoize';
function MyDevicePicker() {
   return (
         <DevicePicker
            allowOrphan={true}
            initialDevice={'iPhone'}
            initialView={View.Grid}
            fetchHierarchy={() =>
               fetch(
                  'https://www.cominor.com/api/2.0/wikis/CATEGORY?display=hierarchy',
               ).then(response => response.json())
            }
            fetchChildren={
                memoize(title =>
                    fetch(
                        `https://www.cominor.com/api/2.0/wikis/CATEGORY/${title}/children`,
                    ).then(response => response.json()),
                )
            }
            onSubmit={title => alert(`Selected "${title}"`)}
            onCancel={() => alert(`Cancelled`)}
            objectName="device"
         />
   );
}

export default MyDevicePicker;

Props

PropTypeDefaultRequiredDescription
allowOrphanbooleanfalseNo
initialDevicestring''NoDefault device to load picker with.
initialViewViewView.GridNoDefault layout for displaying devices. Available options View.Grid, View.Column. For IE defaults to View.Column
fetchHierarchyfunctionundefinedYesFunction to get devices categories
fetchChildrenfunctionundefinedYesFunction to get category items
onSubmitfunctionundefinedYesFunction that receives the device title.
onCancelfunctionundefinedYesFunction when picker is cancelled.
objectNamestringdeviceNoSingular object name for objects, usually "Device" or "Category".

Sample Integration

Contributing

Local development setup

Clone repo

git clone https://github.com/iFixit/device-picker.git

Change directory

cd device-picker

Install dependencies

npm install

Start dev server

npm run dev

FAQs

Package last updated on 13 Jan 2022

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc