Skip to content

Commit

Permalink
new tab nav
Browse files Browse the repository at this point in the history
  • Loading branch information
CharlotteLaw committed Oct 16, 2024
2 parents da3f451 + fd25ca2 commit 594fc60
Show file tree
Hide file tree
Showing 13 changed files with 108 additions and 11 deletions.
2 changes: 0 additions & 2 deletions .env

This file was deleted.

1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ yarn-error.*
*.pem

# local env files
.env
.env*.local

# typescript
Expand Down
6 changes: 3 additions & 3 deletions App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import * as React from 'react';
import { createBottomTabNavigator } from '@react-navigation/bottom-tabs';
import { NavigationContainer } from '@react-navigation/native';
import HealingResources from '@/HealingResources';
import Home from '@/Home';
import LegalRights from '@/LegalRights';
import SeekHelp from '@/SeekHelp';
import Home from '@/screens/Home';
import LegalRights from '@/screens/LegalRights';
import SeekHelp from '@/screens/SeekHelp';

const Tab = createBottomTabNavigator();

Expand Down
5 changes: 0 additions & 5 deletions src/SeekHelp/index.tsx

This file was deleted.

Empty file added src/navigation/mainTabNav.tsx
Empty file.
Empty file.
Empty file.
46 changes: 46 additions & 0 deletions src/screens/HealingResources/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
import React, { useEffect, useState } from 'react';
import { Button, View } from 'react-native';
import supabase from '../supabase/createClient';

interface Resource {
summary: string;
[key: string]: any;
}

export default function HealingResources() {
const [, setSummaries] = useState<Resource[]>([]);

useEffect(() => {
fetchData();
}, []);

const fetchData = async () => {
try {
const { data, error } = await supabase
.from('healing_resources')
.select('*');

if (error) {
console.error('Error fetching resources:', error);
return;
}

setSummaries(data as Resource[]);
} catch (error) {
console.error('Error fetching data:', error);
}
};

return (
<View>
<Button
title="Hope Healing Guide"
onPress={() => console.log('does this work')}
/>
<Button
title="Theme Healing Resources"
onPress={() => console.log('does this work')}
/>
</View>
);
}
10 changes: 10 additions & 0 deletions src/screens/HealingResources/styles.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { StyleSheet } from 'react-native';

export default StyleSheet.create({
container: {
width: '100%',
height: '100%',
alignItems: 'center',
justifyContent: 'flex-start',
},
});
2 changes: 1 addition & 1 deletion src/Home/index.tsx → src/screens/Home/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Button, Text, View } from 'react-native';

export default function Home({ navigation }) {
export default function Home({ navigation }: { navigation: any }) {
return (
<View>
<Text>hello</Text>
Expand Down
File renamed without changes.
47 changes: 47 additions & 0 deletions src/screens/SeekHelp/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import React, { useEffect, useState } from 'react';
import { Button, Text, View } from 'react-native';
import supabase from '../supabase/createClient';

interface Resource {
summary: string;
[key: string]: any;
}

export default function SeekHelp() {
const [summaries, setSummaries] = useState<Resource[]>([]);

useEffect(() => {
fetchData();
}, []);

const fetchData = async () => {
try {
const { data, error } = await supabase
.from('state_resources')
.select('*')
.in('state', ['California', 'National']);

if (error) {
console.error('Error fetching resources:', error);
return;
}

setSummaries(data as Resource[]);
} catch (error) {
console.error('Error fetching data:', error);
}
};

return (
<View>
<Button title="Fetch Data" onPress={fetchData} />
{summaries.length > 0 ? (
summaries.map((resource, index) => (
<Text key={index}>{resource.summary}</Text>
))
) : (
<Text>Loading...</Text>
)}
</View>
);
}
Empty file.

0 comments on commit 594fc60

Please sign in to comment.