@shopify/flash-list 1.4.2 → 1.4.3

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.
Files changed (31) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/android/src/test/java/com/shopify/reactnative/flash_list/AutoLayoutShadowTest.kt +10 -9
  3. package/android/src/test/java/com/shopify/reactnative/flash_list/models/Rect.kt +3 -1
  4. package/android/src/test/resources/LayoutTestData.json +160 -80
  5. package/dist/FlashList.d.ts.map +1 -1
  6. package/dist/FlashList.js +1 -1
  7. package/dist/FlashList.js.map +1 -1
  8. package/dist/native/config/PlatformHelper.android.d.ts +5 -0
  9. package/dist/native/config/PlatformHelper.android.d.ts.map +1 -1
  10. package/dist/native/config/PlatformHelper.android.js +2 -0
  11. package/dist/native/config/PlatformHelper.android.js.map +1 -1
  12. package/dist/native/config/PlatformHelper.d.ts +5 -0
  13. package/dist/native/config/PlatformHelper.d.ts.map +1 -1
  14. package/dist/native/config/PlatformHelper.ios.d.ts +5 -0
  15. package/dist/native/config/PlatformHelper.ios.d.ts.map +1 -1
  16. package/dist/native/config/PlatformHelper.ios.js +1 -0
  17. package/dist/native/config/PlatformHelper.ios.js.map +1 -1
  18. package/dist/native/config/PlatformHelper.js +1 -0
  19. package/dist/native/config/PlatformHelper.js.map +1 -1
  20. package/dist/native/config/PlatformHelper.web.d.ts +5 -0
  21. package/dist/native/config/PlatformHelper.web.d.ts.map +1 -1
  22. package/dist/native/config/PlatformHelper.web.js +1 -0
  23. package/dist/native/config/PlatformHelper.web.js.map +1 -1
  24. package/dist/tsconfig.tsbuildinfo +1 -1
  25. package/ios/Sources/AutoLayoutView.swift +1 -2
  26. package/package.json +2 -2
  27. package/src/FlashList.tsx +1 -1
  28. package/src/native/config/PlatformHelper.android.ts +2 -0
  29. package/src/native/config/PlatformHelper.ios.ts +1 -0
  30. package/src/native/config/PlatformHelper.ts +1 -0
  31. package/src/native/config/PlatformHelper.web.ts +1 -0
package/CHANGELOG.md CHANGED
@@ -7,6 +7,18 @@ and adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ - Fix definition conflicts with previous value
11
+ - https://github.com/Shopify/flash-list/pull/795
12
+ - Fix Android unit test
13
+ - https://github.com/Shopify/flash-list/pull/815
14
+ - Fix performance issues with inverted lists on Android
15
+ - https://github.com/Shopify/flash-list/pull/819
16
+
17
+ ## [1.4.2] - 2023-03-20
18
+
19
+ - Apply layout correction only to consecutive cells
20
+ - https://github.com/Shopify/flash-list/pull/788
21
+
10
22
  ## [1.4.1] - 2023-01-24
11
23
 
12
24
  - Prevent overflow of sticky headers
