Skip to main content

Overlay

Cover the parent layout with custom content. Overlay stays inside the existing window.

Overlay in a native Kindle example

Usage​

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

import React, {useState} from 'react';
import {Button, Overlay, Text, View} from 'react-kindle';

export default function App() {
const [visible, setVisible] = useState(false);

return (
<View style={{flex: 1, padding: 24}}>
<Button onPress={() => setVisible(true)}>Show message</Button>
<Overlay visible={visible} style={{backgroundColor: '#FFFFFF', padding: 32}}>
<Text variant="title">Saved</Text>
<Text>Your reading list is up to date.</Text>
<Button onPress={() => setVisible(false)}>Close</Button>
</Overlay>
</View>
);
}

Props​

PropType / defaultDescription
visibleboolean = trueWhether the overlay is mounted.
childrenReact nodesOverlay content.
styleView styleDefaults to absolute positioning covering the parent.

Use Dialog or BottomSheet when you need a separate native modal window.