Skip to main content

ScrollView

Show content that is taller or wider than its viewport. Paginated mode provides native page movement.

ScrollView in a native Kindle example

Usage​

Save this example as apps/Reader/App.js in the starter app.

import React from 'react';
import {ScrollView, Text, View} from 'react-kindle';

export default function App() {
return (
<View style={{flex: 1, padding: 24}}>
<ScrollView mode="paginated" offset={0} style={{height: 480}}
contentContainerStyle={{padding: 16}}>
{Array.from({length: 20}, (_, index) => (
<Text key={index} style={{height: 64}}>Book {index + 1}</Text>
))}
</ScrollView>
</View>
);
}

Props​

PropType / defaultDescription
modepaginated (default) / controlledNative scrolling mode.
horizontalboolean = falseScroll direction.
styleView styleViewport dimensions.
contentContainerStyleView styleInner content layout.
onForward / onBackward() => voidDirectional scroll or page-key callbacks.
onScrollfunctionNative scroll event.
onKeyPressfunctionNative key event.
onMomentumScrollBeginfunctionOverrides the default directional handler.
refscrollTo(options)Programmatic scrolling in controlled mode.

Controlled scrolling​

Controlled scrolling with a separate scrollbar

Use mode="controlled" for a viewport controlled by your app. A ref exposes scrollTo({x, y, animated}). Check useKindle().supports('controlledScroll.scrollTo') before using the command; the KT3 standalone launcher does not export it.

offset={0} in the paginated example starts at the beginning. Other native scroll props pass through to the selected host. ScrollBar is a separate control; it does not scroll this content automatically.

import React, {useRef} from 'react';
import {Button, ScrollView, Text, View, useKindle} from 'react-kindle';

export default function App() {
const scroll = useRef(null);
const {supports} = useKindle();
return (
<View style={{flex: 1, padding: 24}}>
<Button disabled={!supports('controlledScroll.scrollTo')}
onPress={() => scroll.current.scrollTo({x: 0, y: 0, animated: false})}>
Back to top
</Button>
<ScrollView ref={scroll} mode="controlled" style={{height: 480}}>
{Array.from({length: 20}, (_, index) => (
<Text key={index} style={{height: 64}}>Book {index + 1}</Text>
))}
</ScrollView>
</View>
);
}