@@ -57,25 +57,25 @@ internal class AutoLayoutShadowTest {
57
57
 
58
58
  //--------- Vertical -----------
59
59
  //Item above visible window
60
- arrayOf<CellContainer>(getRect(0, 0, 100, 100), getRect(120, 0, 100, 100)).let {
60
+ arrayOf<CellContainer>(getRect(0, 0, 100, 100, 0), getRect(120, 0, 100, 100, 1)).let {
61
61
  alShadow.clearGapsAndOverlaps(it)
62
62
  assertEquals(120, it[1].left)
63
63
  }
64
64
 
65
65
  //Item below visible window
66
- arrayOf<CellContainer>(getRect(0, 0, 100, 100), getRect(120, 550, 100, 100)).let {
66
+ arrayOf<CellContainer>(getRect(0, 0, 100, 100, 0), getRect(120, 550, 100, 100, 1)).let {
67
67
  alShadow.clearGapsAndOverlaps(it)
68
68
  assertEquals(550, it[1].top)
69
69
  }
70
70
 
71
71
  //Item within visible window
72
- arrayOf<CellContainer>(getRect(0, 250, 100, 100), getRect(120, 250, 100, 100)).let {
72
+ arrayOf<CellContainer>(getRect(0, 250, 100, 100, 0), getRect(120, 250, 100, 100, 1)).let {
73
73
  alShadow.clearGapsAndOverlaps(it)
74
74
  assertEquals(100, it[1].left)
75
75
  }
76
76
 
77
77
  //At the top edge
78
- arrayOf<CellContainer>(getRect(0, 200, 100, 100), getRect(120, 200, 100, 100)).let {
78
+ arrayOf<CellContainer>(getRect(0, 200, 100, 100, 0), getRect(120, 200, 100, 100, 1)).let {
79
79
  alShadow.clearGapsAndOverlaps(it)
80
80
  assertEquals(100, it[1].left)
81
81
  }
@@ -85,25 +85,25 @@ internal class AutoLayoutShadowTest {
85
85
  alShadow.horizontal = true
86
86
 
87
87
  //Item left of visible window
88
- arrayOf<CellContainer>(getRect(0, 0, 100, 100), getRect(0, 120, 100, 100)).let {
88
+ arrayOf<CellContainer>(getRect(0, 0, 100, 100, 0), getRect(0, 120, 100, 100, 1)).let {
89
89
  alShadow.clearGapsAndOverlaps(it)
90
90
  assertEquals(120, it[1].top)
91
91
  }
92
92
 
93
93
  //Item right of visible window
94
- arrayOf<CellContainer>(getRect(0, 0, 100, 100), getRect(550, 120, 100, 100)).let {
94
+ arrayOf<CellContainer>(getRect(0, 0, 100, 100, 0), getRect(550, 120, 100, 100, 1)).let {
95
95
  alShadow.clearGapsAndOverlaps(it)
96
96
  assertEquals(120, it[1].top)
97
97
  }
98
98
 
99
99
  //Item within visible window
100
- arrayOf<CellContainer>(getRect(250, 0, 100, 100), getRect(250, 120, 100, 100)).let {
100
+ arrayOf<CellContainer>(getRect(250, 0, 100, 100, 0), getRect(250, 120, 100, 100, 1)).let {
101
101
  alShadow.clearGapsAndOverlaps(it)
102
102
  assertEquals(100, it[1].top)
103
103
  }
104
104
 
105
105
  //At the left edge
106
- arrayOf<CellContainer>(getRect(200, 0, 100, 100), getRect(250, 150, 100, 100)).let {
106
+ arrayOf<CellContainer>(getRect(200, 0, 100, 100, 0), getRect(250, 150, 100, 100, 1)).let {
107
107
  alShadow.clearGapsAndOverlaps(it)
108
108
  assertEquals(100, it[1].top)
109
109
  }
@@ -127,12 +127,13 @@ internal class AutoLayoutShadowTest {
127
127
  return gson.fromJson<TestDataModel>(str, TestDataModel::class.java)
128
128
  }
129
129
 
130
- private fun getRect(l: Int, t: Int, r: Int, b: Int): Rect {
130
+ private fun getRect(l: Int, t: Int, r: Int, b: Int, index: Int): Rect {
131
131
  var rect = Rect(b - t, r - l)
132
132
  rect.left = l
133
133
  rect.right = r
134
134
  rect.bottom = b
135
135
  rect.top = t
136
+ rect.index = index
136
137
  return rect
137
138
  }
138
139
 
@@ -9,12 +9,14 @@ class Rect (h: Int? = 0, w: Int? = 0): CellContainer {
9
9
  private var bottom = 0
10
10
  private var height = 0
11
11
  private var width = 0
12
+ private var index = 0
12
13
 
13
14
  override fun setIndex(value: Int) {
15
+ index = value
14
16
  }
15
17
 
16
18
  override fun getIndex(): Int {
17
- return 0
19
+ return index
18
20
  }
19
21
 
20
22
  override fun setLeft(value: Int) {