@onekeyfe/react-native-native-list 6.7.0-60 → 6.7.0-61

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.
@@ -47,14 +47,22 @@ final class NativeListMediaFrameCaptureTests: XCTestCase {
47
47
  XCTAssertEqual(UIApplication.shared.applicationState, .active, "Video capture requires a foreground app host")
48
48
  let url = try writeVideo()
49
49
  defer { try? FileManager.default.removeItem(at: url) }
50
- let window = UIWindow(frame: CGRect(x: 0, y: 0, width: 320, height: 480))
51
- window.rootViewController = UIViewController()
52
- window.isHidden = false
53
- defer { window.isHidden = true }
50
+ let sceneWindow = UIApplication.shared.connectedScenes
51
+ .compactMap { $0 as? UIWindowScene }
52
+ .first(where: { $0.activationState == .foregroundActive })?
53
+ .windows.first(where: { $0.isKeyWindow })
54
+ let window = try XCTUnwrap(sceneWindow ?? UIApplication.shared.delegate?.window ?? nil)
55
+ let rootView = try XCTUnwrap(window.rootViewController?.view)
56
+ XCTAssertFalse(window.isHidden, "Video capture requires a visible app window")
57
+ let container = UIView(frame: CGRect(x: 0, y: 0, width: 320, height: 480))
58
+ rootView.addSubview(container)
59
+ defer { container.removeFromSuperview() }
54
60
  let slot = NativeListMediaPreviewSlot()
55
61
  slot.view.frame = CGRect(x: 0, y: 0, width: 120, height: 120)
56
- window.rootViewController?.view.addSubview(slot.view)
62
+ container.addSubview(slot.view)
57
63
  slot.view.layoutIfNeeded()
64
+ XCTAssertTrue(slot.view.window === window)
65
+ XCTAssertTrue(NativeListMediaPreviewSlot.intersectsViewport(slot.view))
58
66
 
59
67
  var loaded: Bool?
60
68
  slot.bind(["uri": url.absoluteString], key: "video", probeOrder: ["video"]) { loaded = $0 }
@@ -73,7 +81,7 @@ final class NativeListMediaFrameCaptureTests: XCTestCase {
73
81
  slot.view.removeFromSuperview()
74
82
  XCTAssertTrue(slot.capturedFrame === frame, "Detaching has no replacement screen scale")
75
83
  XCTAssertEqual(slot.createdPlayerCount, playersBeforeDetach)
76
- window.rootViewController?.view.addSubview(slot.view)
84
+ container.addSubview(slot.view)
77
85
  slot.bind(["uri": url.absoluteString], key: "video", probeOrder: ["video"])
78
86
  XCTAssertTrue(slot.capturedFrame === frame, "The same window retains the same tier")
79
87
  XCTAssertEqual(slot.createdPlayerCount, playersBeforeDetach)
@@ -91,7 +99,7 @@ final class NativeListMediaFrameCaptureTests: XCTestCase {
91
99
  XCTAssertEqual(slot.createdPlayerCount, coldPlayers, "Recycled row reuses the cached still")
92
100
  let second = NativeListMediaPreviewSlot()
93
101
  second.view.frame = CGRect(x: 120, y: 0, width: 120, height: 120)
94
- window.rootViewController?.view.addSubview(second.view)
102
+ container.addSubview(second.view)
95
103
  second.view.layoutIfNeeded()
96
104
  second.bind(["uri": url.absoluteString], key: "another-cell", probeOrder: ["video"])
97
105
  let crossCellDeadline = Date().addingTimeInterval(3)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onekeyfe/react-native-native-list",
3
- "version": "6.7.0-60",
3
+ "version": "6.7.0-61",
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",