React Native per a la implementació web de WebView de RN
react-native-web-webview
React Native per a la implementació web de WebView de RN
Començant
$ npm install react-native-web-webview --save
Àlies del paquet de la configuració de la vostra webpack:
resolve: { alias: { 'react-native': 'react-native-web', ... 'react-native-webview': 'react-native-web-webview', } }
Afegiu la següent regla a la configuració de webpack:
const rule = { test: /postMock.html$/, use: { loader: 'file-loader', options: { name: '[name].[ext]', }, }, };
Ús
import { WebView } from 'react-native-webview';
Veure Doc de RN .
Els accessoris compatibles són:
source
onMessage
scrollEnabled
injectedJavaScript
style
Els accessoris addicionals específics del web són:
newWindow
: ( booleà | {nom: cadena, característiques: cadena} ) Això obrirà la font en una finestra nova, opcionalment donant-li un nom intern i funcions personalitzades . Per defecte, el nom éswebview
i no hi ha cap funció configurada. Això és útil quan el vostre objectiu té X-Frame-Options o una política sense CORS. Actualment només admet unsource
puntal amb unmethod
s'estableix enPOST
. No dubteu a fer un PR per donar suport a més tipus de sol·licituds.title
: ( corda ) Aquest punt fixarà elwebview
títol.
Exemples
Vegeu el llibre de contes .
Contribuint
Els PR són benvinguts!
Detalls de la descàrrega:
Autor: react-native-web-community
Demostració en directe: https://react-native-web-community.github.io/react-native-web-webview/storybook
GitHub: https://github.com/react-native-web-community/react-native-web-webview
# react-native #react # mobile-apps