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 🙏

© 2026 – Pkg Stats / Ryan Hefner

react-native-browser-with-polyfill

v1.0.1

Published

Polyfill-injecting WebView browser for React Native / Expo. Uses dependency injection to avoid SDK version conflicts.

Readme

react-native-browser-with-polyfill

A polyfill-injecting WebView browser component for React Native and Expo, built with a dependency injection pattern so it works across any SDK version.

Why Dependency Injection?

Expo SDK versions change frequently, and native module import paths shift between versions. Hardcoding imports of react-native, react, or react-native-webview causes build failures when your SDK version doesn't match.

This library sidesteps the problem entirely: instead of importing modules internally, createBrowser() accepts React, ReactNative, and Webview as parameters. The same package works with Expo SDK 45, SDK 50, or any version in between.

Install

Choose one of these two methods:

# Install from npm
npm install react-native-browser-with-polyfill
# Install directly from GitHub (unpublished / bleeding-edge)
npm install github:lequanghuylc/react-native-browser-with-polyfill

Using in Expo Snack

In Expo Snack, you don't run npm install. Instead, edit package.json directly and add the dependency:

{
  "dependencies": {
    "react-native-webview": "^13.0.0",
    "react-native-browser-with-polyfill": "github:lequanghuylc/react-native-browser-with-polyfill"
  }
}

Expo Snack will automatically install the package from GitHub when you save.

Quick Start

Basic Usage (without polyfills)

Copy-paste ready for Expo Snack:

import createBrowser from 'react-native-browser-with-polyfill';
import Webview from 'react-native-webview';
import * as React from 'react';
import * as ReactNative from 'react-native';

const { Browser } = createBrowser({ Webview, React, ReactNative });

export default function App() {
  return <Browser initialUrl="https://browserleaks.com/js" />;
}

With Polyfills (iPadOS 15 + Dev Keyboard Bar)

import createBrowser from 'react-native-browser-with-polyfill';
import Webview from 'react-native-webview';
import * as React from 'react';
import * as ReactNative from 'react-native';
import polyfillScript from 'react-native-browser-with-polyfill/src/polyfills/ipados15-polyfill';
import keyboardScript from 'react-native-browser-with-polyfill/src/polyfills/dev-keyboard-bar';

const { Browser } = createBrowser({ Webview, React, ReactNative });

export default function App() {
  return (
    <Browser
      initialUrl="https://browserleaks.com/js"
      polyfillScript={polyfillScript}
      keyboardScript={keyboardScript}
    />
  );
}

API

createBrowser({ Webview, React, ReactNative })

Creates a browser instance with dependency-injected modules.

Parameters:

| Param | Type | Description | | ------------ | ------------ | ----------------------------------- | | Webview | Component | react-native-webview WebView | | React | Module | react (use import * as React) | | ReactNative| Module | react-native (use import * as ReactNative) |

Returns:

{
  Browser,           // Main screen component
  WebViewScreen,     // Standalone WebView screen
  DevBar,            // Developer console bar
  useWebViewConsole  // Hook for the console log viewer
}

Browser Props

| Prop | Type | Default | Description | | ---------------- | -------- | ------- | ----------------------------------------- | | initialUrl | string | "about:blank" | URL to load on first render | | polyfillScript | string | null | JavaScript to inject into every page (e.g. ipados15 polyfill) | | keyboardScript | string | null | JavaScript to inject for the floating dev keyboard bar |

useWebViewConsole() Hook

Returns an object you can use to read and display the WebView's console output:

{
  logs: Array<{ time: string; type: string; content: string }>,
  addLog: (log: { type: string; content: string }) => void,
  clearLogs: () => void,
  handleWebViewMessage: (event: any) => void
}

Included Polyfills

src/polyfills/ipados15-polyfill.js

Safari 15 / iPadOS 15 compatibility polyfills:

  • Promise.withResolvers polyfill
  • DOMParser polyfill
  • AbortController / AbortSignal polyfill
  • URLPattern polyfill

src/polyfills/dev-keyboard-bar.js

Injects a floating toolbar at the bottom of the WebView that toggles a full-screen developer console overlay. Capture logs from the WebView and display them for debugging.

Architecture

react-native-browser-with-polyfill/
├── index.js                    # Single entry point — exports createBrowser
├── package.json
├── README.md
└── src/
    ├── createBrowser.jsx       # DI factory — accepts React, ReactNative, Webview
    └── polyfills/
        ├── ipados15-polyfill.js   # Safari 15 compatibility shims
        └── dev-keyboard-bar.js    # Floating dev toolbar

The library is intentionally minimal — a single entry point, no bundler required. It works with Expo, bare React Native, or any React Native CLI project.

License

MIT