Socket
Book a DemoInstallSign in
Socket

@nativescript-use/nativescript-media-query

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@nativescript-use/nativescript-media-query

Add a plugin description

0.0.5
latest
Source
npmnpm
Version published
Weekly downloads
8
Maintainers
1
Weekly downloads
 
Created
Source

DEPRECATED. Nativescript introduced media queries in version 8.8. We've deprecated this package in favor of using @nativescript/core. Official documentation is available here.

@nativescript-use/nativescript-media-query

npm install @nativescript-use/nativescript-media-query

Usage

import { matchMedia, MediaQueryList } from "@nativescript-use/nativescript-media-query"

const mql: MediaQueryList = matchMedia("(min-width: 400)");

if (mql.matches) {
  /* The screen is at least 400 dpi wide */
} else {
  /* The screen is less than 400 dpi wide */
}


// Add listener
mql.onchange = (event: MediaQueryListEvent) => {
      // some logic
}); 

const myListener = () => console.log("Change!");
    
mql.addListener(myListener);

// Remove listener
mql.removeListener(myListener);

Type declaration

export interface MediaQueryList {
    readonly matches: boolean;
    readonly media: string;
    onchange: ((this: MediaQueryList, ev: MediaQueryListEvent) => any) | null;
    addListener(listener: MediaQueryListListener): void;
    removeListener(listener: MediaQueryListListener): void;
}

export type MediaQueryListListener = (mql: MediaQueryList) => void;

export interface MediaQueryListEvent {
    readonly matches: boolean;
    readonly media: string;
}

export declare function matchMedia(mediaQueryString: string): MediaQueryList;

License

Apache License Version 2.0

Keywords

NativeScript

FAQs

Package last updated on 24 Mar 2025

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

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.