@onekeyfe/react-native-native-list 3.0.148 → 3.0.151
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/ios/NativeListCell.swift
CHANGED
|
@@ -835,10 +835,13 @@ final class NativeListCell: UICollectionViewCell {
|
|
|
835
835
|
super.layoutSubviews()
|
|
836
836
|
if let item = currentItem, item.type == "system", item.data.string("presentation") == "market",
|
|
837
837
|
["noMatch", "retry"].contains(item.data.string("variant")), !titleLabel.isHidden {
|
|
838
|
-
|
|
838
|
+
titleLabel.transform = .identity
|
|
839
|
+
// Settle each nested stack before measuring; the content view alone can leave stale descendant frames.
|
|
839
840
|
contentView.layoutIfNeeded()
|
|
841
|
+
rootStack.layoutIfNeeded()
|
|
842
|
+
mainStack.layoutIfNeeded()
|
|
843
|
+
titleRowStack.layoutIfNeeded()
|
|
840
844
|
// React Native floors text origins to physical pixels after centering the line box.
|
|
841
|
-
titleLabel.transform = .identity
|
|
842
845
|
let scale = max(1, window?.screen.scale ?? traitCollection.displayScale)
|
|
843
846
|
let origin = titleLabel.convert(titleLabel.bounds, to: contentView).origin
|
|
844
847
|
let x = floor((contentView.bounds.width - titleLabel.bounds.width) / 2 * scale) / scale
|
|
@@ -2269,9 +2269,32 @@ final class NativeListFlowLayout: UICollectionViewFlowLayout {
|
|
|
2269
2269
|
|
|
2270
2270
|
override func shouldInvalidateLayout(forBoundsChange newBounds: CGRect) -> Bool {
|
|
2271
2271
|
if scrollDirection == .horizontal, collectionView?.bounds.size != newBounds.size { return true }
|
|
2272
|
+
if crossAxisLengthChanged(to: newBounds) { return true }
|
|
2272
2273
|
return !stickyItemIndexes.isEmpty || super.shouldInvalidateLayout(forBoundsChange: newBounds)
|
|
2273
2274
|
}
|
|
2274
2275
|
|
|
2276
|
+
// OneKey patch: sizeForItemAt sizes rows from the list's cross-axis length, but
|
|
2277
|
+
// the context UIKit builds for a bounds change does not query the delegate again.
|
|
2278
|
+
// A list resized after its first layout (iPad rotation, a sheet that settles at its
|
|
2279
|
+
// final width) kept its old row size, so a narrower row was centered in the list.
|
|
2280
|
+
override func invalidationContext(
|
|
2281
|
+
forBoundsChange newBounds: CGRect
|
|
2282
|
+
) -> UICollectionViewLayoutInvalidationContext {
|
|
2283
|
+
let context = super.invalidationContext(forBoundsChange: newBounds)
|
|
2284
|
+
if crossAxisLengthChanged(to: newBounds),
|
|
2285
|
+
let flowContext = context as? UICollectionViewFlowLayoutInvalidationContext {
|
|
2286
|
+
flowContext.invalidateFlowLayoutDelegateMetrics = true
|
|
2287
|
+
}
|
|
2288
|
+
return context
|
|
2289
|
+
}
|
|
2290
|
+
|
|
2291
|
+
private func crossAxisLengthChanged(to newBounds: CGRect) -> Bool {
|
|
2292
|
+
guard let collectionView else { return false }
|
|
2293
|
+
return scrollDirection == .horizontal
|
|
2294
|
+
? collectionView.bounds.height != newBounds.height
|
|
2295
|
+
: collectionView.bounds.width != newBounds.width
|
|
2296
|
+
}
|
|
2297
|
+
|
|
2275
2298
|
override func layoutAttributesForElements(in rect: CGRect) -> [UICollectionViewLayoutAttributes]? {
|
|
2276
2299
|
if scrollDirection == .horizontal {
|
|
2277
2300
|
return horizontalAttributes.values
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@onekeyfe/react-native-native-list",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.151",
|
|
4
4
|
"description": "Template-driven native RecyclerView and UICollectionView for React Native",
|
|
5
5
|
"source": "./src/index.ts",
|
|
6
6
|
"main": "./lib/module/index.js",
|
|
@@ -83,8 +83,8 @@
|
|
|
83
83
|
"typescript": "^5.9.2"
|
|
84
84
|
},
|
|
85
85
|
"peerDependencies": {
|
|
86
|
-
"@onekeyfe/react-native-image": "3.0.
|
|
87
|
-
"@onekeyfe/react-native-native-logger": "3.0.
|
|
86
|
+
"@onekeyfe/react-native-image": "3.0.151",
|
|
87
|
+
"@onekeyfe/react-native-native-logger": "3.0.151",
|
|
88
88
|
"react": "*",
|
|
89
89
|
"react-native": "*",
|
|
90
90
|
"react-native-nitro-modules": "0.37.0"
|