Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ivanph/react-native-webintent
React-native module for android to open urls in the default browser
https://github.com/ivanph/react-native-webintent
Last synced: 6 days ago
JSON representation
React-native module for android to open urls in the default browser
- Host: GitHub
- URL: https://github.com/ivanph/react-native-webintent
- Owner: ivanph
- License: mit
- Created: 2015-09-23T23:57:48.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2015-12-07T06:11:50.000Z (about 9 years ago)
- Last Synced: 2024-11-13T02:39:38.962Z (about 1 month ago)
- Language: Java
- Homepage:
- Size: 86.9 KB
- Stars: 53
- Watchers: 3
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-react-native - react-native-webintent ★53 - React native android module to open links in the default browser (Components / Web)
- awesome-react-native - react-native-webintent ★53 - React native android module to open links in the default browser (Components / Web)
- awesome-react-native - react-native-webintent ★53 - React native android module to open links in the default browser (Components / Web)
- awesome-react-native-ui - react-native-webintent ★47 - React native android module to open links in the default browser (Components / Web)
- awesome-react-native - react-native-webintent ★53 - React native android module to open links in the default browser (Components / Web)
README
# react-native-webintent
A React Native web intent for Android. Allows to open links in the default browser.
### Notice
As of [version 0.15](https://github.com/facebook/react-native/releases/tag/v0.15.0) react-native includes a `IntentAndroid` module that might suit yours needs better.
### Installation
```bash
npm install --save react-native-webintent
```### Add it to your android project
* In `android/setting.gradle`
```gradle
...
include ':RNWebIntent', ':app'
project(':RNWebIntent').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-webintent')
```* In `android/app/build.gradle`
```gradle
...
dependencies {
...
compile project(':RNWebIntent')
}
```* register module (in MainActivity.java)
```java
import com.ivanph.webintent.RNWebIntentPackage;; // <--- importpublic class MainActivity extends Activity implements DefaultHardwareBackBtnHandler {
......@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mReactRootView = new ReactRootView(this);mReactInstanceManager = ReactInstanceManager.builder()
.setApplication(getApplication())
.setBundleAssetName("index.android.bundle")
.setJSMainModuleName("index.android")
.addPackage(new MainReactPackage())
.addPackage(new RNWebIntentPackage()) // <------ add here
.setUseDeveloperSupport(BuildConfig.DEBUG)
.setInitialLifecycleState(LifecycleState.RESUMED)
.build();mReactRootView.startReactApplication(mReactInstanceManager, "ExampleRN", null);
setContentView(mReactRootView);
}......
}
```## Example
```javascript
var WebIntent = require('react-native-webintent');WebIntent.open('https://google.com');
```
## LicenseMIT