Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-native-webview

Package Overview
Dependencies
Maintainers
4
Versions
329
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-native-webview

React Native WebView component for iOS, Android, macOS, and Windows

  • 13.12.5
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
711K
decreased by-29.41%
Maintainers
4
Weekly downloads
 
Created

What is react-native-webview?

The react-native-webview package is a powerful tool for embedding web content into a React Native application. It allows developers to render web pages, handle navigation, and interact with web content using JavaScript. This package is highly customizable and supports various features such as injecting JavaScript, handling navigation events, and more.

What are react-native-webview's main functionalities?

Basic WebView

This feature allows you to embed a basic web page within your React Native application. The WebView component takes a source prop that specifies the URL of the web page to be loaded.

import React from 'react';
import { WebView } from 'react-native-webview';

const MyWebView = () => (
  <WebView
    source={{ uri: 'https://www.example.com' }}
    style={{ marginTop: 20 }}
  />
);

export default MyWebView;

Injecting JavaScript

This feature allows you to inject JavaScript into the web page being loaded. The injectedJavaScript prop takes a string of JavaScript code that will be executed once the page has loaded.

import React from 'react';
import { WebView } from 'react-native-webview';

const MyWebView = () => (
  <WebView
    source={{ uri: 'https://www.example.com' }}
    injectedJavaScript={"document.body.style.backgroundColor = 'red';"}
    style={{ marginTop: 20 }}
  />
);

export default MyWebView;

Handling Navigation Events

This feature allows you to handle navigation events within the WebView. The onNavigationStateChange prop takes a function that will be called whenever the navigation state changes, providing details about the navigation event.

import React from 'react';
import { WebView } from 'react-native-webview';

const MyWebView = () => (
  <WebView
    source={{ uri: 'https://www.example.com' }}
    onNavigationStateChange={(navState) => {
      console.log('Navigation state changed:', navState);
    }}
    style={{ marginTop: 20 }}
  />
);

export default MyWebView;

Other packages similar to react-native-webview

FAQs

Package last updated on 03 Dec 2024

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