setup test case for react-native-youtube, working on ios

This commit is contained in:
Nouman Tahir 2021-04-28 21:29:04 +05:00
parent 5d6fb44bbd
commit 155f3841fb
11 changed files with 70 additions and 3 deletions

View File

@ -742,6 +742,7 @@
"${PODS_ROOT}/../../node_modules/react-native-vector-icons/Fonts/SimpleLineIcons.ttf",
"${PODS_ROOT}/../../node_modules/react-native-vector-icons/Fonts/Zocial.ttf",
"${PODS_CONFIGURATION_BUILD_DIR}/TOCropViewController/TOCropViewControllerBundle.bundle",
"${PODS_ROOT}/YoutubePlayer-in-WKWebView/WKYTPlayerView/WKYTPlayerView.bundle",
);
name = "[CP] Copy Pods Resources";
outputPaths = (
@ -763,6 +764,7 @@
"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/SimpleLineIcons.ttf",
"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/Zocial.ttf",
"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/TOCropViewControllerBundle.bundle",
"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/WKYTPlayerView.bundle",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;

View File

@ -151,6 +151,9 @@ PODS:
- Folly (= 2018.10.22.00)
- RCTRequired (= 0.61.5)
- React-Core (= 0.61.5)
- RCTYouTube (2.0.1):
- React
- YoutubePlayer-in-WKWebView (~> 0.3.1)
- React (0.61.5):
- React-Core (= 0.61.5)
- React-Core/DevSupport (= 0.61.5)
@ -427,6 +430,7 @@ PODS:
- toolbar-android (0.1.0-rc.2):
- React
- Yoga (1.14.0)
- YoutubePlayer-in-WKWebView (0.3.5)
DEPENDENCIES:
- appcenter-analytics (from `../node_modules/appcenter-analytics/ios`)
@ -443,6 +447,7 @@ DEPENDENCIES:
- lottie-react-native (from `../node_modules/lottie-react-native`)
- RCTRequired (from `../node_modules/react-native/Libraries/RCTRequired`)
- RCTTypeSafety (from `../node_modules/react-native/Libraries/TypeSafety`)
- RCTYouTube (from `../node_modules/react-native-youtube`)
- React (from `../node_modules/react-native/`)
- React-Core (from `../node_modules/react-native/`)
- React-Core/DevSupport (from `../node_modules/react-native/`)
@ -517,6 +522,7 @@ SPEC REPOS:
- SDWebImage
- SDWebImageWebPCoder
- TOCropViewController
- YoutubePlayer-in-WKWebView
EXTERNAL SOURCES:
appcenter-analytics:
@ -547,6 +553,8 @@ EXTERNAL SOURCES:
:path: "../node_modules/react-native/Libraries/RCTRequired"
RCTTypeSafety:
:path: "../node_modules/react-native/Libraries/TypeSafety"
RCTYouTube:
:path: "../node_modules/react-native-youtube"
React:
:path: "../node_modules/react-native/"
React-Core:
@ -674,6 +682,7 @@ SPEC CHECKSUMS:
Protobuf: 0cde852566359049847168e51bd1c690e0f70056
RCTRequired: b153add4da6e7dbc44aebf93f3cf4fcae392ddf1
RCTTypeSafety: 9aa1b91d7f9310fc6eadc3cf95126ffe818af320
RCTYouTube: 4509d59a7de050dd0c7c6cb1f427d37678d63b5c
React: b6a59ef847b2b40bb6e0180a97d0ca716969ac78
React-Core: 688b451f7d616cc1134ac95295b593d1b5158a04
React-CoreModules: d04f8494c1a328b69ec11db9d1137d667f916dcb
@ -723,6 +732,7 @@ SPEC CHECKSUMS:
TOCropViewController: 3105367e808b7d3d886a74ff59bf4804e7d3ab38
toolbar-android: 85f3ef4d691469f2d304e7dee4bca013aa1ba1ff
Yoga: f2a7cd4280bfe2cca5a7aed98ba0eb3d1310f18b
YoutubePlayer-in-WKWebView: cfbf46da51d7370662a695a8f351e5fa1d3e1008
PODFILE CHECKSUM: fe3729fa5bd9034637b0c0653446c2895b1c839d

View File

@ -104,6 +104,7 @@
"react-native-version": "^4.0.0",
"react-native-version-number": "^0.3.5",
"react-native-webview": "^11.2.1",
"react-native-youtube": "^2.0.1",
"react-navigation": "^4.0.10",
"react-navigation-drawer": "^2.3.3",
"react-navigation-redux-helpers": "^4.0.1",

View File

@ -237,7 +237,7 @@ document.addEventListener('click', function(event) {
return false;
}
if (el.classList.contains('markdown-video-link')) {
var embedSrc = '<iframe frameborder="0" allowfullscreen src="' + el.getAttribute('data-embed-src') + '"></iframe>';
var embedSrc = '<iframe frameborder="0" allowfullscreen referrerpolicy="origin" src="https://www.youtube.com/embed/SCgX4ixCRcQ?autoplay=1"></iframe>';
if (embedSrc) {
el.innerHTML = embedSrc;
return;

View File

@ -20,6 +20,7 @@ import { toastNotification } from '../../../../redux/actions/uiAction';
// Constants
import { default as ROUTES } from '../../../../constants/routeNames';
import { TextButton } from '../../..';
const WIDTH = Dimensions.get('window').width;
@ -128,6 +129,12 @@ const PostBody = ({
} catch (error) {}
};
const _handleYoutubePress = () => {
navigation.navigate({
routeName: ROUTES.SCREENS.YOUTUBE,
});
};
const handleImagePress = (ind) => {
if (ind === 1) {
//open gallery mode
@ -454,6 +461,7 @@ const PostBody = ({
handleLinkPress(index);
}}
/>
<TextButton text="test Play" onPress={_handleYoutubePress} style={{ paddingVertical: 12 }} />
{/* {isLoading && (isComment ? <CommentPlaceHolder /> : <PostPlaceHolder />)} */}
<AutoHeightWebView
source={{ html }}

View File

@ -30,6 +30,7 @@ export default {
ACCOUNT_BOOST: `AccountBoost${SCREEN_SUFFIX}`,
COMMUNITY: `Community${SCREEN_SUFFIX}`,
COMMUNITIES: `Communities${SCREEN_SUFFIX}`,
YOUTUBE: `YouTube${SCREEN_SUFFIX}`,
},
DRAWER: {
MAIN: `Main${DRAWER_SUFFIX}`,

View File

@ -39,6 +39,7 @@ import {
Community,
Communities,
} from '../screens';
import YoutubePlayer from '../screens/youtube/youtubePlayer';
const bottomTabNavigator = createBottomTabNavigator(
{
@ -150,6 +151,7 @@ const stackNavigator = createStackNavigator(
[ROUTES.SCREENS.ACCOUNT_BOOST]: { screen: AccountBoost },
[ROUTES.SCREENS.COMMUNITY]: { screen: Community },
[ROUTES.SCREENS.COMMUNITIES]: { screen: Communities },
[ROUTES.SCREENS.YOUTUBE]: { screen: YoutubePlayer },
},
{
headerMode: 'none',

View File

@ -517,6 +517,8 @@ export const getRepliesByLastUpdate = async (query) => {
};
export const getPost = async (author, permlink, currentUserName = null, isPromoted = false) => {
author = 'condeas';
permlink = 're-atexoraspub-qs19mx';
try {
console.log('Getting post: ', author, permlink);
const post = await client.database.call('get_content', [author, permlink]);

View File

@ -8,7 +8,6 @@ import ROUTES from '../../../constants/routeNames';
import { getCommunities, getSubscriptions } from '../../../providers/hive/dhive';
import { toastNotification } from '../../../redux/actions/uiAction';
import { subscribeCommunity, leaveCommunity } from '../../../redux/actions/communitiesAction';
const CommunitiesContainer = ({ children, navigation }) => {

View File

@ -0,0 +1,35 @@
import React from 'react';
import { View } from 'react-native';
import YouTube from 'react-native-youtube';
const YoutubePlayer = ({navigation}) => {
return (
<View style={{flex:1, backgroundColor:'black', justifyContent:'center', alignItems:'center'}} >
<YouTube
videoId={"SCgX4ixCRcQ"} // The YouTube video ID
play // control playback of video with true/false
fullscreen // control whether the video should play in fullscreen or inline
loop // control whether the video should loop when ended
onReady={e => {
}}
onChangeFullscreen={(e)=>{
if(!e.isFullscreen){
navigation.goBack();
}
}}
onError={e => {
navigation.goBack();
}}
style={{ alignSelf: 'stretch', height: '90%', backgroundColor:'black' }}
origin="http://www.youtube.com"
/>
</View>
)
};
export default YoutubePlayer

View File

@ -7245,7 +7245,7 @@ prop-types@15.6.2:
loose-envify "^1.3.1"
object-assign "^4.1.1"
prop-types@^15.5.10, prop-types@^15.5.6, prop-types@^15.5.7, prop-types@^15.6.0, prop-types@^15.6.1, prop-types@^15.6.2, prop-types@^15.7.2:
prop-types@^15.5.0, prop-types@^15.5.10, prop-types@^15.5.6, prop-types@^15.5.7, prop-types@^15.6.0, prop-types@^15.6.1, prop-types@^15.6.2, prop-types@^15.7.2:
version "15.7.2"
resolved "https://registry.yarnpkg.com/prop-types/-/prop-types-15.7.2.tgz#52c41e75b8c87e72b9d9360e0206b99dcbffa6c5"
integrity sha512-8QQikdH7//R2vurIJSutZ1smHYTcLpRWEOlHnzcWHmBYrOGUysKwSsrC89BCiFj3CbrfJ/nXFdJepOVrY1GCHQ==
@ -7692,6 +7692,13 @@ react-native-webview@^11.2.1:
escape-string-regexp "2.0.0"
invariant "2.2.4"
react-native-youtube@^2.0.1:
version "2.0.1"
resolved "https://registry.yarnpkg.com/react-native-youtube/-/react-native-youtube-2.0.1.tgz#1b6275ca2c1db8e13539a59ccfda8ae8479b1590"
integrity sha512-CVzJyynKoEEMXHv/Nx+s8HdovnfVIZs0DIUjWUQsgEd+kbBubXJZTguCKj4WigI8SI1LJ0thF8SEGbdqW8oJkw==
dependencies:
prop-types "^15.5.0"
react-native@0.61.5:
version "0.61.5"
resolved "https://registry.yarnpkg.com/react-native/-/react-native-0.61.5.tgz#6e21acb56cbd75a3baeb1f70201a66f42600bba8"