axa-rn-web-view
Version:
A middleware for webview
64 lines (47 loc) • 1.77 kB
Markdown
# AXA React Native Web View
A middleware for react-native-web-view. This package will help you locally embedded Static HTML site for your react native project.
## Installation
```npm
npm i axa-rn-web-view --save
```
## Usage
Import the `AxaWebView` component from `axa-rn-web-view` and use it like so:
```jsx
import React, { Component } from 'react';
import { Platform, StyleSheet, View, SafeAreaView } from 'react-native';
import AxaWebView from 'axa-rn-web-view';
export default class App extends Component {
onHandleNavigationChange = values => {
console.log(values);
};
render() {
const sourceUri =
(Platform.OS === 'android' ? 'file:///android_asset/' : '') +
'Web.bundle/loader.html';
return (
<View style={styles.container}>
<SafeAreaView style={styles.container}>
<AxaWebView
javaScriptEnabled={true}
originWhitelist={['*']}
sourceUri={sourceUri}
allowFileAccess={true}
handleNavigationChange={this.onHandleNavigationChange}
/>
</SafeAreaView>
</View>
);
}
}
const styles = StyleSheet.create({
container: {
flex: 1
}
});
```
For more, read the [API Reference](https://github.com/react-native-community/react-native-webview/blob/master/docs/Reference.md) and [Guide](https://medium.com/@caphun/react-native-load-local-static-site-inside-webview-2b93eb1c4225). If you're interested in contributing, check out the [Contributing Guide](./docs/Contributing.md).
## Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Please make sure to update tests as appropriate.
## License
[MIT](https://choosealicense.com/licenses/mit/)