react-native-match-media

window.matchMedia mock for React Native

Usage no npm install needed!

<script type="module">
  import reactNativeMatchMedia from 'https://cdn.skypack.dev/react-native-match-media';
</script>

README

react-native-match-media

window.matchMedia polyfill for React Native

Has a peer dependency of walmartreact/react-native-orientation-listener, so make sure that's installed first.

Usage

import matchMedia from 'react-native-match-media'

global.matchMedia = matchMedia
if (global.matchMedia('(min-width: 400px)').matches) {
  // Do something
}

License

MIT