Skip to content

Commit

Permalink
[android][ios] Upgrade @shopify/flash-list to 1.4.3 (expo#22893)
Browse files Browse the repository at this point in the history
# Why

Upgrades `@shopify/flash-list`  to `1.4.3`


# How

```sh
et uvm -m @shopify/flash-list -c "v1.4.3"
yarn 
et pods -f
```


# Test Plan

- [x] test using `bare-expo` Android + NCL FlashList Example 
- [x] test using `bare-expo` iOS + NCL FlashList Example
- [x] test unversioned expo go ios + NCL FlashList Example
- [x] test unversioned expo go android + NCL FlashList Example

# Checklist
 

- [x] Documentation is up to date to reflect these changes (eg:
https://docs.expo.dev and README.md).
- [x] Conforms with the [Documentation Writing Style
Guide](https://github.com/expo/expo/blob/main/guides/Expo%20Documentation%20Writing%20Style%20Guide.md)
- [x] This diff will work correctly for `expo prebuild` & EAS Build (eg:
updated a module plugin).
  • Loading branch information
gabrieldonadel authored Jun 16, 2023
1 parent f7f790d commit 600cd0c
Show file tree
Hide file tree
Showing 9 changed files with 69 additions and 58 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,23 +25,27 @@ class AutoLayoutShadow {
for (i in 0 until sortedItems.size - 1) {
val cell = sortedItems[i]
val neighbour = sortedItems[i + 1]
// Only apply correction if the next cell is consecutive.
val isNeighbourConsecutive = neighbour.index == cell.index + 1
if (isWithinBounds(cell)) {
if (!horizontal) {
maxBound = kotlin.math.max(maxBound, cell.bottom);
minBound = kotlin.math.min(minBound, cell.top);
maxBoundNeighbour = maxBound
if (cell.left < neighbour.left) {
if (cell.right != neighbour.left) {
neighbour.right = cell.right + neighbour.width
neighbour.left = cell.right
if (isNeighbourConsecutive) {
if (cell.left < neighbour.left) {
if (cell.right != neighbour.left) {
neighbour.right = cell.right + neighbour.width
neighbour.left = cell.right
}
if (cell.top != neighbour.top) {
neighbour.bottom = cell.top + neighbour.height
neighbour.top = cell.top
}
} else {
neighbour.bottom = maxBound + neighbour.height
neighbour.top = maxBound
}
if (cell.top != neighbour.top) {
neighbour.bottom = cell.top + neighbour.height
neighbour.top = cell.top
}
} else {
neighbour.bottom = maxBound + neighbour.height
neighbour.top = maxBound
}
if (isWithinBounds(neighbour)) {
maxBoundNeighbour = kotlin.math.max(maxBound, neighbour.bottom)
Expand All @@ -50,18 +54,20 @@ class AutoLayoutShadow {
maxBound = kotlin.math.max(maxBound, cell.right);
minBound = kotlin.math.min(minBound, cell.left);
maxBoundNeighbour = maxBound
if (cell.top < neighbour.top) {
if (cell.bottom != neighbour.top) {
neighbour.bottom = cell.bottom + neighbour.height
neighbour.top = cell.bottom
}
if (cell.left != neighbour.left) {
neighbour.right = cell.left + neighbour.width
neighbour.left = cell.left
if (isNeighbourConsecutive) {
if (cell.top < neighbour.top) {
if (cell.bottom != neighbour.top) {
neighbour.bottom = cell.bottom + neighbour.height
neighbour.top = cell.bottom
}
if (cell.left != neighbour.left) {
neighbour.right = cell.left + neighbour.width
neighbour.left = cell.left
}
} else {
neighbour.right = maxBound + neighbour.width
neighbour.left = maxBound
}
} else {
neighbour.right = maxBound + neighbour.width
neighbour.left = maxBound
}
if (isWithinBounds(neighbour)) {
maxBoundNeighbour = kotlin.math.max(maxBound, neighbour.right)
Expand Down
4 changes: 2 additions & 2 deletions apps/bare-expo/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -804,7 +804,7 @@ PODS:
- React-Core
- RNDateTimePicker (6.7.3):
- React-Core
- RNFlashList (1.4.0):
- RNFlashList (1.4.3):
- React-Core
- RNGestureHandler (2.10.1):
- React-Core
Expand Down Expand Up @@ -1498,7 +1498,7 @@ SPEC CHECKSUMS:
RNCMaskedView: 949696f25ec596bfc697fc88e6f95cf0c79669b6
RNCPicker: 0bf8ef8f7800524f32d2bb2a8bcadd53eda0ecd1
RNDateTimePicker: 00247f26c34683c80be94207f488f6f13448586e
RNFlashList: 399bf6a0db68f594ad2c86aaff3ea39564f39f8a
RNFlashList: ade81b4e928ebd585dd492014d40fb8d0e848aab
RNGestureHandler: 42ec7c28dd02d540ed6c9159c57a98ff016492dc
RNReanimated: b4f101902606e60b4b045e813e47204c2d7b38a7
RNScreens: 218801c16a2782546d30bd2026bb625c0302d70f
Expand Down
2 changes: 1 addition & 1 deletion apps/bare-expo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
"@react-native-masked-view/masked-view": "0.2.9",
"@react-native-picker/picker": "2.4.8",
"@react-native-segmented-control/segmented-control": "2.4.0",
"@shopify/flash-list": "1.4.0",
"@shopify/flash-list": "1.4.3",
"expo": "~49.0.0-alpha.1",
"expo-camera": "~13.4.0",
"expo-dev-client": "~2.3.0",
Expand Down
2 changes: 1 addition & 1 deletion apps/native-component-list/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
"@react-navigation/native": "~6.0.13",
"@react-navigation/stack": "~6.3.2",
"@react-navigation/elements": "~1.3.6",
"@shopify/flash-list": "1.4.0",
"@shopify/flash-list": "1.4.3",
"@shopify/react-native-skia": "0.1.172",
"date-format": "^2.0.0",
"deep-object-diff": "^1.1.9",
Expand Down
4 changes: 2 additions & 2 deletions ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2234,7 +2234,7 @@ PODS:
- React-perflogger (= 0.72.0-rc.5)
- RNCAsyncStorage (1.17.11):
- React-Core
- RNFlashList (1.4.0):
- RNFlashList (1.4.3):
- React-Core
- RNGestureHandler (2.10.1):
- React-Core
Expand Down Expand Up @@ -3799,7 +3799,7 @@ SPEC CHECKSUMS:
React-utils: cbbe99dc2e49db0a3fbb425c304f511a422f0ca2
ReactCommon: 01b6643cfeef0d9078c8125378066d20cc34ddfe
RNCAsyncStorage: 8616bd5a58af409453ea4e1b246521bb76578d60
RNFlashList: 399bf6a0db68f594ad2c86aaff3ea39564f39f8a
RNFlashList: ade81b4e928ebd585dd492014d40fb8d0e848aab
RNGestureHandler: 42ec7c28dd02d540ed6c9159c57a98ff016492dc
RNReanimated: 48794d0f278349ecb6d94490e7bb184c9cdcd86f
RNScreens: 218801c16a2782546d30bd2026bb625c0302d70f
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "RNFlashList",
"version": "1.4.0",
"version": "1.4.3",
"summary": "FlashList is a more performant FlatList replacement",
"homepage": "https://shopify.github.io/flash-list/",
"license": "MIT",
Expand All @@ -11,7 +11,7 @@
},
"source": {
"git": "https://github.com/shopify/flash-list.git",
"tag": "v1.4.0"
"tag": "v1.4.3"
},
"source_files": "ios/Sources/**/*",
"requires_arc": true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,9 @@ import UIKit

override func layoutSubviews() {
fixLayout()
fixFooter()
super.layoutSubviews()

let scrollView = getScrollView()
guard enableInstrumentation, let scrollView = scrollView else { return }
guard enableInstrumentation, let scrollView = getScrollView() else { return }

let scrollContainerSize = horizontal ? scrollView.frame.width : scrollView.frame.height
let currentScrollOffset = horizontal ? scrollView.contentOffset.x : scrollView.contentOffset.y
Expand Down Expand Up @@ -103,6 +101,7 @@ import UIKit
}
.sorted(by: { $0.index < $1.index })
clearGaps(for: cellContainers)
fixFooter()
}

/// Checks for overlaps or gaps between adjacent items and then applies a correction.
Expand All @@ -124,6 +123,8 @@ import UIKit
let nextCellTop = nextCell.frame.minY
let nextCellLeft = nextCell.frame.minX

// Only apply correction if the next cell is consecutive.
let isNextCellConsecutive = nextCell.index == cellContainer.index + 1

guard
isWithinBounds(
Expand All @@ -149,33 +150,37 @@ import UIKit
maxBound = max(maxBound, cellRight)
minBound = min(minBound, cellLeft)
maxBoundNextCell = maxBound
if cellTop < nextCellTop {
if cellBottom != nextCellTop {
nextCell.frame.origin.y = cellBottom
}
if cellLeft != nextCellLeft {
nextCell.frame.origin.x = cellLeft
}
} else {
nextCell.frame.origin.x = maxBound
}
if isNextCellConsecutive {
if cellTop < nextCellTop {
if cellBottom != nextCellTop {
nextCell.frame.origin.y = cellBottom
}
if cellLeft != nextCellLeft {
nextCell.frame.origin.x = cellLeft
}
} else {
nextCell.frame.origin.x = maxBound
}
}
if isNextCellVisible {
maxBoundNextCell = max(maxBound, nextCell.frame.maxX)
}
} else {
maxBound = max(maxBound, cellBottom)
minBound = min(minBound, cellTop)
maxBoundNextCell = maxBound
if cellLeft < nextCellLeft {
if cellRight != nextCellLeft {
nextCell.frame.origin.x = cellRight
}
if cellTop != nextCellTop {
nextCell.frame.origin.y = cellTop
}
} else {
nextCell.frame.origin.y = maxBound
}
if isNextCellConsecutive {
if cellLeft < nextCellLeft {
if cellRight != nextCellLeft {
nextCell.frame.origin.x = cellRight
}
if cellTop != nextCellTop {
nextCell.frame.origin.y = cellTop
}
} else {
nextCell.frame.origin.y = maxBound
}
}
if isNextCellVisible {
maxBoundNextCell = max(maxBound, nextCell.frame.maxY)
}
Expand Down
2 changes: 1 addition & 1 deletion packages/expo/bundledNativeModules.json
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,6 @@
"unimodules-app-loader": "~4.1.2",
"unimodules-image-loader-interface": "~6.1.0",
"@shopify/react-native-skia": "0.1.172",
"@shopify/flash-list": "1.4.0",
"@shopify/flash-list": "1.4.3",
"@sentry/react-native": "4.15.2"
}
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3514,10 +3514,10 @@
component-type "^1.2.1"
join-component "^1.1.0"

"@shopify/[email protected].0":
version "1.4.0"
resolved "https://registry.yarnpkg.com/@shopify/flash-list/-/flash-list-1.4.0.tgz#cf299486ec9a7c97b7a8b1e8b6bf144a78141ed6"
integrity sha512-PvPOyk353LuETFnNA038+QaJsAFlCQ2TYC7DHP3YnYqTX72g2BM6qLoLsPaptXKuoXX+dinOo0MbEm7HDjTy1g==
"@shopify/[email protected].3":
version "1.4.3"
resolved "https://registry.yarnpkg.com/@shopify/flash-list/-/flash-list-1.4.3.tgz#b7a4fe03d64f3c5ce9646859b49b9d95307f203d"
integrity sha512-jtIReAbwWzYBV0dQ6Io9wBX+pD0C4qQFMrb5/fkEvX8PYDgBl5KRYvpfr9WLLj8CV2Jsn1X0mYOsB+ysWrI/8g==
dependencies:
recyclerlistview "4.2.0"
tslib "2.4.0"
Expand Down

0 comments on commit 600cd0c

Please sign in to comment.