Skip to content

Commit

Permalink
Update ESLint rules, add react-navigation dependencies, and modify Ap…
Browse files Browse the repository at this point in the history
…p.tsx
  • Loading branch information
himanshu8443 committed Apr 25, 2024
1 parent ee613d2 commit 30599f2
Show file tree
Hide file tree
Showing 9 changed files with 19,419 additions and 6,907 deletions.
7 changes: 7 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
module.exports = {
root: true,
extends: '@react-native',
rules: {
'prettier/prettier': 0,
'react-native/no-inline-styles': 0,
'react-hooks/exhaustive-deps': 0,
'react-hooks/rules-of-hooks': 0,
'react/no-unstable-nested-components': 0,
},
};
164 changes: 55 additions & 109 deletions App.tsx
Original file line number Diff line number Diff line change
@@ -1,118 +1,64 @@
/**
* Sample React Native App
* https://github.com/facebook/react-native
*
* @format
*/

import {StyleSheet, Text, View} from 'react-native';
import React from 'react';
import type {PropsWithChildren} from 'react';
import {
SafeAreaView,
ScrollView,
StatusBar,
StyleSheet,
Text,
useColorScheme,
View,
} from 'react-native';

import {
Colors,
DebugInstructions,
Header,
LearnMoreLinks,
ReloadInstructions,
} from 'react-native/Libraries/NewAppScreen';
import Home from './screens/home/Home';
import Info from './screens/home/Info';
import Settings from './screens/Settings';
import {NavigationContainer} from '@react-navigation/native';
import {createBottomTabNavigator} from '@react-navigation/bottom-tabs';
import {createNativeStackNavigator} from '@react-navigation/native-stack';
import Entypo from 'react-native-vector-icons/Entypo';

type SectionProps = PropsWithChildren<{
title: string;
}>;
const Tab = createBottomTabNavigator();

function Section({children, title}: SectionProps): React.JSX.Element {
const isDarkMode = useColorScheme() === 'dark';
return (
<View style={styles.sectionContainer}>
<Text
style={[
styles.sectionTitle,
{
color: isDarkMode ? Colors.white : Colors.black,
},
]}>
{title}
</Text>
<Text
style={[
styles.sectionDescription,
{
color: isDarkMode ? Colors.light : Colors.dark,
},
]}>
{children}
</Text>
</View>
);
}
const App = () => {
const HomeStack = createNativeStackNavigator();

function App(): React.JSX.Element {
const isDarkMode = useColorScheme() === 'dark';

const backgroundStyle = {
backgroundColor: isDarkMode ? Colors.darker : Colors.lighter,
};
function HomeStackScreen() {
return (
<HomeStack.Navigator
screenOptions={{
headerBlurEffect: 'light',
headerTintColor: 'tomato',
headerStyle: {backgroundColor: '#171717'},
}}>
<HomeStack.Screen name="Home" component={Home} />
<HomeStack.Screen name="Info" component={Info} />
</HomeStack.Navigator>
);
}

return (
<SafeAreaView style={backgroundStyle}>
<StatusBar
barStyle={isDarkMode ? 'light-content' : 'dark-content'}
backgroundColor={backgroundStyle.backgroundColor}
/>
<ScrollView
contentInsetAdjustmentBehavior="automatic"
style={backgroundStyle}>
<Header />
<View
style={{
backgroundColor: isDarkMode ? Colors.black : Colors.white,
}}>
<Section title="Step One">
Edit <Text style={styles.highlight}>App.tsx</Text> to change this
screen and then come back to see your edits.
</Section>
<Section title="See Your Changes">
<ReloadInstructions />
</Section>
<Section title="Debug">
<DebugInstructions />
</Section>
<Section title="Learn More">
Read the docs to discover what to do next:
</Section>
<LearnMoreLinks />
</View>
</ScrollView>
</SafeAreaView>
<NavigationContainer>
<Tab.Navigator
screenOptions={{
headerShown: false,
tabBarActiveTintColor: 'tomato',
tabBarInactiveTintColor: 'gray',
tabBarStyle: {backgroundColor: 'black'},
}}>
<Tab.Screen
name="Home"
component={HomeStackScreen}
options={{
tabBarIcon: ({color, size}) => (
<Entypo name="home" color={color} size={size} />
),
}}
/>
<Tab.Screen
name="Settings"
component={Settings}
options={{
tabBarIcon: ({color, size}) => (
<Entypo name="cog" color={color} size={size} />
),
}}
/>
</Tab.Navigator>
</NavigationContainer>
);
}

const styles = StyleSheet.create({
sectionContainer: {
marginTop: 32,
paddingHorizontal: 24,
},
sectionTitle: {
fontSize: 24,
fontWeight: '600',
},
sectionDescription: {
marginTop: 8,
fontSize: 18,
fontWeight: '400',
},
highlight: {
fontWeight: '700',
},
});
};

export default App;

const styles = StyleSheet.create({});
2 changes: 2 additions & 0 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
apply plugin: "com.android.application"
apply plugin: "org.jetbrains.kotlin.android"
apply plugin: "com.facebook.react"
apply from: file("../../node_modules/react-native-vector-icons/fonts.gradle")


/**
* This is the configuration block to customize your React Native Android app.
Expand Down
Loading

0 comments on commit 30599f2

Please sign in to comment.