-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
[NoQA] Fix Virtualised List Error #49487
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
ccf67c5
intial commit
allgandalf 7ba7c8f
fix virtualized list error
allgandalf af61f7a
fix lint
allgandalf 0340056
add documentation
allgandalf c33c2df
Update STYLE.md
allgandalf 32a3219
Update contributingGuides/STYLE.md
allgandalf a4bce66
Update contributingGuides/STYLE.md
allgandalf e841297
add suggestion
allgandalf 98e60bb
Apply suggestions from code review
allgandalf File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -50,6 +50,9 @@ | |
- [Stateless components vs Pure Components vs Class based components vs Render Props](#stateless-components-vs-pure-components-vs-class-based-components-vs-render-props---when-to-use-what) | ||
- [Use Refs Appropriately](#use-refs-appropriately) | ||
- [Are we allowed to use [insert brand new React feature]?](#are-we-allowed-to-use-insert-brand-new-react-feature-why-or-why-not) | ||
- [Handling Scroll Issues with Nested Lists in React Native](#handling-scroll-issues-with-nested-lists-in-react-native) | ||
- [Wrong Approach (Using SelectionList)](#wrong-approach-using-selectionlist) | ||
- [Correct Approach (Using SelectionList)](#correct-approach-using-selectionlist) | ||
- [React Hooks: Frequently Asked Questions](#react-hooks-frequently-asked-questions) | ||
- [Onyx Best Practices](#onyx-best-practices) | ||
- [Collection Keys](#collection-keys) | ||
|
@@ -1105,6 +1108,48 @@ There are several ways to use and declare refs and we prefer the [callback metho | |
|
||
We love React and learning about all the new features that are regularly being added to the API. However, we try to keep our organization's usage of React limited to the most stable set of features that React offers. We do this mainly for **consistency** and so our engineers don't have to spend extra time trying to figure out how everything is working. That said, if you aren't sure if we have adopted something, please ask us first. | ||
|
||
|
||
## Handling Scroll Issues with Nested Lists in React Native | ||
|
||
### Problem | ||
|
||
When using `SelectionList` alongside other components (e.g., `Text`, `Button`), wrapping them inside a `ScrollView` can lead to alignment and performance issues. Additionally, using `ScrollView` with nested `FlatList` or `SectionList` causes the error: | ||
|
||
> "VirtualizedLists should never be nested inside plain ScrollViews with the same orientation." | ||
|
||
### Solution | ||
|
||
The correct approach is avoid using `ScrollView`. You can add props like `listHeaderComponent` and `listFooterComponent` to add other components before or after the list while keeping the layout scrollable. | ||
|
||
### Wrong Approach (Using `SelectionList`) | ||
|
||
```jsx | ||
<ScrollView> | ||
<Text>Header Content</Text> | ||
<SelectionList | ||
sections={[{data}]} | ||
ListItem={RadioListItem} | ||
onSelectRow={handleSelect} | ||
/> | ||
<Button title="Submit" onPress={handleSubmit} /> | ||
</ScrollView> | ||
``` | ||
|
||
### Correct Approach (Using `SelectionList`) | ||
|
||
```jsx | ||
<SelectionList | ||
sections={[{item}]} | ||
ListItem={RadioListItem} | ||
onSelectRow={handleSelect} | ||
listHeaderComponent={<Text>Header Content</Text>} | ||
listFooterComponent={<Button title="Submit" onPress={handleSubmit} />} | ||
/> | ||
``` | ||
|
||
This ensures optimal performance and avoids layout issues. | ||
|
||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The docs looks like the below @mountiny ![]() |
||
## React Hooks: Frequently Asked Questions | ||
|
||
### Are Hooks a Replacement for HOCs or Render Props? | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.