Commit 033e043
authored
fix: Square payment SDK integration (#900)
## 📜 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:
- seems like Square did such "protection" intentionally;
- Square handler keyboard appearance on their own and it's not possible
to use `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
<!-- High level overview of important changes -->
<!-- For example: fixed status bar manipulation; added new types
declarations; -->
<!-- If your changes don't affect one of platform/language below - then
remove this platform/language -->
### iOS
- don't substitute delegate for Square inputs;
## 🤔 How Has This Been Tested?
tested manually on iPhone 15 Pro (iOS 17.5) in repro example.
## 📸 Screenshots (if appropriate):
<!-- Add screenshots/video if needed -->
<!-- That would be highly appreciated if you can add how it looked
before and after your changes -->
https://github.com/user-attachments/assets/e2ef6a65-9a09-4615-8ef1-c8310f56dcb6
## 📝 Checklist
- [x] CI successfully passed
- [x] I added new mocks and corresponding unit-tests if library API was
changed1 parent 976cfe5 commit 033e043
3 files changed
Lines changed: 21 additions & 3 deletions
File tree
- ios
- delegates
- observers
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
149 | 149 | | |
150 | 150 | | |
151 | 151 | | |
152 | | - | |
| 152 | + | |
| 153 | + | |
153 | 154 | | |
154 | 155 | | |
155 | 156 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
65 | 65 | | |
66 | 66 | | |
67 | 67 | | |
68 | | - | |
| 68 | + | |
69 | 69 | | |
70 | 70 | | |
71 | 71 | | |
| |||
96 | 96 | | |
97 | 97 | | |
98 | 98 | | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
99 | 114 | | |
100 | 115 | | |
101 | 116 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
228 | 228 | | |
229 | 229 | | |
230 | 230 | | |
231 | | - | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
232 | 234 | | |
233 | 235 | | |
234 | 236 | | |
| |||
0 commit comments