Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Move virtualized lists to @react-native/virtualized-lists #35406

Conversation

gabrieldonadel
Copy link
Collaborator

Summary

This PR moves VirtualizedList, VirtualizedSectionList, and its files to a separate package called @react-native/virtualized-lists located under packages/virtualized-lists as proposed on #35263

Changelog

[General] [Changed] - Move virtualized lists to @react-native/virtualized-lists package

Test Plan

  1. Open the RNTester app and navigate to FlatList or SectionList page
  2. Test virtualized lists through the many sections
Screen.Recording.2022-11-19.at.22.46.13.mov

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Nov 20, 2022
@github-actions
Copy link

github-actions bot commented Nov 20, 2022

Warnings
⚠️ 🔒 package.json - Changes were made to package.json. This will require a manual import by a Facebook employee.

Generated by 🚫 dangerJS against b52ee19

@gabrieldonadel gabrieldonadel force-pushed the feat/add-virtualized-lists-package branch 10 times, most recently from c2dfa4a to b942261 Compare November 20, 2022 03:35
@analysis-bot
Copy link

analysis-bot commented Nov 20, 2022

Platform Engine Arch Size (bytes) Diff
android hermes arm64-v8a 8,465,486 +264
android hermes armeabi-v7a 7,786,018 +262
android hermes x86 8,938,606 +269
android hermes x86_64 8,797,029 +272
android jsc arm64-v8a 9,650,929 +314
android jsc armeabi-v7a 8,385,393 +322
android jsc x86 9,713,150 +306
android jsc x86_64 10,190,292 +305

Base commit: 1fef376
Branch: main

@analysis-bot
Copy link

analysis-bot commented Nov 20, 2022

Platform Engine Arch Size (bytes) Diff
ios - universal n/a --

Base commit: 621969b
Branch: main

@pull-bot
Copy link

PR build artifact for b942261 is ready.
To use, download tarball from "Artifacts" tab in this CircleCI job then run yarn add <path to tarball> in your React Native project.

@pull-bot
Copy link

PR build artifact for 59fea61 is ready.
To use, download tarball from "Artifacts" tab in this CircleCI job then run yarn add <path to tarball> in your React Native project.

@gabrieldonadel
Copy link
Collaborator Author

@cortinico and @necolas, any thoughts on how to set up @react-native/virtualized-lists so react-native can locate this package when running CI tests using the template before we actually publish this to npm?

@hoxyq
Copy link
Contributor

hoxyq commented Nov 21, 2022

@cortinico and @necolas, any thoughts on how to set up @react-native/virtualized-lists so react-native can locate this package when running CI tests using the template before we actually publish this to npm?

Right now I am using Verdaccio and publishing necessary packages to local proxy. You can check how I did it in this commit.

I am currently working on first phase of monorepo project #34692, this should unblock you after we will merge my proposed changes

Copy link
Contributor

@NickGerleman NickGerleman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left some comments. Would also like some feedback from @necolas, but my sense is that we shouldn't extract to a separate package if both packages are still relying on each others private APIs. The package would not yet be reusable (even across different versions of RN), and the boundaries between the two are not enforced.

Copying the set of internal transitive dependencies to VirtualizedList so it doesn't rely on the internals seems like a potential start for migrating though, and it would allow us to shim between different platforms more easily in the VirtualizedList package.

@gabrieldonadel gabrieldonadel force-pushed the feat/add-virtualized-lists-package branch 2 times, most recently from 1f3dec5 to d689da0 Compare November 22, 2022 04:36
@pull-bot
Copy link

PR build artifact for d689da0 is ready.
To use, download tarball from "Artifacts" tab in this CircleCI job then run yarn add <path to tarball> in your React Native project.

@pull-bot
Copy link

PR build artifact for 518cf03 is ready.
To use, download tarball from "Artifacts" tab in this CircleCI job then run yarn add <path to tarball> in your React Native project.

Libraries/Lists/FlatList.js.flow Outdated Show resolved Hide resolved
package.json Outdated Show resolved Hide resolved
packages/rn-tester/package.json Outdated Show resolved Hide resolved
types/__typetests__/index.tsx Outdated Show resolved Hide resolved
types/public/DeprecatedPropertiesAlias.d.ts Outdated Show resolved Hide resolved
yarn.lock Outdated Show resolved Hide resolved
@gabrieldonadel gabrieldonadel force-pushed the feat/add-virtualized-lists-package branch from dd308f1 to 536e6a0 Compare January 19, 2023 13:24
@gabrieldonadel
Copy link
Collaborator Author

@NickGerleman any updates on this? I know that this impacts a bunch of internal Meta code that references old VirtualizedList paths, but I was wondering, is there something I can help with?

@NickGerleman
Copy link
Contributor

I haven't been able to dedicate much time to pushing this internally.

I spent a day a while back trying to find everywhere the previous structure was relied on, and I don't think we could safely ship the refactoring without staging it a bit more. Like, leaving old files around which forward to the new ones, so we can change product code more piecemeal.

