New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Expose Delegate Methods #17
Comments
You can use the ResponsiveTextField(
...
onFirstResponderStateChanged: .init(canResignFirstResponder: { false })
) |
Oh gosh, I completely missed this! I gave your idea a shot and I seem to be running into an issue with this technique. I thought my bug had to do with presentation detents, but I removed my usage of detents so I'm pretty confident it has to do with ResponsiveTextField, or perhaps a bug in SwiftUI that I can't track down. In this video I present a screen with a ResponsiveTextField, and then pull it down to dismiss. The sheet does correctly dismiss, I can confirm that by hooking into Persistent.Keyboard.mp4My code looks approximately like this, any typos are transcription issues. ResponsiveTextField(
text: $text,
firstResponderDemand: $firstResponder,
onFirstResponderStateChanged: FirstResponderStateChangeHandler(
handleStateChange: { state in
print("State changed", state)
},
canResignFirstResponder: {
return false
}
),
handleReturn: {
Task {
await self.save()
}
}
) I've also tried a few variants, like setting |
Sorry to bump this but I was wondering if you had any potential insights for this issue, or if it's just the way it'll have to be in a SwiftUI world? |
I'm trying to add functionality to my ResponsiveTextField that normally would be exposed through a
UITextFieldDelegate
, such as preventing a UITextField from dismissing.My initial approach was to try creating a delegate and setting that delegate within the configuration. (Note: that leads to a correct warning
Instance will be immediately deallocated because property 'delegate' is 'weak'
.)Is there any way to add functionality to a ResponsiveTextField through the delegate, or to prevent a keyboard from ever dismissing that I may be overlooking?
The text was updated successfully, but these errors were encountered: