Code Monkey home page Code Monkey logo

react-native-browser's Introduction

react-native-browser

A full-featured web browser module for React Native apps, based on the awesome TOWebViewController

TOWebViewController

Installation

  1. Run npm install react-native-browser --save in your project directory.
  • Open your project in XCode, right click on Libraries and click Add Files to "Your Project Name"
  • Inside your node_modules, find react-native-browser and add RCTBrowser.xcodeproj to your project.
  • Add libRTCBrowser.a to Build Phases -> Link Binary With Libraries
  • Whenever you want to use it within your React code, you can: var Browser = require('react-native-browser');

Usage

Example:

import {
  processColor, // make sure to add processColor to your imports if you want to use hex colors as shown below
} from 'react-native';

// at the top of your file near the other imports
var Browser = require('react-native-browser');

...


// wherever you want to trigger a browser modal appearing
Browser.open('https://google.com/');

// OR pass in options to customize
Browser.open('https://google.com/', {
                    showUrlWhileLoading: true,
                    loadingBarTintColor: processColor('#d64bbd'),
                    navigationButtonsHidden: false,
                    showActionButton: true,
                    showDoneButton: true,
                    doneButtonTitle: 'Done',
                    showPageTitles: true,
                    disableContextualPopupMenu: false,
                    hideWebViewBoundaries: false,
                    buttonTintColor: processColor('#d64bbd'),
                    titleTintColor: processColor('#d64bbd'),
                    barTintColor: processColor('#d64bbd')
                  });

Descriptions of options and their defaults

TODOs

  • Finish adding all customization options / support callbacks
  • Accessors for webview & url requests
  • Programatic control of loading pages, closing the view, etc

License

MIT License

react-native-browser's People

Contributors

blaues0cke avatar mfkp avatar skycocker 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  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  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

react-native-browser's Issues

Android release compilations fail

Android release compilation fails with this error:

com.facebook.react.common.JavascriptException: Requiring unknown module "react-native-browser"., stack:
                                                   n@2:700
                                                   o@2:404
                                                   e@2:326
                                                   i@2:188
                                                   <unknown>@673:255
                                                   o@2:517
                                                   e@2:326
                                                   i@2:188
                                                   <unknown>@383:403
                                                   o@2:517
                                                   e@2:326
                                                   i@2:188
                                                   <unknown>@12:40
                                                   o@2:517
                                                   e@2:256
                                                   i@2:188
                                                   global code@824:9
                                                   
                                                       at com.facebook.react.modules.core.ExceptionsManagerModule.showOrThrowError(ExceptionsManagerModule.java:97)
                                                       at com.facebook.react.modules.core.ExceptionsManagerModule.reportFatalException(ExceptionsManagerModule.java:81)
                                                       at java.lang.reflect.Method.invoke(Native Method)
                                                       at com.facebook.react.bridge.BaseJavaModule$JavaMethod.invoke(BaseJavaModule.java:318)
                                                       at com.facebook.react.cxxbridge.JavaModuleWrapper.invoke(JavaModuleWrapper.java:158)
                                                       at com.facebook.react.bridge.queue.NativeRunnable.run(Native Method)
                                                       at android.os.Handler.handleCallback(Handler.java:739)
                                                       at android.os.Handler.dispatchMessage(Handler.java:95)
                                                       at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:31)
                                                       at android.os.Looper.loop(Looper.java:234)
                                                       at com.facebook.react.bridge.queue.MessageQueueThreadImpl$3.run(MessageQueueThreadImpl.java:196)
                                                       at java.lang.Thread.run(Thread.java:818)

This is because the package.json is set to "main": "index.ios.js", rather than "main": "index.android.js", on android

Unsupported files are white

When opening some unsupported file like '.dwg' or something else, then it is just white, but when I open the same page in safari, then i get a preview with "Open in.." message

Opening PDFs hides top of the file

When opening pdf-s it doesn't take navigation bar into consideration when rendering file so to see it fully you have to scroll it down a bit.

Browser.presentUrl is undefined

I couldn't make it work with:

  • React Native 0.45
  • React 16 (alpha 12)
  • Expo (SDK 18)

I always get this error message when I trigger any basic Browser.open('http://www.wikipedia.com/');

undefined is not an object (evaluating 'Browser.presentUrl')

Any help would be appreciated.

@mfkp : Is this project still maintained?

non-modal

Hi,

Is there any way to open the browser in a non-modal view? For example, I would like to just have the browser be my main view in my react-native app. Is there any way to just do something like:

??

Thanks.

Can I display a non HTTPS page?

You mentioned in another issue that you recently updated the TOWebViewController – I guess I cannot use non HTTPS pages like http://example.com now but HTTPS pages work fine. I get a white page and I see the URL in the header.

Can you confirm that?

'React/RCTDefines.h' file not found with React Native > 0.60

Now that we have updated our app to use native modules (from instructions here), I'm now getting an error building this module.

When I try and build I get 'React/RCTDefines.h' file not found in RCTBridgeModule.h.

Is there a workaround for this? It's currently the only dependency we have that isn't working.

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.