Giter VIP home page Giter VIP logo

Comments (4)

ChurikiTenna avatar ChurikiTenna commented on May 27, 2024 1

@paescebu

Thank you for the response.
Fixing the padding solved the issue!

Thank you for the kind support, and for making the great package.

Cheers!

from customkeyboardkit.

paescebu avatar paescebu commented on May 27, 2024

Hi @ChurikiTenna!

Thanks so much for trying out my Swift Package! Very happy to help you out!
I quickly tried your example code (had to do some adjustments for it to compile).
In my case I don't have any issues with your example code:

struct ContentView: View {
    @State private var text = "ExampleText"
    
    var body: some View {
        ScrollView {
            VStack {
                Spacer()
                TextField("Hello", text: $text)
                    .useDecimalPickerStyle()
                Spacer()
            }
            .frame(height: 800)
        }
        .background(Color.green)
    }
}

extension TextField {
    func useDecimalPickerStyle() -> some View {
        self.customKeyboard(.decimalPicker)
    }
}
extension CustomKeyboard {
    static var decimalPicker: CustomKeyboard {
        CustomKeyboardBuilder { textDocumentProxy, submit, playSystemFeedback in
            DecimalPicker(handler: textDocumentProxy)
        }
    }
}

struct DecimalPicker: View {
    let isWheel = true
    let handler: UITextDocumentProxy
    
    var body: some View {
        VStack(alignment:.leading) {
            HStack {
                Button(action: {
                }) {
                    Text(self.isWheel ? "キーボード入力に切り替える" : "ピッカー入力に切り替える")
                        .foregroundColor(Color.blue).font(Font.system(size: 18))
                }
                .padding()
                Spacer()
                Button(action: {
                }) {
                    Text("完了").foregroundColor(Color.blue).font(Font.system(size: 18))
                }
                .padding()
            }
            .background(Color(red: 245/255, green: 245/255, blue: 245/255))
            Spacer()
        }
        .frame(height: 300)
        .background(Color.red)
    }
}

Produces for me:
image

Could you provide maybe example code that exactly produces your issue?

Kind regards!
Pascal

from customkeyboardkit.

paescebu avatar paescebu commented on May 27, 2024

Another thought,
Could maybe the padding you see be coming from the bottom of the View that contains your ScrollView/Screen?
Maybe you added a padding to the whole view to omit the home bar?

FYI, if the keyboard shows, the whole View shrinks to the size above the keyboard.
Theoretically you would see the same "error" with the standard iOS Keyboard, i.e. when not using a custom keyboard

Example:

struct ContentView: View {
    @State private var text = "ExampleText"
    
    var body: some View {
        ScrollView {
            VStack {
                Spacer()
                TextField("Hello", text: $text)
                    .useDecimalPickerStyle()
                Spacer()
            }
            .frame(height: 800)
        }
        .background(Color.green)
        .padding(.bottom, 10)      //this padding potentially causing issues?
        .background(Color.blue) //padding is now highlighted in blue
    }
}

Would produce this unwanted blue padding:
image

from customkeyboardkit.

paescebu avatar paescebu commented on May 27, 2024

@ChurikiTenna
Awesome! Glad I could help!
Have a nice weekend!

:)

from customkeyboardkit.

Related Issues (16)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.