diff options
author | Eric Bailey <git@esb.lol> | 2023-09-20 11:03:57 -0500 |
---|---|---|
committer | Eric Bailey <git@esb.lol> | 2023-09-20 11:03:57 -0500 |
commit | 5665968f729b99509d54769f494bbbfc59b4b630 (patch) | |
tree | bfad6f82b613699ba3f206d460f0eac50dee6bd4 /src/view/com/profile/FollowButton.tsx | |
parent | 63527493fd8dfb72d21bd50cd2404a5cf2c6e274 (diff) | |
parent | cd96f8dcc8692aec4b9b165cc9f47d7e0b6257df (diff) | |
download | voidsky-5665968f729b99509d54769f494bbbfc59b4b630.tar.zst |
Merge remote-tracking branch 'origin' into bnewbold/bump-api-dep
* origin: Allow touch at the top of the lightbox (#1489) Bump ios build number Feeds tab fixes (#1486) Nicer 'post processing status' in the composer (#1472) Inline createPanResponder (#1483) Tree view threads experiment (#1480) Make "double tap to zoom" precise across platforms (#1482) Onboarding recommended follows (#1457) Add thread sort settings (#1475)
Diffstat (limited to 'src/view/com/profile/FollowButton.tsx')
-rw-r--r-- | src/view/com/profile/FollowButton.tsx | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/view/com/profile/FollowButton.tsx b/src/view/com/profile/FollowButton.tsx index 6f6286e69..4b2b944f7 100644 --- a/src/view/com/profile/FollowButton.tsx +++ b/src/view/com/profile/FollowButton.tsx @@ -1,5 +1,5 @@ import React from 'react' -import {View} from 'react-native' +import {StyleProp, TextStyle, View} from 'react-native' import {observer} from 'mobx-react-lite' import {Button, ButtonType} from '../util/forms/Button' import {useStores} from 'state/index' @@ -11,11 +11,13 @@ export const FollowButton = observer(function FollowButtonImpl({ followedType = 'default', did, onToggleFollow, + labelStyle, }: { unfollowedType?: ButtonType followedType?: ButtonType did: string onToggleFollow?: (v: boolean) => void + labelStyle?: StyleProp<TextStyle> }) { const store = useStores() const followState = store.me.follows.getFollowState(did) @@ -28,18 +30,18 @@ export const FollowButton = observer(function FollowButtonImpl({ const updatedFollowState = await store.me.follows.fetchFollowState(did) if (updatedFollowState === FollowState.Following) { try { + onToggleFollow?.(false) await store.agent.deleteFollow(store.me.follows.getFollowUri(did)) store.me.follows.removeFollow(did) - onToggleFollow?.(false) } catch (e: any) { store.log.error('Failed to delete follow', e) Toast.show('An issue occurred, please try again.') } } else if (updatedFollowState === FollowState.NotFollowing) { try { + onToggleFollow?.(true) const res = await store.agent.follow(did) store.me.follows.addFollow(did, res.uri) - onToggleFollow?.(true) } catch (e: any) { store.log.error('Failed to create follow', e) Toast.show('An issue occurred, please try again.') @@ -52,8 +54,10 @@ export const FollowButton = observer(function FollowButtonImpl({ type={ followState === FollowState.Following ? followedType : unfollowedType } + labelStyle={labelStyle} onPress={onToggleFollowInner} label={followState === FollowState.Following ? 'Unfollow' : 'Follow'} + withLoading={true} /> ) }) |