@shopify/flash-list 1.4.2 → 1.5.0

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 (33) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/android/build.gradle +1 -1
  3. package/android/src/test/java/com/shopify/reactnative/flash_list/AutoLayoutShadowTest.kt +10 -9
  4. package/android/src/test/java/com/shopify/reactnative/flash_list/models/Rect.kt +3 -1
  5. package/android/src/test/resources/LayoutTestData.json +160 -80
  6. package/dist/FlashList.d.ts.map +1 -1
  7. package/dist/FlashList.js +2 -2
  8. package/dist/FlashList.js.map +1 -1
  9. package/dist/native/config/PlatformHelper.android.d.ts +10 -0
  10. package/dist/native/config/PlatformHelper.android.d.ts.map +1 -1
  11. package/dist/native/config/PlatformHelper.android.js +3 -0
  12. package/dist/native/config/PlatformHelper.android.js.map +1 -1
  13. package/dist/native/config/PlatformHelper.d.ts +10 -0
  14. package/dist/native/config/PlatformHelper.d.ts.map +1 -1
  15. package/dist/native/config/PlatformHelper.ios.d.ts +10 -0
  16. package/dist/native/config/PlatformHelper.ios.d.ts.map +1 -1
  17. package/dist/native/config/PlatformHelper.ios.js +2 -0
  18. package/dist/native/config/PlatformHelper.ios.js.map +1 -1
  19. package/dist/native/config/PlatformHelper.js +2 -0
  20. package/dist/native/config/PlatformHelper.js.map +1 -1
  21. package/dist/native/config/PlatformHelper.web.d.ts +10 -0
  22. package/dist/native/config/PlatformHelper.web.d.ts.map +1 -1
  23. package/dist/native/config/PlatformHelper.web.js +2 -0
  24. package/dist/native/config/PlatformHelper.web.js.map +1 -1
  25. package/dist/tsconfig.tsbuildinfo +1 -1
  26. package/ios/Sources/AutoLayoutView.swift +1 -2
  27. package/jestSetup.js +1 -0
  28. package/package.json +2 -2
  29. package/src/FlashList.tsx +4 -2
  30. package/src/native/config/PlatformHelper.android.ts +3 -0
  31. package/src/native/config/PlatformHelper.ios.ts +2 -0
  32. package/src/native/config/PlatformHelper.ts +2 -0
  33. package/src/native/config/PlatformHelper.web.ts +2 -0
package/CHANGELOG.md CHANGED
@@ -7,6 +7,23 @@ and adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ - Update kotlin version to 1.8.10 for RN 0.72 compatibility
11
+ - https://github.com/Shopify/flash-list/pull/865
12
+
13
+ ## [1.4.3] - 2023-04-24
14
+
15
+ - Fix definition conflicts with previous value
16
+ - https://github.com/Shopify/flash-list/pull/795
17
+ - Fix Android unit test
18
+ - https://github.com/Shopify/flash-list/pull/815
19
+ - Fix performance issues with inverted lists on Android
20
+ - https://github.com/Shopify/flash-list/pull/819
21
+
22
+ ## [1.4.2] - 2023-03-20
23
+
24
+ - Apply layout correction only to consecutive cells
25
+ - https://github.com/Shopify/flash-list/pull/788
26
+
10
27
  ## [1.4.1] - 2023-01-24
11
28
 
12
29
  - Prevent overflow of sticky headers
@@ -15,7 +15,7 @@ def _androidTestRunnerVersion = _ext.has('androidTestRunnerVersion') ? _ext.andr
15
15
 
16
16
  buildscript {
17
17
  // buildscript is evaluated before any other task is executed, so this must be defined here
18
- ext._kotlinVersion = rootProject.ext.has("kotlinVersion") ? rootProject.ext.get('kotlinVersion') : '1.5.30'
18
+ ext._kotlinVersion = rootProject.ext.has("kotlinVersion") ? rootProject.ext.get('kotlinVersion') : '1.8.10'
19
19
 
20
20
  repositories {
21
21
  mavenCentral()
@@ -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) {