Skip to content

Commit b98178c

Browse files
committed
Dynamically select channel
1 parent f29709e commit b98178c

File tree

13 files changed

+142
-95
lines changed

13 files changed

+142
-95
lines changed

projects/twitchCloneExpo/App.tsx

Lines changed: 21 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,15 @@
1+
import { Pressable, View, Image, StyleSheet } from "react-native";
12
import { AntDesign } from "@expo/vector-icons";
2-
import { Pressable, View,Image } from 'react-native';
3-
import { NavigationContainer, useNavigation } from "@react-navigation/native";
3+
import { NavigationContainer } from "@react-navigation/native";
44
import { createNativeStackNavigator } from "@react-navigation/native-stack";
5-
import MainScreen from './src/screen/mainScreen';
6-
import LiveScreen from './src/screen/liveStream';
7-
import { RootStackParamList, SearchScreenProps } from './types';
8-
import SearchScreen from "./src/screen/main_screens/search";
9-
10-
11-
12-
135

6+
import MainScreen from "./src/screen/mainScreen";
7+
import LiveScreen from "./src/screen/liveStream";
8+
import SearchScreen from "./src/screen/main_screens/search";
9+
import { RootStackParamList } from "./types";
1410

1511
const Stack = createNativeStackNavigator<RootStackParamList>();
1612

