Code Monkey home page Code Monkey logo

react-native-advanced-webview's Introduction

react-native-advanced-webview

Features

extended WebView with more advanced WebView features

  • initialJavaScript Same as injectedJavaScript prop but will execute the JavaScript code on page loading started instead of on page loading finished

  • allowFileAccessFromFileURLs

Install

npm i react-native-advanced-webview --save
react-native link react-native-advanced-webview

react-native-advanced-webview's People

Contributors

greedbell avatar magicismight avatar wsong910 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

react-native-advanced-webview's Issues

android report an error

uses-sdk:minSdkVersion 16 cannot be smaller than version 19 declared in library [editor:react-native-advanced-webview:unspecified] /Users/afei/Codes/test/editor/android/app/build/intermediates/exploded-aar/editor/react-native-advanced-webview/unspecified/AndroidManifest.xml
Suggestion: use tools:overrideLibrary="im.shimo.react.webview" to force usage

iOS PropTypes import issue

PropTypes is a standalone module now, so first two lines of WebView.ios.js need to be changed into:

import React, { cloneElement } from 'react';
import PropTypes from 'prop-types';

iOS: NSPOSIXErrorDomain Error Code 1 when using local source

Hi. I started using this plugin just to hide the form bar above the keyboard in my app’s webview, but now I get an NSPOSIXErrorDomain error every time I install the app on a device, but the weird part is it only happens when the app is installed from Test Flight. The error does not appear when building it and running it on a device via Xcode.

This has never happened when using React Native’s built-in WebView.

I am using the allowFileAccessFromFileURLs prop.

      <WebView
            style={styles.webView}
            ref={(ref) => { this.webView = ref; }}
            scrollEnabled={false}
            javaScriptEnabled
            javaScriptEnabledAndroid
            hideAccessory
            allowFileAccessFromFileURLs
            source={require('./index.html')}
            onLoad={this.sendDataToWebview}
            onMessage={event => this.handleOnMessage(event.nativeEvent.data)}
            onNavigationStateChange={(event) => {
              // https://stackoverflow.com/a/40382325
              if (event.navigationType && event.navigationType === 'click') {
                this.webView.stopLoading();
                Linking.openURL(event.url);
              }
            }}
       />

Getting an Android Specific error

I get this error and it seems to be when the webview is unmounting.

Attempt to write to field 'java.util.ArrayList im.shimo.react.webview.AdvancedWebViewManager$AdvancedWebViewClient.mPendingMessages' on a null object reference
onDropViewInstance
    AdvancedWebViewManager.java:463
onDropViewInstance
    AdvancedWebViewManager.java:48
dropView
    NativeViewHierarchyManager.java:573
dropView
    NativeViewHierarchyManager.java:584
dropView
    NativeViewHierarchyManager.java:584
dropView
    NativeViewHierarchyManager.java:584
dropView
    NativeViewHierarchyManager.java:584
dropView
    NativeViewHierarchyManager.java:584
manageChildren
    NativeViewHierarchyManager.java:470
execute
    UIViewOperationQueue.java:227
run
    UIViewOperationQueue.java:894
flushPendingBatches
    UIViewOperationQueue.java:1001
access$2400
    UIViewOperationQueue.java:46
doFrameGuarded
    UIViewOperationQueue.java:1061
doFrame
    GuardedFrameCallback.java:29
doFrame
    ReactChoreographer.java:134
doFrame
    ChoreographerCompat.java:105
run
    Choreographer.java:947
doCallbacks
    Choreographer.java:761
doFrame
    Choreographer.java:693
run
    Choreographer.java:935
handleCallback
    Handler.java:873
dispatchMessage
    Handler.java:99
loop
    Looper.java:193
main
    ActivityThread.java:6669
invoke
    Method.java
run
    RuntimeInit.java:493
main
    ZygoteInit.java:858

The React Native Repo has an issue open here. Any advice would be greatly appreciated, especially if anyone has seen this before.

Using:

React Native: 0.57.7
React: 16.6.3
android {
    compileSdkVersion 26
    buildToolsVersion '27.0.3'
    defaultConfig {
        minSdkVersion 21
        targetSdkVersion 26
        versionCode 1
        versionName version
        multiDexEnabled true
        ndk {
            abiFilters "armeabi-v7a", "x86"
        }
    }
}

Build error

/react-native-advanced-webview/ios/RNAdvancedWebView.h:1:9: fatal error: 'React/RCTWebView.h' file not found
#import <React/RCTWebView.h>

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.