Skip to content

Commit

Permalink
[nav] Create style sheet and directory for every (tabs) screen (#33)
Browse files Browse the repository at this point in the history
* non nested directory causes extra bottom tab

* rebase
  • Loading branch information
akshaynthakur authored Nov 2, 2023
1 parent ca425f5 commit 9f3299a
Show file tree
Hide file tree
Showing 10 changed files with 211 additions and 171 deletions.
11 changes: 9 additions & 2 deletions src/app/(tabs)/_layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,17 @@ function TabNav() {
}}
/>
<Tabs.Screen
name="mycontent"
name="story"
options={{
headerShown: false,
tabBarLabel: 'My Content',
href: null,
}}
/>
<Tabs.Screen
name="library"
options={{
headerShown: false,
tabBarLabel: 'Library',
tabBarIcon: DocumentIcon,
}}
/>
Expand Down
11 changes: 11 additions & 0 deletions src/app/(tabs)/library/_layout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { Stack } from 'expo-router';

function StackLayout() {
return (
<Stack>
<Stack.Screen name="index" options={{ headerShown: false }} />
</Stack>
);
}

export default StackLayout;
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import { Text } from 'react-native';
import { SafeAreaView } from 'react-native-safe-area-context';

import globalStyles from '../../styles/globalStyles';
import globalStyles from '../../../styles/globalStyles';

function MyContentScreen() {
function LibraryScreen() {
return (
<SafeAreaView style={globalStyles.container}>
<Text style={globalStyles.h1}>My Content</Text>
<Text style={globalStyles.h1}>Library</Text>
</SafeAreaView>
);
}

export default MyContentScreen;
export default LibraryScreen;
5 changes: 5 additions & 0 deletions src/app/(tabs)/library/styles.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { StyleSheet } from 'react-native';

const styles = StyleSheet.create({});

export default styles;
1 change: 0 additions & 1 deletion src/app/(tabs)/search/_layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ function StackLayout() {
return (
<Stack>
<Stack.Screen name="index" options={{ headerShown: false }} />
<Stack.Screen name="story" options={{ headerShown: false }} />
</Stack>
);
}
Expand Down
51 changes: 3 additions & 48 deletions src/app/(tabs)/search/index.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import { SearchBar } from '@rneui/themed';
import { Link } from 'expo-router';
import React, { useEffect, useState } from 'react';
import { Button, FlatList, StyleSheet, Dimensions, View } from 'react-native';
import { Button, FlatList, View } from 'react-native';
import { SafeAreaView } from 'react-native-safe-area-context';

import styles from './styles';
import FilterModal from '../../../components/FilterModal/FilterModal';
import SearchCard from '../../../components/SearchCard/SearchCard';
import { fetchAllStoryPreviews } from '../../../queries/stories';
Expand Down Expand Up @@ -42,7 +43,6 @@ function SearchScreen() {
return (
<SafeAreaView style={styles.container}>
<View style={[filterVisible ? styles.greyOverlay : styles.noOverlay]} />
{/* {filterVisible && <SafeAreaView style={[styles.greyOverlay]} />} */}
<SearchBar
platform="default"
searchIcon={false}
Expand All @@ -59,7 +59,7 @@ function SearchScreen() {
onChangeText={text => searchFunction(text)}
value={search}
/>
<Link href="/search/story" asChild>
<Link href="/story" asChild>
<Button title="Story" />
</Link>
<Button
Expand Down Expand Up @@ -91,48 +91,3 @@ function SearchScreen() {
}

export default SearchScreen;

const { width, height } = Dimensions.get('window');

const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: 'white',
justifyContent: 'flex-start',
paddingLeft: 24,
paddingRight: 24,
paddingTop: 20,
gap: 14,
},
searchContainer: {
backgroundColor: 'transparent',
borderRadius: 10,
borderColor: 'transparent',
padding: 0,
marginBottom: 16,
},
inputContainer: {
backgroundColor: '#D9D9D9',
margin: 0,
borderRadius: 10,
},
greyOverlay: {
flex: 1,
position: 'absolute',
left: 0,
top: 0,
opacity: 0.2,
backgroundColor: 'black',
width,
height,
zIndex: 1,
},
noOverlay: {
flex: 1,
position: 'absolute',
left: 0,
top: 0,
width,
height,
},
});
48 changes: 48 additions & 0 deletions src/app/(tabs)/search/styles.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
import { Dimensions, StyleSheet } from 'react-native';

const { width, height } = Dimensions.get('window');

const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: 'white',
justifyContent: 'flex-start',
paddingLeft: 24,
paddingRight: 24,
paddingTop: 20,
gap: 14,
},
searchContainer: {
backgroundColor: 'transparent',
borderRadius: 10,
borderColor: 'transparent',
padding: 0,
marginBottom: 16,
},
inputContainer: {
backgroundColor: '#D9D9D9',
margin: 0,
borderRadius: 10,
},
greyOverlay: {
flex: 1,
position: 'absolute',
left: 0,
top: 0,
opacity: 0.2,
backgroundColor: 'black',
width,
height,
zIndex: 1,
},
noOverlay: {
flex: 1,
position: 'absolute',
left: 0,
top: 0,
width,
height,
},
});