It looked like a weekish of work dedicated to internal cleanup. Because it's all Meta code, we will need someone on our side to do the work, and figure out how to stage.

@hoxyq has worked through some similar headaches with lean core modules, and also has been looking at monorepo work. Might have a take on if there is a way we could stage this, where we could move to this structure in OSS without ripping up too much code out there.

@hoxyq
Copy link
Contributor

hoxyq commented Jan 26, 2023

I haven't been able to dedicate much time to pushing this internally.

I spent a day a while back trying to find everywhere the previous structure was relied on, and I don't think we could safely ship the refactoring without staging it a bit more. Like, leaving old files around which forward to the new ones, so we can change product code more piecemeal.

It looked like a weekish of work dedicated to internal cleanup. Because it's all Meta code, we will need someone on our side to do the work, and figure out how to stage.

@hoxyq has worked through some similar headaches with lean core modules, and also has been looking at monorepo work. Might have a take on if there is a way we could stage this, where we could move to this structure in OSS without ripping up too much code out there.

Will take a look at it next week

@facebook-github-bot
Copy link
Contributor

@hoxyq has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

@necolas
Copy link
Contributor

necolas commented Jan 26, 2023

Like, leaving old files around which forward to the new ones, so we can change product code more piecemeal.

Isn't this what the PR does now? Maybe I missed something?

@gabrieldonadel
Copy link
Collaborator Author

Like, leaving old files around which forward to the new ones, so we can change product code more piecemeal.

Isn't this what the PR does now? Maybe I missed something?

I think the problem is that there are internal projects importing from specific internal paths like react-native/packages/virtualized-lists/Lists/CellRenderMask.js.

@NickGerleman
Copy link
Contributor

Yeah, amazingly enough, there were even multiple cases of product code including the VirtualizedList utils helper to get a clamp() function for their own code lol.

I remember @lunaleaps was looking at what it would take to enforce the public boundaries more.

hoxyq pushed a commit to hoxyq/react-native that referenced this pull request Feb 1, 2023
…book#35406)

Summary:
This PR moves `VirtualizedList`, `VirtualizedSectionList`, and its files to a separate package called `react-native/virtualized-lists` located under `packages/virtualized-lists` as proposed on facebook#35263

## Changelog

[General] [Changed] - Move virtualized lists to react-native/virtualized-lists package

Pull Request resolved: facebook#35406

Test Plan:
1. Open the RNTester app and navigate to `FlatList` or `SectionList` page
2. Test virtualized lists through the many sections

https://user-images.githubusercontent.com/11707729/202878843-2b1322f5-cfee-484e-aaf3-d8d4dc0b96cc.mov

Differential Revision: D41745930

Pulled By: hoxyq

fbshipit-source-id: 67a971a3f06895bce360a7463c66a6b1f334f46b
@hoxyq
Copy link
Contributor

hoxyq commented Feb 3, 2023

@gabrieldonadel

So I've made some changes both internally and in frames of this PR (exported in #36035), this is now accepted by @NickGerleman

Planning to merge this PR early next week 🤞

Meanwhile you can grep the difference between this PR and #36035 to check if everything is expected

There should be not that much, mostly re-exporting something, most of the work was made on the internal side

@gabrieldonadel
Copy link
Collaborator Author

Thanks for awesome work @hoxyq! Should I cherry-pick your commit to this PR?

@hoxyq
Copy link
Contributor

hoxyq commented Feb 5, 2023

Thanks for awesome work @hoxyq! Should I cherry-pick your commit to this PR?

No, this will be automatically resolved when I will merge internal changes, your commit will be merged in main branch together with mine and this PR will be closed and marked as merged

@facebook-github-bot facebook-github-bot added the Merged This PR has been merged. label Feb 6, 2023
@facebook-github-bot
Copy link
Contributor

@hoxyq merged this pull request in 2e3dbe9.

@gabrieldonadel gabrieldonadel deleted the feat/add-virtualized-lists-package branch February 6, 2023 21:45
OlimpiaZurek pushed a commit to OlimpiaZurek/react-native that referenced this pull request May 22, 2023
…book#35406)

Summary:
This PR moves `VirtualizedList`, `VirtualizedSectionList`, and its files to a separate package called `react-native/virtualized-lists` located under `packages/virtualized-lists` as proposed on facebook#35263

## Changelog

[General] [Changed] - Move virtualized lists to react-native/virtualized-lists package

Pull Request resolved: facebook#35406

Test Plan:
1. Open the RNTester app and navigate to `FlatList` or `SectionList` page
2. Test virtualized lists through the many sections

https://user-images.githubusercontent.com/11707729/202878843-2b1322f5-cfee-484e-aaf3-d8d4dc0b96cc.mov

Reviewed By: cipolleschi

Differential Revision: D41745930

Pulled By: hoxyq

fbshipit-source-id: d3d33896801fd69448c6893b86fd5c2363144fd0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Merged This PR has been merged. Tech: Monorepo For PRs that are related to the monorepo infra
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants