Skip to content

Commit

Permalink
variables added to declare types and comments also made
Browse files Browse the repository at this point in the history
  • Loading branch information
Marcos Hernandez committed Oct 11, 2023
1 parent 1a0715f commit bf71ba2
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/app/(tabs)/search/story.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,10 @@ function StoryScreen() {
};

const htmlParser = (html: string) => {
const regex = /<h2(.*?)h2>(\n+<p(.*?)p>)+/; // <p>.*?<\/p>/;
const regex = /<h2(.*?)h2>(\n+<p(.*?)p>)+/; // regex grabs heading and paragraph tags for story
const corresp = regex.exec(html);
const firstParagraph = corresp ? corresp[0] : ''; // <p>text1</p>
const firstParagraphWithoutHtml = corresp ? corresp[1] : ''; // text1
return corresp[0];
const story = corresp ? corresp[0] : ''; // <h2>heading<h2> <p>paragraph1</p> ...
return story;
};

useEffect(() => {
Expand All @@ -43,7 +42,6 @@ function StoryScreen() {
<ScrollView>
<HTMLView value={title} />
<HTMLView value={htmlParser(content)} />
{/* <HTMLView value={htmlParser(content)} /> */}
</ScrollView>
)}
</SafeAreaView>
Expand Down

0 comments on commit bf71ba2

Please sign in to comment.