import { Text, View, StyleSheet, ScrollView, useWindowDimensions } from 'react-native' import { useLocalSearchParams } from 'expo-router' import axios from 'axios' import { useAuthStore, useSubscription } from '../store' import { useEffect, useState } from 'react' import RenderHtml from 'react-native-render-html' export default() => { const { id } = useLocalSearchParams() const [post, setPost] = useState(undefined) const { credential } = useAuthStore() const { subscriptions } = useSubscription() const { width: screenWidth } = useWindowDimensions() useEffect(() => { fetchPost() }, []) const styles = StyleSheet.create({ page: { padding: 16, gap: 16, paddingBottom: 32 }, postHeader: { gap: 8 }, postTitle: { fontSize: 24, fontWeight: 600 }, metadata: { color: "#aaaaaa" } }) async function fetchPost() { try { const res = await axios.get(`https://api.feedbin.com/v2/entries/${id}.json`, { auth: credential }) setPost(res.data) } catch(e) { console.log('`fetchPost` (post.tsx) has encounted an error') console.log(e) } } if (post) { return {post.title} {post.author && {post.author} · }{subscriptions[post.feed_id].title} } else { return {id} } }