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

Simplified Sidebar #1

Open
wants to merge 2 commits into
base: new-intro
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions docs/using-a-listview.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ title: Using List Views

React Native provides a suite of components for presenting lists of data. Generally, you'll want to use either [FlatList](flatlist.md) or [SectionList](sectionlist.md).

### FlatList

The `FlatList` component displays a scrolling list of changing, but similarly structured, data. `FlatList` works well for long lists of data, where the number of items might change over time. Unlike the more generic [`ScrollView`](using-a-scrollview.md), the `FlatList` only renders elements that are currently showing on the screen, not all the elements at once.

The `FlatList` component requires two props: `data` and `renderItem`. `data` is the source of information for the list. `renderItem` takes one item from the source and returns a formatted component to render.
Expand Down Expand Up @@ -52,6 +54,8 @@ const styles = StyleSheet.create({
})
```

### SectionList

If you want to render a set of data broken into logical sections, maybe with section headers, similar to `UITableView`s on iOS, then a [SectionList](sectionlist.md) is the way to go.

```SnackPlayer name=SectionList%20Basics
Expand Down
8 changes: 1 addition & 7 deletions website/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -3501,20 +3501,14 @@
},
"categories": {
"The Basics": "The Basics",
"Guides": "Guides",
"Environment setup": "Environment setup",
"Workflow": "Workflow",
"Design": "Design",
"Interaction": "Interaction",
"Inclusion": "Inclusion",
"Performance": "Performance",
"JavaScript Runtime": "JavaScript Runtime",
"Connectivity": "Connectivity",
"Native Components and Modules": "Native Components and Modules",
"Guides (iOS)": "Guides (iOS)",
"Guides (Android)": "Guides (Android)",
"Components": "Components",
"APIs": "APIs",
"Guides": "Guides",
"Contributing": "Contributing"
}
},
Expand Down
45 changes: 32 additions & 13 deletions website/sidebars.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,42 @@
"handling-text-input",
"using-a-scrollview",
"using-a-listview",
"troubleshooting",
"platform-specific-code",
"network",
"more-resources"
],
"Guides": [
{
"type": "subcategory",
"label": "Design",
"ids": ["style", "height-and-width", "flexbox", "images", "colors"]
},
{
"type": "subcategory",
"label": "Interaction",
"ids": [
"handling-touches",
"navigation",
"animations",
"gesture-responder-system"
]
},
{
"type": "subcategory",
"label": "Inclusion",
"ids": ["accessibility"]
},
{
"type": "subcategory",
"label": "Performance",
"ids": ["performance", "hermes", "optimizing-flatlist-configuration"]
},
"timers",
"javascript-environment",
"platform-specific-code"
],
"Environment setup": [
"getting-started",
"troubleshooting",
"integration-with-existing-apps",
"building-for-apple-tv",
"out-of-tree-platforms"
Expand All @@ -24,17 +54,6 @@
"typescript",
"upgrading"
],
"Design": ["style", "height-and-width", "flexbox", "images", "colors"],
"Interaction": [
"handling-touches",
"navigation",
"animations",
"gesture-responder-system"
],
"Inclusion": ["accessibility"],
"Performance": ["performance", "optimizing-flatlist-configuration"],
"JavaScript Runtime": ["javascript-environment", "timers", "hermes"],
"Connectivity": ["network"],
"Native Components and Modules": [
"native-modules-setup",
"direct-manipulation"
Expand Down
37 changes: 37 additions & 0 deletions website/static/css/toc.css
Original file line number Diff line number Diff line change
Expand Up @@ -99,3 +99,40 @@
padding-top: 2rem;
}
}

/** SubNavGroup **/
.toc .toggleNav ul .subNavGroup .navItem {
padding-left: 16px;
}

.toc .toggleNav .navGroup .subNavGroup .navListItem::before {
content: "";
position: absolute;
left: 2px;
top: 0px;
bottom: 0px;
border-left: 1px solid rgba(0, 0, 0, 0.1);
}

.toc .toggleNav .navGroup .subNavGroup .navGroupSubcategoryTitle {
font-weight: 600;
}

.toc .toggleNav ul .subNavGroup li.navListItemActive::before {
content: "";
background-color: inherit;
position: absolute;
width: 5px;
top: 2px;
left: -20px;
bottom: 2px;
}

.toc .toggleNav ul .subNavGroup li.navListItemActive::after {
content: "";
background-color: $brand;
position: absolute;
width: 5px;
top: 2px;
bottom: 2px;
}