Skip to content

Commit b24f07c

Browse files
committed
Created BottomModal with helpfer dismiss, User Screen created and Charts are added
1 parent 6425df3 commit b24f07c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+3154
-90
lines changed

.prettierrc.js

+1
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,5 @@ module.exports = {
44
singleQuote: true,
55
trailingComma: 'all',
66
arrowParens: 'avoid',
7+
endOfLine: 'auto',
78
};

.vscode/settings.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@
55
"search.exclude": {
66
"**/node_modules": false
77
},
8-
}
8+
}

App.js

+224-88
Original file line numberDiff line numberDiff line change
@@ -1,111 +1,247 @@
1-
/**
2-
* Sample React Native App
3-
* https://github.com/facebook/react-native
4-
*
5-
* @format
6-
* @flow strict-local
7-
*/
8-
9-
import React from 'react';
10-
import type {Node} from 'react';
111
import {
12-
SafeAreaView,
13-
ScrollView,
14-
StatusBar,
2+
Image,
153
StyleSheet,
16-
Text,
17-
useColorScheme,
4+
TouchableOpacity,
185
View,
6+
Text,
7+
Pressable,
198
} from 'react-native';
209

21-
import {
22-
Colors,
23-
DebugInstructions,
24-
Header,
25-
LearnMoreLinks,
26-
ReloadInstructions,
27-
} from 'react-native/Libraries/NewAppScreen';
10+
import HomeScreen from './src/Screens/HomeScreen';
11+
import Icon from 'react-native-vector-icons/Ionicons';
12+
import {NavigationContainer} from '@react-navigation/native';
13+
import React, {useState} from 'react';
14+
import {createBottomTabNavigator} from '@react-navigation/bottom-tabs';
15+
import {createStackNavigator} from '@react-navigation/stack';
16+
import SplashScreen from './src/Screens/SplashScreen';
17+
import Explore from './src/Screens/Explore';
18+
import Player from './src/Screens/Player';
19+
import ChannelScreen from './src/Screens/Channel';
20+
import AboutScreen from './src/Screens/About';
21+
import Videos from './src/Screens/Videos';
22+
import {createMaterialTopTabNavigator} from '@react-navigation/material-top-tabs';
23+
import UserScreen from './src/Screens/User';
24+
import UserData from './src/Utils/User.json';
25+
import TopScreen from './src/Screens/TopScreen';
26+
import VideosScreen from './src/Screens/Videos';
2827

