Giphy / giphy-ios-sdk

Home of the GIPHY SDK iOS example app, along with iOS SDK documentation, issue tracking, & release notes.
https://developers.giphy.com/
Mozilla Public License 2.0
116 stars 52 forks source link

White box at bottom (unable to ignore bottom safe area) SwiftUI #215

Closed ylai-msrl closed 1 year ago

ylai-msrl commented 1 year ago

Is there any way to ignore the bottom safe area? I am using swiftUI, but the .ignoresSafeArea() have no effects towards this white bottom box, I want the view extended to the bottom of phone. Don't know if the white box is the tab bar or safe area. I used .fullScreenCover to present this view. Thank you! IMG_0037

ALexanderLonsky commented 1 year ago

hey @yoyolty , how do you present the dialog?

.sheet(isPresented: $showingDialog, content: {
    GiphyPicker()
    .ignoresSafeArea()
})

.ignoresSafeArea() removes the white box at the bottom on my end:

Screenshot 2022-12-08 at 18 11 25
ylai-msrl commented 1 year ago

hi @ALexanderLonsky Thank you for your reply! Originally I used .fullScreenCover to present the view. I followed your code but still the white box exist, did you done any special handling in GiphyPicker? If not, I think there might be some other components in my app that blocks.

ALexanderLonsky commented 1 year ago

hi @ylai-msrl, Sorry about the late reply. Here is a full snippet:

import SwiftUI
import GiphyUISDK

struct GiphyPicker: UIViewControllerRepresentable {
    func makeUIViewController(context: UIViewControllerRepresentableContext<GiphyPicker>) -> GiphyViewController {

        Giphy.configure(apiKey: "KEY")

        let giphy =
        GiphyViewController()
        GiphyViewController.trayHeightMultiplier = 1.0
        giphy.swiftUIEnabled = true
        giphy.shouldLocalizeSearch = true
        giphy.dimBackground = true
        giphy.mediaTypeConfig = [.gifs]
        giphy.theme = .init(type: .light)
        giphy.modalPresentationStyle = .currentContext

        return giphy
    }
}

struct ContentView: View {
    @State private var showingDialog = false

    var body: some View {
        Button("Show Giphy Dialog") {
            showingDialog.toggle()
        }
        .padding()
        .sheet(isPresented: $showingDialog, content: {
            GiphyPicker()
                .ignoresSafeArea()
        })

    }
}

Take a look at this line: giphy.swiftUIEnabled = true