17-
1813
export default function App() {
1914
return (
2015
<NavigationContainer>
@@ -29,7 +24,7 @@ export default function App() {
2924
source={{
3025
uri: "https://avatars.githubusercontent.com/u/24194413?s=96&v=4",
3126
}}
32-
style={{ width: 30, height: 30, borderRadius: 200 / 2 }}
27+
style={styles.avatar}
3328
/>
3429
),
3530
headerRight: () => (
@@ -77,7 +72,7 @@ export default function App() {
7772
</Pressable>
7873

7974
<Pressable
80-
onPress={({ }) => {
75+
onPress={({}) => {
8176
// const navigation = useNavigation();
8277
// navigation.navigate({ key: "Search" });
8378
}}
@@ -87,9 +82,9 @@ export default function App() {
8782
>
8883
<AntDesign
8984
name="search1"
90-
size={25}
85+
size={styles.icon.height}
9186
color="black"
92-
style={{ marginRight: 15 }}
87+
style={styles.icon}
9388
/>
9489
</Pressable>
9590
</View>
@@ -108,4 +103,14 @@ export default function App() {
108103
);
109104
}
110105

111-
106+
const styles = StyleSheet.create({
107+
icon: {
108+
marginRight: 15,
109+
height: 25,
110+
},
111+
avatar: {
112+
width: 30,
113+
height: 30,
114+
borderRadius: 200 / 2
115+
}
116+
})

projects/twitchCloneExpo/app.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,7 @@
1313
"updates": {
1414
"fallbackToCacheTimeout": 0
1515
},
16-
"assetBundlePatterns": [
17-
"**/*"
18-
],
16+
"assetBundlePatterns": ["**/*"],
1917
"ios": {
2018
"supportsTablet": false
2119
},

projects/twitchCloneExpo/babel.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
module.exports = function(api) {
1+
module.exports = function (api) {
22
api.cache(true);
33
return {
44
presets: ["babel-preset-expo"],

projects/twitchCloneExpo/package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
"android": "expo start --android",
88
"ios": "expo start --ios",
99
"web": "expo start --web",
10-
"eject": "expo eject"
10+
"eject": "expo eject",
11+
"lint-fix": "prettier --write ."
1112
},
1213
"dependencies": {
1314
"@react-native-community/netinfo": "7.1.3",
@@ -42,6 +43,7 @@
4243
"@babel/core": "^7.12.9",
4344
"@types/react": "~17.0.21",
4445
"@types/react-native": "~0.64.12",
46+
"prettier": "^2.5.1",
4547
"typescript": "~4.3.5"
4648
},
4749
"private": true

projects/twitchCloneExpo/src/components/thumbnail.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ const styles = StyleSheet.create({
3737
justifyContent: "flex-start",
3838
paddingVertical: 4,
3939
paddingLeft: 20,
40-
marginVertical:15
40+
marginVertical: 15,
4141
},
4242
image: {
4343
resizeMode: "cover",

projects/twitchCloneExpo/src/components/videoComponent.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ import { StyleSheet, Dimensions } from "react-native";
33
import { Video, AVPlaybackStatus } from "expo-av";
44

55
const VideoComponent = ({ url }: { url: string }) => {
6-
7-
86
return (
97
<Video
108
isMuted={true}
@@ -24,7 +22,7 @@ const VideoComponent = ({ url }: { url: string }) => {
2422

2523
const styles = StyleSheet.create({
2624
video: {
27-
backgroundColor:"black",
25+
backgroundColor: "black",
2826
flex: 1,
2927
alignSelf: "auto",
3028
width: Dimensions.get("window").width,

projects/twitchCloneExpo/src/hooks/channelHook.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,59 +2,69 @@ import { LiveStreamChannel } from "../models/channel";
22

33
const useStreamChannel = () => {
44
const stream1 = new LiveStreamChannel(
5+
"okey",
56
"https://storage.googleapis.com/gtv-videos-bucket/sample/images/BigBuckBunny.jpg",
67
"https://storage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4",
78
"Okey"
89
);
910
const stream2 = new LiveStreamChannel(
11+
"mads",
1012
"https://storage.googleapis.com/gtv-videos-bucket/sample/images/ElephantsDream.jpg",
1113
"https://storage.googleapis.com/gtv-videos-bucket/sample/ElephantsDream.mp4",
1214
"Mads"
1315
);
1416

1517
const stream3 = new LiveStreamChannel(
18+
"vish",
1619
"https://storage.googleapis.com/gtv-videos-bucket/sample/images/ForBiggerBlazes.jpg",
1720
"https://storage.googleapis.com/gtv-videos-bucket/sample/ForBiggerBlazes.mp4",
1821
"Vish"
1922
);
2023

2124
const stream4 = new LiveStreamChannel(
25+
"khushal",
2226
"https://storage.googleapis.com/gtv-videos-bucket/sample/images/ForBiggerEscapes.jpg",
2327
"https://storage.googleapis.com/gtv-videos-bucket/sample/ForBiggerEscapes.mp4",
2428
"Kushal"
2529
);
2630

2731
const stream5 = new LiveStreamChannel(
32+
"enigma",
2833
"https://storage.googleapis.com/gtv-videos-bucket/sample/images/ForBiggerFun.jpg",
2934
"https://storage.googleapis.com/gtv-videos-bucket/sample/ForBiggerFun.mp4",
3035
"Enigma"
3136
);
3237

3338
const stream6 = new LiveStreamChannel(
39+
"paradox",
3440
"https://storage.googleapis.com/gtv-videos-bucket/sample/images/ForBiggerJoyrides.jpg",
3541
"https://storage.googleapis.com/gtv-videos-bucket/sample/ForBiggerJoyrides.mp4",
3642
"Paradox"
3743
);
3844

3945
const stream7 = new LiveStreamChannel(
46+
"knull",
4047
"https://storage.googleapis.com/gtv-videos-bucket/sample/images/ForBiggerMeltdowns.jpg",
4148
"https://storage.googleapis.com/gtv-videos-bucket/sample/ForBiggerMeltdowns.mp4",
4249
"Knull"
4350
);
4451

4552
const stream8 = new LiveStreamChannel(
53+
"moon-knight",
4654
"https://storage.googleapis.com/gtv-videos-bucket/sample/images/Sintel.jpg",
4755
"https://storage.googleapis.com/gtv-videos-bucket/sample/Sintel.jpg",
4856
"Moon knight"
4957
);
5058

5159
const stream9 = new LiveStreamChannel(
60+
"netflix",
5261
"https://storage.googleapis.com/gtv-videos-bucket/sample/images/SubaruOutbackOnStreetAndDirt.jpg",
5362
"https://storage.googleapis.com/gtv-videos-bucket/sample/SubaruOutbackOnStreetAndDirt.mp4",
5463
"Netflix"
5564
);
5665

5766
const stream10 = new LiveStreamChannel(
67+
"mads-two",
5868
"https://storage.googleapis.com/gtv-videos-bucket/sample/images/TearsOfSteel.jpg",
5969
"https://storage.googleapis.com/gtv-videos-bucket/sample/TearsOfSteel.mp4",
6070
"Mads"

projects/twitchCloneExpo/src/models/channel.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,16 @@ export class LiveStreamChannel {
33
channelStream: string;
44

55
channelName: string;
6+
ID: string;
67

78
constructor(
9+
ID: string,
810
channelImg: string,
911
channelStream: string,
1012

1113
channelName: string
1214
) {
15+
this.ID = ID;
1316
this.channelImg = channelImg;
1417
this.channelStream = channelStream;
1518

0 commit comments

Comments
 (0)