Skip to content

Commit

Permalink
fix: solve share bottomsheet issue
Browse files Browse the repository at this point in the history
  • Loading branch information
uwaisalqadri committed Jan 29, 2025
1 parent e446a3d commit 65d6cd8
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 13 deletions.
2 changes: 1 addition & 1 deletion Giffy/Features/Home/Button.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ struct IconButton: View {
Image(systemName: iconName)
.font(.system(size: size))
.foregroundColor(tint)
.frame(width: size, height: size)
.contentShape(.rect)
.padding(8)
}
.buttonStyle(.plain)
}
Expand Down
11 changes: 3 additions & 8 deletions Giffy/Features/Sticker/StickerReducer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,7 @@ public struct StickerReducer {
case presentPhotoPicker(_ state: Bool)
case toggleShowOriginalImage(_ state: Bool)
case updateSticker(_ sticker: Sticker)
case shareSticker
case dismissShare
case shouldShowShare(_ state: Bool)
}

public var body: some Reducer<State, Action> {
Expand Down Expand Up @@ -85,12 +84,8 @@ public struct StickerReducer {
state.currentSticker = sticker
return .none

case .shareSticker:
state.isCopied = true
return .none

case .dismissShare:
state.isCopied = false
case let .shouldShowShare(bool):
state.isCopied = bool
return .none
}
}
Expand Down
8 changes: 4 additions & 4 deletions Giffy/Features/Sticker/StickerView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,13 @@ struct StickerView: View {
shouldDismissOnTapOutside: true,
isShowing: viewStore.binding(
get: { $0.isCopied },
send: .dismissShare
send: { .shouldShowShare($0) }
)
) {
ShareView(store: viewStore.state.share)
}
.onChange(of: viewStore.state.currentSticker) { sticker, _ in
tabState.isShowShare = sticker.imageData != nil
.onChange(of: viewStore.isCopied) { _, _ in
tabState.isShowShare = viewStore.isCopied
}
.navigationBarTitleDisplayMode(.inline)
.toolbar {
Expand All @@ -86,7 +86,7 @@ struct StickerView: View {
tint: .Theme.green,
size: 15,
onClick: {
viewStore.send(.shareSticker)
viewStore.send(.shouldShowShare(true))
}
)
.tapScaleEffect()
Expand Down

0 comments on commit 65d6cd8

Please sign in to comment.