29-
const Section = ({children, title}): Node => {
30-
const isDarkMode = useColorScheme() === 'dark';
28+
const Stack = createStackNavigator();
29+
const Tab = createBottomTabNavigator();
30+
const TopBar = createMaterialTopTabNavigator();
31+
32+
const MainTabs = () => {
3133
return (
32-
<View style={styles.sectionContainer}>
33-
<Text
34-
style={[
35-
styles.sectionTitle,
36-
{
37-
color: isDarkMode ? Colors.white : Colors.black,
38-
},
39-
]}>
40-
{title}
41-
</Text>
42-
<Text
43-
style={[
44-
styles.sectionDescription,
45-
{
46-
color: isDarkMode ? Colors.light : Colors.dark,
47-
},
48-
]}>
49-
{children}
50-
</Text>
51-
</View>
34+
<Tab.Navigator
35+
tabBarOptions={{
36+
style: {
37+
position: 'absolute',
38+
elevation: 0,
39+
shadowOpacity: 0,
40+
borderTopWidth: 0.5,
41+
bottom: 0,
42+
height: 48,
43+
},
44+
labelStyle: {
45+
fontFamily: 'Roboto-Light',
46+
fontSize: 12,
47+
},
48+
activeTintColor: '#000',
49+
}}
50+
initialRouteName="SplashScreen"
51+
backBehavior="history">
52+
<Tab.Screen
53+
name="Home"
54+
component={HomeScreen}
55+
options={{
56+
tabBarLabel: 'Home',
57+
tabBarIcon: tabInfo => (
58+
<Icon
59+
name={tabInfo.focused ? 'home' : 'home-outline'}
60+
size={25}
61+
color="#282828"
62+
/>
63+
),
64+
}}
65+
/>
66+
<Tab.Screen
67+
name="Explore"
68+
component={Explore}
69+
options={{
70+
tabBarLabel: 'Explore',
71+
tabBarIcon: tabInfo => (
72+
<Icon
73+
name={tabInfo.focused ? 'compass' : 'compass-outline'}
74+
size={25}
75+
color="#282828"
76+
/>
77+
),
78+
}}
79+
/>
80+
<Tab.Screen
81+
name="User"
82+
component={UserChannel}
83+
options={{
84+
tabBarLabel: 'User',
85+
tabBarIcon: tabInfo => (
86+
<Image source={{uri: UserData?.avtar}} style={styles.tabAvtar} />
87+
),
88+
}}
89+
/>
90+
</Tab.Navigator>
5291
);
5392
};
5493

55-
const App: () => Node = () => {
56-
const isDarkMode = useColorScheme() === 'dark';
94+
const ChannelStack = () => {
95+
return (
96+
<TopBar.Navigator
97+
backBehavior="history"
98+
tabBarOptions={{
99+
activeTintColor: '#040201',
100+
labelStyle: {
101+
fontFamily: 'Roboto-Medium',
102+
fontSize: 16,
103+
},
104+
indicatorStyle: {
105+
backgroundColor: '#040201',
106+
},
107+
}}>
108+
<TopBar.Screen name="Home" component={ChannelScreen} />
109+
<TopBar.Screen name="Videos" component={Videos} />
110+
<TopBar.Screen name="About" component={AboutScreen} />
111+
</TopBar.Navigator>
112+
);
113+
};
57114

58-
const backgroundStyle = {
59-
backgroundColor: isDarkMode ? Colors.darker : Colors.lighter,
60-
};
115+
function UserChannel() {
116+
return (
117+
<TopBar.Navigator
118+
lazy
119+
removeClippedSubviews={false}
120+
backBehavior="history"
121+
tabBarOptions={{
122+
style: {
123+
borderBottomWidth: 0,
124+
},
125+
}}>
126+
<TopBar.Screen name="User" component={UserScreen} />
127+
<TopBar.Screen name="Video" component={VideosScreen} />
128+
<TopBar.Screen name="About" component={AboutScreen} />
129+
</TopBar.Navigator>
130+
);
131+
}
61132

133+
const App = props => {
62134
return (
63-
<SafeAreaView style={backgroundStyle}>
64-
<StatusBar barStyle={isDarkMode ? 'light-content' : 'dark-content'} />
65-
<ScrollView
66-
contentInsetAdjustmentBehavior="automatic"
67-
style={backgroundStyle}>
68-
<Header />
69-
<View
70-
style={{
71-
backgroundColor: isDarkMode ? Colors.black : Colors.white,
72-
}}>
73-
<Section title="Step One">
74-
Edit <Text style={styles.highlight}>App.js</Text> to change this
75-
screen and then come back to see your edits.
76-
</Section>
77-
<Section title="See Your Changes">
78-
<ReloadInstructions />
79-
</Section>
80-
<Section title="Debug">
81-
<DebugInstructions />
82-
</Section>
83-
<Section title="Learn More">
84-
Read the docs to discover what to do next:
85-
</Section>
86-
<LearnMoreLinks />
87-
</View>
88-
</ScrollView>
89-
</SafeAreaView>
135+
<NavigationContainer>
136+
<Stack.Navigator initialRouteName="Main">
137+
<Stack.Screen
138+
name="SplashScreen"
139+
component={SplashScreen}
140+
options={{headerShown: false}}
141+
/>
142+
<Stack.Screen
143+
name="Main"
144+
component={MainTabs}
145+
options={({navigation, roue}) => ({
146+
headerStyle: {
147+
height: 45,
148+
},
149+
headerTitleAlign: 'left',
150+
headerTitle: () => (
151+
<Image
152+
source={require('./assets/logo.png')}
153+
style={styles.logo}
154+
resizeMode="contain"
155+
/>
156+
),
157+
headerRight: () => (
158+
<View style={styles.homeRight}>
159+
<TouchableOpacity style={styles.rightButton}>
160+
<Icon
161+
name="notifications-outline"
162+
color="#282828"
163+
size={26}
164+
/>
165+
</TouchableOpacity>
166+
<TouchableOpacity style={styles.rightButton}>
167+
<Icon name="search-outline" color="#282828" size={26} />
168+
</TouchableOpacity>
169+
<TouchableOpacity style={styles.rightButton}>
170+
<Image
171+
source={{
172+
uri: 'https://avatars.githubusercontent.com/u/37410529?v=4',
173+
}}
174+
style={styles.channelAvtar}
175+
/>
176+
</TouchableOpacity>
177+
</View>
178+
),
179+
})}
180+
/>
181+
<Stack.Screen
182+
name="Player"
183+
component={Player}
184+
options={{headerShown: false}}
185+
/>
186+
<Stack.Screen
187+
name="ChannelScreen"
188+
initialParams={{optionsModal: false}}
189+
component={ChannelStack}
190+
options={({navigation, route}) => ({
191+
headerStyle: {
192+
height: 45,
193+
},
194+
headerTitleAlign: 'left',
195+
headerTitle: () => (
196+
<Text style={styles.channelName}>
197+
{route?.params.channelName}
198+
</Text>
199+
),
200+
})}
201+
/>
202+
</Stack.Navigator>
203+
</NavigationContainer>
90204
);
91205
};
92206

93207
const styles = StyleSheet.create({
94-
sectionContainer: {
95-
marginTop: 32,
96-
paddingHorizontal: 24,
208+
logo: {
209+
width: 90,
210+
},
211+
homeRight: {
212+
flex: 1,
213+
flexDirection: 'row',
214+
alignItems: 'center',
215+
marginHorizontal: 10,
216+
justifyContent: 'space-around',
217+
},
218+
channelAvtar: {
219+
width: 28,
220+
height: 28,
221+
borderRadius: 28 / 2,
222+
},
223+
rightButton: {
224+
marginHorizontal: 8,
225+
width: 30,
226+
height: 30,
227+
borderRadius: 30 / 2,
97228
},
98-
sectionTitle: {
99-
fontSize: 24,
100-
fontWeight: '600',
229+
channelName: {
230+
fontFamily: 'Roboto-Medium',
231+
fontSize: 17.5,
232+
color: '#040201',
101233
},
102-
sectionDescription: {
103-
marginTop: 8,
104-
fontSize: 18,
105-
fontWeight: '400',
234+
channelButton: {
235+
marginHorizontal: 3,
236+
alignSelf: 'center',
237+
width: 30,
238+
height: 30,
239+
borderRadius: 30 / 2,
106240
},
107-
highlight: {
108-
fontWeight: '700',
241+
tabAvtar: {
242+
width: 20,
243+
height: 20,
244+
borderRadius: 10,
109245
},
110246
});
111247

68.7 KB
Binary file not shown.
64 KB
Binary file not shown.
13.1 KB
Binary file not shown.
54.7 KB
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
306 KB
Binary file not shown.
55.6 KB
Binary file not shown.
241 KB
Binary file not shown.
Binary file not shown.
Binary file not shown.
27.7 KB
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
25 KB
Binary file not shown.

android/app/src/main/java/com/youtubeclone/MainActivity.java

+11
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,24 @@
11
package com.youtubeclone;
22

33
import com.facebook.react.ReactActivity;
4+
import android.content.Intent;
5+
import android.content.res.Configuration;
46

57
public class MainActivity extends ReactActivity {
68

79
/**
810
* Returns the name of the main component registered from JavaScript. This is used to schedule
911
* rendering of the component.
1012
*/
13+
14+
@Override
15+
public void onConfigurationChanged(Configuration newConfig) {
16+
super.onConfigurationChanged(newConfig);
17+
Intent intent = new Intent("onConfigurationChanged");
18+
intent.putExtra("newConfig", newConfig);
19+
this.sendBroadcast(intent);
20+
}
21+
1122
@Override
1223
protected String getMainComponentName() {
1324
return "youtubeClone";

android/app/src/main/java/com/youtubeclone/MainApplication.java

+2
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
import com.facebook.soloader.SoLoader;
1111
import java.lang.reflect.InvocationTargetException;
1212
import java.util.List;
13+
import org.wonday.orientation.OrientationActivityLifecycle;
1314

1415
public class MainApplication extends Application implements ReactApplication {
1516

@@ -45,6 +46,7 @@ public void onCreate() {
4546
super.onCreate();
4647
SoLoader.init(this, /* native exopackage */ false);
4748
initializeFlipper(this, getReactNativeHost().getReactInstanceManager());
49+
registerActivityLifecycleCallbacks(OrientationActivityLifecycle.getInstance());
4850
}
4951

5052
/**

android/settings.gradle

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
rootProject.name = 'youtubeClone'
22
apply from: file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings)
3+
include ':react-native-video'
4+
project(':react-native-video').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-video/android-exoplayer')
35
include ':app'

assets/logo.png

-624 Bytes
Loading

0 commit comments

Comments
 (0)