@stripe/stripe-react-native 0.47.0 → 0.47.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
# CHANGELOG
|
|
2
|
+
## 0.47.1 - 2025-29-2025
|
|
3
|
+
|
|
4
|
+
**Fixes**
|
|
5
|
+
- Fixed EmbeddedPaymentElement unable to present view controllers after navigating back and forth between screens.
|
|
6
|
+
- Fixed EmbeddedPaymentElement not sizing correctly on Android when the user has saved payment methods.
|
|
7
|
+
|
|
2
8
|
## 0.47.0 - 2025-05-21
|
|
3
9
|
|
|
4
10
|
**Features**
|
|
@@ -3,4 +3,4 @@ StripeSdk_compileSdkVersion=30
|
|
|
3
3
|
StripeSdk_targetSdkVersion=28
|
|
4
4
|
StripeSdk_minSdkVersion=21
|
|
5
5
|
# Keep StripeSdk_stripeVersion in sync with https://github.com/stripe/stripe-identity-react-native/blob/main/android/gradle.properties
|
|
6
|
-
StripeSdk_stripeVersion=21.
|
|
6
|
+
StripeSdk_stripeVersion=21.15.+
|
|
@@ -182,7 +182,13 @@ class EmbeddedPaymentElementView(
|
|
|
182
182
|
height = minIntrinsicHeight
|
|
183
183
|
|
|
184
184
|
layout(constraints.maxWidth, minIntrinsicHeight) {
|
|
185
|
-
measurable
|
|
185
|
+
measurable
|
|
186
|
+
.measure(
|
|
187
|
+
constraints.copy(
|
|
188
|
+
minHeight = minIntrinsicHeight,
|
|
189
|
+
maxHeight = minIntrinsicHeight,
|
|
190
|
+
),
|
|
191
|
+
).placeRelative(IntOffset.Zero)
|
|
186
192
|
}
|
|
187
193
|
}.onPlaced {
|
|
188
194
|
reportHeightChange(
|
|
@@ -11,39 +11,78 @@ import UIKit
|
|
|
11
11
|
|
|
12
12
|
@objc(EmbeddedPaymentElementView)
|
|
13
13
|
class EmbeddedPaymentElementView: RCTViewManager {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
14
|
+
|
|
15
|
+
override static func requiresMainQueueSetup() -> Bool {
|
|
16
|
+
return true
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
override func view() -> UIView! {
|
|
20
|
+
return EmbeddedPaymentElementContainerView(frame: .zero)
|
|
21
|
+
}
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
@objc(EmbeddedPaymentElementContainerView)
|
|
25
25
|
public class EmbeddedPaymentElementContainerView: UIView, UIGestureRecognizerDelegate {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
26
|
+
private var embeddedPaymentElementView: UIView?
|
|
27
|
+
|
|
28
|
+
override init(frame: CGRect) {
|
|
29
|
+
super.init(frame: frame)
|
|
30
|
+
backgroundColor = .clear
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
required init?(coder: NSCoder) {
|
|
34
|
+
fatalError()
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
public override func didMoveToWindow() {
|
|
38
|
+
super.didMoveToWindow()
|
|
39
|
+
if window != nil {
|
|
40
|
+
// Only attach when we have a valid window
|
|
41
|
+
attachPaymentElementIfAvailable()
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
public override func willMove(toWindow newWindow: UIWindow?) {
|
|
46
|
+
super.willMove(toWindow: newWindow)
|
|
47
|
+
if newWindow == nil {
|
|
48
|
+
// Remove the embedded view when moving away from window
|
|
49
|
+
removePaymentElement()
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
private func attachPaymentElementIfAvailable() {
|
|
54
|
+
// Don't attach if already attached
|
|
55
|
+
guard embeddedPaymentElementView == nil,
|
|
56
|
+
let embeddedElement = StripeSdkImpl.shared.embeddedInstance else {
|
|
57
|
+
return
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
let paymentElementView = embeddedElement.view
|
|
61
|
+
addSubview(paymentElementView)
|
|
62
|
+
paymentElementView.translatesAutoresizingMaskIntoConstraints = false
|
|
63
|
+
|
|
64
|
+
NSLayoutConstraint.activate([
|
|
65
|
+
paymentElementView.topAnchor.constraint(equalTo: topAnchor),
|
|
66
|
+
paymentElementView.leadingAnchor.constraint(equalTo: leadingAnchor),
|
|
67
|
+
paymentElementView.trailingAnchor.constraint(equalTo: trailingAnchor),
|
|
68
|
+
paymentElementView.bottomAnchor.constraint(equalTo: bottomAnchor),
|
|
69
|
+
])
|
|
70
|
+
|
|
71
|
+
self.embeddedPaymentElementView = paymentElementView
|
|
72
|
+
|
|
73
|
+
// Update the presenting view controller whenever we attach
|
|
74
|
+
updatePresentingViewController()
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
private func removePaymentElement() {
|
|
78
|
+
embeddedPaymentElementView?.removeFromSuperview()
|
|
79
|
+
embeddedPaymentElementView = nil
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
private func updatePresentingViewController() {
|
|
83
|
+
DispatchQueue.main.async { [weak self] in
|
|
84
|
+
guard let self = self else { return }
|
|
85
|
+
StripeSdkImpl.shared.embeddedInstance?.presentingViewController = RCTPresentedViewController()
|
|
86
|
+
}
|
|
87
|
+
}
|
|
49
88
|
}
|