Skip to content

Commit

Permalink
fix: Add ScrollView adjustment automatic (#43)
Browse files Browse the repository at this point in the history
  • Loading branch information
okwasniewski authored Oct 15, 2024
1 parent 1149e17 commit a9ffd37
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 1 deletion.
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,16 @@ export default function ThreeTabs() {
}
```

### ScrollView

If you expirence issues with ScrollView content being below the tab bar, add `contentInsetAdjustmentBehavior="automatic"` to the ScrollView component.


```tsx
<ScrollView contentInsetAdjustmentBehavior="automatic">
{/* content */}
</ScrollView>
```

## Contributing

Expand Down
6 changes: 5 additions & 1 deletion example/src/Screens/Albums.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,11 @@ export function Albums(props: Partial<ScrollViewProps>) {
const itemSize = dimensions.width / Math.floor(dimensions.width / 150);

return (
<ScrollView contentContainerStyle={styles.content} {...props}>
<ScrollView
contentContainerStyle={styles.content}
contentInsetAdjustmentBehavior="automatic"
{...props}
>
{COVERS.map((source, i) => (
<View
key={i}
Expand Down
1 change: 1 addition & 0 deletions example/src/Screens/Article.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ export function Article({
ref={ref}
style={{ backgroundColor: '#fff' }}

Check warning on line 54 in example/src/Screens/Article.tsx

View workflow job for this annotation

GitHub Actions / lint

Inline style: { backgroundColor: '#fff' }
contentContainerStyle={styles.content}
contentInsetAdjustmentBehavior="automatic"
{...rest}
>
<View style={styles.author}>
Expand Down
1 change: 1 addition & 0 deletions example/src/Screens/Chat.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ export function Chat({
style={styles.container}
>
<ScrollView
contentInsetAdjustmentBehavior="automatic"
style={styles.inverted}
contentContainerStyle={styles.content}
{...rest}
Expand Down
1 change: 1 addition & 0 deletions example/src/Screens/Contacts.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ export function Contacts({ query, ...rest }: Props) {
return (
<SafeAreaView>
<FlatList
contentInsetAdjustmentBehavior="automatic"
{...rest}
data={
query
Expand Down

0 comments on commit a9ffd37

Please sign in to comment.