Implement consistent Link component

This commit is contained in:
Paul Frazee 2022-09-02 11:52:33 -05:00
parent 6835caa760
commit 2f0939a1c2
9 changed files with 177 additions and 143 deletions

View file

@ -6,13 +6,13 @@ import {
Image,
StyleSheet,
Text,
TouchableOpacity,
View,
} from 'react-native'
import {
UserFollowersViewModel,
FollowerItem,
} from '../../../state/models/user-followers-view'
import {Link} from '../util/Link'
import {useStores} from '../../../state'
import {s, colors} from '../../lib/styles'
import {AVIS} from '../../lib/assets'
@ -77,12 +77,8 @@ export const ProfileFollowers = observer(function ProfileFollowers({
})
const User = ({item}: {item: FollowerItem}) => {
const store = useStores()
const onPressOuter = () => {
store.nav.navigate(`/profile/${item.name}`)
}
return (
<TouchableOpacity style={styles.outer} onPress={onPressOuter}>
<Link style={styles.outer} href={`/profile/${item.name}`} title={item.name}>
<View style={styles.layout}>
<View style={styles.layoutAvi}>
<Image
@ -95,7 +91,7 @@ const User = ({item}: {item: FollowerItem}) => {
<Text style={[s.f14, s.gray5]}>@{item.name}</Text>
</View>
</View>
</TouchableOpacity>
</Link>
)
}

View file

@ -14,6 +14,7 @@ import {
FollowItem,
} from '../../../state/models/user-follows-view'
import {useStores} from '../../../state'
import {Link} from '../util/Link'
import {s, colors} from '../../lib/styles'
import {AVIS} from '../../lib/assets'
@ -77,12 +78,8 @@ export const ProfileFollows = observer(function ProfileFollows({
})
const User = ({item}: {item: FollowItem}) => {
const store = useStores()
const onPressOuter = () => {
store.nav.navigate(`/profile/${item.name}`)
}
return (
<TouchableOpacity style={styles.outer} onPress={onPressOuter}>
<Link style={styles.outer} href={`/profile/${item.name}`} title={item.name}>
<View style={styles.layout}>
<View style={styles.layoutAvi}>
<Image
@ -95,7 +92,7 @@ const User = ({item}: {item: FollowItem}) => {
<Text style={[s.f14, s.gray5]}>@{item.name}</Text>
</View>
</View>
</TouchableOpacity>
</Link>
)
}