mirror of https://github.com/tooot-app/app
Update details
This commit is contained in:
parent
97e9ceca5a
commit
9c30edcc65
|
@ -12,27 +12,23 @@ import Media from './Toot/Media'
|
||||||
import Card from './Toot/Card'
|
import Card from './Toot/Card'
|
||||||
import Actions from './Toot/Actions'
|
import Actions from './Toot/Actions'
|
||||||
|
|
||||||
// Maybe break away notification types? https://docs.joinmastodon.org/entities/notification/
|
export default function Toot ({ toot }) {
|
||||||
|
|
||||||
export default function Toot ({ item, notification }) {
|
|
||||||
const navigation = useNavigation()
|
const navigation = useNavigation()
|
||||||
|
|
||||||
let actualContent
|
let actualContent
|
||||||
if (notification && item.status) {
|
if (toot.reblog) {
|
||||||
actualContent = item.status
|
actualContent = toot.reblog
|
||||||
} else if (item.reblog) {
|
|
||||||
actualContent = item.reblog
|
|
||||||
} else {
|
} else {
|
||||||
actualContent = item
|
actualContent = toot
|
||||||
}
|
}
|
||||||
|
|
||||||
const toot = useMemo(() => {
|
const tootView = useMemo(() => {
|
||||||
return (
|
return (
|
||||||
<View style={styles.tootTimeline}>
|
<View style={styles.tootTimeline}>
|
||||||
{item.reblog && (
|
{toot.reblog && (
|
||||||
<Reblog
|
<Reblog
|
||||||
name={item.account.display_name || item.account.username}
|
name={toot.account.display_name || toot.account.username}
|
||||||
emojis={item.account.emojis}
|
emojis={toot.account.emojis}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
<View style={styles.toot}>
|
<View style={styles.toot}>
|
||||||
|
@ -48,8 +44,8 @@ export default function Toot ({ item, notification }) {
|
||||||
}
|
}
|
||||||
emojis={actualContent.account.emojis}
|
emojis={actualContent.account.emojis}
|
||||||
account={actualContent.account.acct}
|
account={actualContent.account.acct}
|
||||||
created_at={item.created_at}
|
created_at={toot.created_at}
|
||||||
application={item.application}
|
application={toot.application}
|
||||||
/>
|
/>
|
||||||
{/* Can pass toot info to next page to speed up performance */}
|
{/* Can pass toot info to next page to speed up performance */}
|
||||||
<Pressable
|
<Pressable
|
||||||
|
@ -92,7 +88,7 @@ export default function Toot ({ item, notification }) {
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
return toot
|
return tootView
|
||||||
}
|
}
|
||||||
|
|
||||||
const styles = StyleSheet.create({
|
const styles = StyleSheet.create({
|
||||||
|
@ -112,7 +108,7 @@ const styles = StyleSheet.create({
|
||||||
})
|
})
|
||||||
|
|
||||||
Toot.propTypes = {
|
Toot.propTypes = {
|
||||||
item: PropTypes.shape({
|
toot: PropTypes.shape({
|
||||||
account: PropTypes.shape({
|
account: PropTypes.shape({
|
||||||
avatar: PropTypes.string.isRequired,
|
avatar: PropTypes.string.isRequired,
|
||||||
display_name: PropTypes.string.isRequired,
|
display_name: PropTypes.string.isRequired,
|
||||||
|
@ -124,6 +120,5 @@ Toot.propTypes = {
|
||||||
website: PropTypes.string
|
website: PropTypes.string
|
||||||
}),
|
}),
|
||||||
content: PropTypes.string
|
content: PropTypes.string
|
||||||
}).isRequired,
|
}).isRequired
|
||||||
notification: PropTypes.bool
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,7 +38,7 @@ export default function Timeline ({
|
||||||
data={state.toots}
|
data={state.toots}
|
||||||
keyExtractor={({ id }) => id}
|
keyExtractor={({ id }) => id}
|
||||||
renderItem={({ item, index, separators }) => (
|
renderItem={({ item, index, separators }) => (
|
||||||
<Toot key={item.key} item={item} />
|
<Toot key={item.key} toot={item} />
|
||||||
)}
|
)}
|
||||||
{...(state.pointer && { initialScrollIndex: state.pointer })}
|
{...(state.pointer && { initialScrollIndex: state.pointer })}
|
||||||
{...(!disableRefresh && {
|
{...(!disableRefresh && {
|
||||||
|
|
Loading…
Reference in New Issue