@onekeyfe/react-native-native-list 3.0.140 → 3.0.142

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.
@@ -60,7 +60,7 @@ final class NativeListView: UIView {
60
60
  }
61
61
 
62
62
  private let flowLayout = NativeListFlowLayout()
63
- private lazy var collectionView = UICollectionView(frame: .zero, collectionViewLayout: flowLayout)
63
+ private lazy var collectionView = NativeListCollectionView(frame: .zero, collectionViewLayout: flowLayout)
64
64
  private let footerContainer = UIView()
65
65
  private let footerCell = NativeListCell(frame: .zero)
66
66
  private let sectionIndexView = NativeListSectionIndexView()
@@ -2214,6 +2214,26 @@ extension NativeListView: UICollectionViewDragDelegate, UICollectionViewDropDele
2214
2214
  }
2215
2215
  }
2216
2216
 
2217
+ // UIScrollView holds touch-down for about 150 ms while it decides whether a touch scrolls, so a
2218
+ // quick tap highlighted and unhighlighted a row within one frame and the pressed background never
2219
+ // rendered. Deliver touches immediately, as Android rows do.
2220
+ private final class NativeListCollectionView: UICollectionView {
2221
+ override init(frame: CGRect, collectionViewLayout layout: UICollectionViewLayout) {
2222
+ super.init(frame: frame, collectionViewLayout: layout)
2223
+ delaysContentTouches = false
2224
+ }
2225
+
2226
+ required init?(coder: NSCoder) {
2227
+ fatalError("init(coder:) has not been implemented")
2228
+ }
2229
+
2230
+ // Without the delay, in-row buttons receive touches first; UIScrollView would otherwise refuse
2231
+ // to cancel UIControl touches, so a drag starting on a badge or accessory could not scroll.
2232
+ override func touchesShouldCancel(in view: UIView) -> Bool {
2233
+ view is UIControl ? true : super.touchesShouldCancel(in: view)
2234
+ }
2235
+ }
2236
+
2217
2237
  final class NativeListFlowLayout: UICollectionViewFlowLayout {
2218
2238
  var stickyItemIndexes: Set<Int> = []
2219
2239
  private var horizontalAttributes: [IndexPath: UICollectionViewLayoutAttributes] = [:]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onekeyfe/react-native-native-list",
3
- "version": "3.0.140",
3
+ "version": "3.0.142",
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.140",
87
- "@onekeyfe/react-native-native-logger": "3.0.140",
86
+ "@onekeyfe/react-native-image": "3.0.142",
87
+ "@onekeyfe/react-native-native-logger": "3.0.142",
88
88
  "react": "*",
89
89
  "react-native": "*",
90
90
  "react-native-nitro-modules": "0.37.0"