diff --git a/src/app/(tabs)/search/story.tsx b/src/app/(tabs)/search/story.tsx
index cd57613e..04df8cfd 100644
--- a/src/app/(tabs)/search/story.tsx
+++ b/src/app/(tabs)/search/story.tsx
@@ -1,11 +1,42 @@
-import { Text } from 'react-native';
+import { ActivityIndicator, ScrollView, Text, View } from 'react-native';
import { SafeAreaView } from 'react-native-safe-area-context';
+import { useEffect, useState } from 'react';
+import HTMLView from 'react-native-htmlview';
import globalStyles from '../../../../globalStyles';
function StoryScreen() {
+ const [isLoading, setLoading] = useState(true);
+ const [title, setTitle] = useState(String);
+ const [content, setContent] = useState(String);
+
+ const getStory = async (id: string) => {
+ try {
+ const url = `https://girlswritenow.org/wp-json/wp/v2/story/${id}`;
+ const response = await fetch(url);
+ const json = await response.json();
+ setTitle(json.title.rendered);
+ setContent(json.content.rendered);
+ } catch (error) {
+ console.error(error);
+ } finally {
+ setLoading(false);
+ }
+ };
+
+ useEffect(() => {
+ getStory('170947');
+ }, []);
+
return (
- Story
+ {isLoading ? (
+
+ ) : (
+
+
+
+
+ )}
);
}
diff --git a/src/screens/StoryScreen.tsx b/src/screens/StoryScreen.tsx
deleted file mode 100644
index 96a8b9db..00000000
--- a/src/screens/StoryScreen.tsx
+++ /dev/null
@@ -1,40 +0,0 @@
-import React, { useEffect, useState } from 'react';
-import { ActivityIndicator, ScrollView, View } from 'react-native';
-import HTMLView from 'react-native-htmlview';
-
-export default function StoryScreen() {
- const [isLoading, setLoading] = useState(true);
- const [title, setTitle] = useState(String);
- const [content, setContent] = useState(String);
-
- const getStory = async (id: string) => {
- try {
- const url = `https://girlswritenow.org/wp-json/wp/v2/story/${id}`;
- const response = await fetch(url);
- const json = await response.json();
- setTitle(json.title.rendered);
- setContent(json.content.rendered);
- } catch (error) {
- console.error(error);
- } finally {
- setLoading(false);
- }
- };
-
- useEffect(() => {
- getStory('170947');
- }, []);
-
- return (
-
- {isLoading ? (
-
- ) : (
-
-
-
-
- )}
-
- );
-}