[BREAKGLASS] Append-only mirror of github.com/bluewallet/react-native-inappbrowser
| android | ||
| example | ||
| flow-typed | ||
| img | ||
| ios | ||
| .babelrc | ||
| .flowconfig | ||
| .gitattributes | ||
| .gitignore | ||
| index.js | ||
| package-lock.json | ||
| package.json | ||
| README.md | ||
InAppBrowser for React Native
Getting started
$ npm install react-native-inappbrowser-reborn --save
Mostly automatic installation
$ react-native link react-native-inappbrowser-reborn
Manual installation
iOS
- In XCode, in the project navigator, right click
Libraries➜Add Files to [your project's name] - Go to
node_modules➜react-native-inappbrowser-rebornand addRNInAppBrowser.xcodeproj - In XCode, in the project navigator, select your project. Add
libRNInAppBrowser.ato your project'sBuild Phases➜Link Binary With Libraries - Run your project (
Cmd+R)<
Android
- Open up
android/app/src/main/java/[...]/MainActivity.java
- Add
import com.proyecto26.inappbrowser.RNInAppBrowserPackage;to the imports at the top of the file - Add
new RNInAppBrowserPackage()to the list returned by thegetPackages()method
- Append the following lines to
android/settings.gradle:include ':react-native-inappbrowser-reborn' project(':react-native-inappbrowser-reborn').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-inappbrowser-reborn/android') - Insert the following lines inside the dependencies block in
android/app/build.gradle:compile project(':react-native-inappbrowser-reborn')
Usage
import RNInAppBrowser from 'react-native-inappbrowser-reborn';
...
async openLink() {
try {
await InAppBrowser.isAvailable()
InAppBrowser.open('https://www.google.com', {
// iOS Properties
dismissButtonStyle: 'cancel',
preferredBarTintColor: 'gray',
preferredControlTintColor: 'white',
// Android Properties
showTitle: true,
toolbarColor: '#6200EE',
secondaryToolbarColor: 'black',
enableUrlBarHiding: true,
enableDefaultShare: true,
}).then((result) => {
Alert.alert(JSON.stringify(result))
})
} catch (error) {
Alert.alert(error.message)
}
}
...
Supporting 🍻
I believe in Unicorns 🦄 Support me, if you do too.
Happy coding 💯
Made with ❤️