0.2.5 • Published 8 years ago
sl-react-native-web-webview v0.2.5
react-native-web-webview
React Native for Web implementation of RN's WebView
Getting started
$ npm install react-native-web-webview --save
Alias the package in your webpack config:
resolve: {
alias: {
'react-native': 'react-native-web',
...
'WebView': 'react-native-web-webview',
}
}Add the following rule to your webpack config:
const rule = {
test: /postMock.html$/,
use: {
loader: 'file-loader',
options: {
name: '[name].[ext]',
},
},
};Usage
import WebView from 'WebView'; // don't import from react-nativeSee RN's doc.
Supported props are:
sourceonMessagescrollEnabledinjectedJavaScript
Additional, web-specific props are:
newWindow: (boolean|{ name: string, features: string}) This will open the source in a new window, optionally giving it an internal name and custom features. By default, the name iswebviewand there are no features set. This is useful when your target has X-Frame-Options or a no-CORS policy. It currently only supports asourceprop with amethodset toPOST. Please feel free to do a PR to support more request types!title: (string) This prop will set thewebviewtitle.
Examples
See the storybook.
Contributing
PRs are welcome!
0.2.5
8 years ago