Skip to content

Commit

Permalink
Merge pull request #166 from IWSR/fix/commit-area-need-to-hide
Browse files Browse the repository at this point in the history
fix: The bottom sheet do not close when the page navigate to other route
  • Loading branch information
dohooo authored Jul 2, 2023
2 parents e0e057f + 4773322 commit 9af0127
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 2 deletions.
6 changes: 6 additions & 0 deletions env.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ declare global {
OWNER: string
UPDATES_URL: string
INFURA_ID: string
CSB_SCAN: string
CSB_XCHAR: string
SENTRY_DSN: string
SENTRY_ORG: string
SENTRY_PROJECT: string
SENTRY_AUTH_TOKEN: string
}
}
}
Expand Down
4 changes: 3 additions & 1 deletion src/components/Avatar/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ interface Props {
size?: number
useDefault?: boolean
isNavigateToUserInfo?: boolean
handleBeforeNavigate?: () => void
}

const isValidUrl = (url) => {
Expand All @@ -31,7 +32,7 @@ const isValidUrl = (url) => {
};

export const Avatar: FC<Props> = (props) => {
const { character, size = 45, useDefault = false, isNavigateToUserInfo = true } = props;
const { character, size = 45, useDefault = false, isNavigateToUserInfo = true, handleBeforeNavigate } = props;
const navigation = useRootNavigation();
const uri = character?.metadata?.content?.avatars?.[0];
const name = character?.metadata?.content?.name;
Expand All @@ -45,6 +46,7 @@ export const Avatar: FC<Props> = (props) => {
if (!character?.characterId) {
return;
}
handleBeforeNavigate && handleBeforeNavigate();
navigation.navigate("UserInfo", { characterId: character?.characterId });
};

Expand Down
3 changes: 3 additions & 0 deletions src/components/CommentButton/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,9 @@ export const CommentButton: React.FC<Props> = ({ characterId, noteId, iconSize =
}}
onComment={comments.refetch}
onEdit={comments.refetch}
onNavigateToUserProfile={() => {
bottomSheetRef.current.close();
}}
/>
);
}}
Expand Down
4 changes: 3 additions & 1 deletion src/components/CommentItem/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ export interface CommentItemProps extends ListItemProps {
onPressEdit?: (comment: Comment) => void
onComment?: () => Promise<any>
onEdit?: () => Promise<any>
onNavigateToUserProfile?: () => void
}

export type Comment = NoteEntity & {
Expand All @@ -55,6 +56,7 @@ export const CommentItem: React.FC<CommentItemProps> = (props) => {
onPressEdit: _onPressEdit,
onComment,
onEdit,
onNavigateToUserProfile,
...restProps
} = props;
const date = useDate();
Expand Down Expand Up @@ -133,7 +135,7 @@ export const CommentItem: React.FC<CommentItemProps> = (props) => {
return (
<>
<XStack marginBottom="$2" gap="$3" {...restProps}>
<Avatar useDefault size={isSubComment ? 36 : 40} character={comment?.character} />
<Avatar useDefault size={isSubComment ? 36 : 40} character={comment?.character} handleBeforeNavigate={onNavigateToUserProfile} />
<YStack flex={1}>
<YStack flex={1}>
<XStack alignItems="center" marginBottom="$1">
Expand Down

0 comments on commit 9af0127

Please sign in to comment.