1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

【React Native】ScrollViewで下部に余白を追加し、余分にスクロールできるようにする方法

Last updated at Posted at 2025-08-05

実現したいこと

react-nativeのScrollViewで、最下部までスクロールした際、少し余分にスクロールできるようにしたい

解決策

ScrollViewのPropsである contentContainerStyle に、paddingBottom を設定することで、ビューの最下部に余白を配置する

<ScrollView style={styles.hoge} contentContainerStyle={{ paddingBottom: 100 }}>

実装例

import { ScrollView, StyleSheet } from 'react-native';

export default function HogeScreen() {
    return(
        {/* 以下のcontentContainerStyleで、paddingBottomを適用する */}
        <ScrollView style={styles.scrollContainer} contentContainerStyle={{ paddingBottom: 100 }}>
            {/* ここにFlatListとかが入る*/}
        </ScrollView>
    );
}

const styles = StyleSheet.create({
    scrollContainer: {
        flex: 1,
    },
});

メモ

contentContainerStyle に適用する必要があるというのがポイント
style に適用してもうまくいかない)

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?