@onekeyfe/react-native-native-list 3.0.148 → 3.0.149
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/RNCNativeListView.swift +23 -0
- package/package.json +3 -3
|
@@ -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.149",
|
|
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.149",
|
|
87
|
+
"@onekeyfe/react-native-native-logger": "3.0.149",
|
|
88
88
|
"react": "*",
|
|
89
89
|
"react-native": "*",
|
|
90
90
|
"react-native-nitro-modules": "0.37.0"
|