export default styles;
11 changes: 11 additions & 0 deletions src/app/(tabs)/story/_layout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { Stack } from 'expo-router';

function StackLayout() {
return (
<Stack>
<Stack.Screen name="index" options={{ headerShown: false }} />
</Stack>
);
}

export default StackLayout;
117 changes: 1 addition & 116 deletions src/app/(tabs)/search/story.tsx → src/app/(tabs)/story/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ import {
Share,
Text,
View,
StyleSheet,
} from 'react-native';
import { Button } from 'react-native-paper';
import { RenderHTML } from 'react-native-render-html';
import { SafeAreaView } from 'react-native-safe-area-context';

import styles from './styles';
import { storyObject } from '../../../utils/story';

function StoryScreen() {
Expand Down Expand Up @@ -128,118 +128,3 @@ function StoryScreen() {
}

export default StoryScreen;

const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: 'white',
alignItems: 'flex-start',
justifyContent: 'flex-start',
paddingLeft: 24,
paddingRight: 24,
paddingTop: 48,
},
image: {
width: '100%',
height: 153,
marginBottom: 16,
},
authorImage: {
backgroundColor: '#D9D9D9',
width: 21,
height: 21,
borderRadius: 100 / 2,
},
title: {
fontFamily: 'Avenir',
fontSize: 24,
fontWeight: '400',
textAlign: 'left',
color: 'black',
marginBottom: 16,
},
author: {
display: 'flex',
flexDirection: 'row',
gap: 10,
marginBottom: 16,
},
authorText: {
fontFamily: 'Avenir',
fontSize: 12,
fontWeight: '400',
textAlign: 'left',
color: 'black',
},
genres: {
display: 'flex',
flexDirection: 'row',
flexWrap: 'wrap',
borderRadius: 10,
marginBottom: 16,
},
genresBorder: {
backgroundColor: '#D9D9D9',
paddingTop: 5,
paddingBottom: 5,
paddingLeft: 10,
paddingRight: 10,
borderRadius: 10,
marginRight: 8,
},
genresText: {
fontFamily: 'Avenir',
fontSize: 12,
fontWeight: '400',
color: 'black',
backgroundColor: '#D9D9D9',
},
shareButtonText: {
fontFamily: 'Avenir',
fontSize: 12,
fontWeight: '400',
textAlign: 'left',
color: 'black',
textDecorationLine: 'underline',
backgroundColor: '#D9D9D9',
},
excerpt: {
fontFamily: 'Avenir',
fontSize: 16,
fontWeight: '400',
textAlign: 'left',
color: 'black',
paddingBottom: 12,
},
story: {
fontFamily: 'Avenir',
fontSize: 12,
fontWeight: '400',
textAlign: 'left',
color: 'black',
marginBottom: 16,
},
authorProcess: {
fontFamily: 'Avenir',
fontSize: 16,
fontWeight: '600',
textAlign: 'left',
color: 'black',
marginBottom: 16,
},
process: {
fontFamily: 'Avenir',
fontSize: 12,
fontWeight: '400',
textAlign: 'left',
color: 'black',
marginBottom: 16,
},
backToTopButtonText: {
fontFamily: 'Avenir',
fontSize: 12,
fontWeight: '800',
textAlign: 'left',
color: 'black',
},
});
Loading

0 comments on commit 9f3299a

Please sign in to comment.