fix: Square payment SDK integration #900
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
📜 Description
Fixed an integration with Square SDK.
💡 Motivation and Context
The current problem is that
SQIPTextFieldInputModifier
always redirects call to an injected (KCCompositeDelegate
) delegate - and it causes infinite loop that eventually leads to a crash 🤷♂️I've tried to find source code of
SQIPTextFieldInputModifier
but it's closed, and I can not read it.So far I had two approaches to fix it:
1️⃣ Add state variable and prevent infinite calls
While it solves the problem, it produces other problems - it looks like original delegate methods never gets called and in this case we break Square SDK, so it's not really an option.
2️⃣ Don't set delegate for
SQIPTextFieldInputModifier
While it breaks the principle that any focused input will intercept events it makes certain sense:
react-native-keyboard-controller
component there.So after thinking a while I decided that we shouldn't inject our delegate for
Square
SDK inputs. The solution may be not perfect, but for now it totally works. If it causes more issues, then I'll be glad to re-consider the solution with new info in mind.Closes #896
📢 Changelog
iOS
🤔 How Has This Been Tested?
tested manually on iPhone 15 Pro (iOS 17.5) in repro example.
📸 Screenshots (if appropriate):
Simulator.Screen.Recording.-.iPhone.15.Pro.-.2025-04-15.at.10.09.54.mp4
📝 Checklist