Skip to content

Commit

Permalink
web-platform support (#85)
Browse files Browse the repository at this point in the history
* web-platform support

* fix linting

* platform-specific wrapper around WebView

* react-native-web-webview peerDep

* WebView is NOT default export
  • Loading branch information
oxyii committed Nov 30, 2020
1 parent cb660a7 commit b2ee3ef
Show file tree
Hide file tree
Showing 8 changed files with 1,642 additions and 18 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
node_modules
.vscode
.vscode
.idea
dist
6 changes: 6 additions & 0 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module.exports = function (api) {
api.cache(true);
return {
presets: ['module:metro-react-native-babel-preset'],
};
};
17 changes: 12 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,13 @@
"name": "react-native-youtube-iframe",
"version": "1.4.0",
"description": "A simple wrapper around the youtube iframe js API for react native",
"main": "index.js",
"main": "dist/index.js",
"types": "index.d.ts",
"scripts": {
"lint": "eslint index.js src",
"test": "echo \"Error: no test specified\" && exit 1"
"lint": "eslint src",
"test": "echo \"Error: no test specified\" && exit 1",
"build": "rm -rf dist && babel src --out-dir dist",
"prepare": "yarn build"
},
"repository": {
"type": "git",
Expand Down Expand Up @@ -34,11 +37,15 @@
"peerDependencies": {
"react": ">=16.8.6",
"react-native": ">=0.60",
"react-native-webview": ">=7.0.0"
"react-native-webview": ">=7.0.0",
"react-native-web-webview": ">=1.0.2"
},
"devDependencies": {
"@babel/cli": "^7.2.3",
"@babel/core": "^7.2.2",
"@react-native-community/eslint-config": "^2.0.0",
"eslint": "^7.7.0"
"eslint": "^7.7.0",
"metro-react-native-babel-preset": "^0.64.0"
},
"dependencies": {
"events": "^3.2.0"
Expand Down
1 change: 1 addition & 0 deletions src/WebView.native.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export {WebView} from 'react-native-webview';
1 change: 1 addition & 0 deletions src/WebView.web.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export {WebView} from 'react-native-web-webview';
2 changes: 1 addition & 1 deletion src/YoutubeIframe.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import React, {
useImperativeHandle,
} from 'react';
import {View, StyleSheet, Platform} from 'react-native';
import WebView from 'react-native-webview';
import {WebView} from './WebView';
import {PLAYER_STATES, PLAYER_ERROR, CUSTOM_USER_AGENT} from './constants';
import {EventEmitter} from 'events';
import {
Expand Down
6 changes: 3 additions & 3 deletions index.js → src/index.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import YoutubeIframe from './src/YoutubeIframe';
import {getYoutubeMeta} from './src/oEmbed';
import YoutubeIframe from './YoutubeIframe';
import {getYoutubeMeta} from './oEmbed';
import {
PLAYER_STATES_NAMES as PLAYER_STATES,
PLAYER_ERROR_NAMES as PLAYER_ERRORS,
} from './src/constants';
} from './constants';

export default YoutubeIframe;
export {getYoutubeMeta, PLAYER_STATES, PLAYER_ERRORS};
1,623 changes: 1,615 additions & 8 deletions yarn.lock

Large diffs are not rendered by default.

0 comments on commit b2ee3ef

Please sign in to comment.