View
Group native views and arrange their children with the layout engine.
App.tsx
<View layout={{ flexDirection: 'row',}}> <Book title="Coast" /> <Book title="Meadow" /></View>Bookshelf
CoastMeadow
Use layout for size, spacing, and alignment. Use style for paint properties such as background, borderColor, and cornerRadius. A container can draw a solid color or a linear gradient behind its children.
import { Text, View } from 'react-nitro-renderer'
export function NoteCard() {
return (
<View layout={{ padding: 16 }} style={{ background: 0xf3f1e8ff, cornerRadius: 8 }}>
<Text>River walk</Text>
</View>
)
}Pass gestureRecognizers to attach touch handlers. The ref exposes the native container as ViewRef. Layout and safe areas · Gestures · Animations
Draw a gradient
Set a container's style.background to a linear gradient. The endpoints use fractions of the view's width and height, so the fill follows the view when it resizes.
import { View } from 'react-nitro-renderer'
export function SkySwatch() {
return (
<View
layout={{ height: 80 }}
style={{
cornerRadius: 12,
background: {
type: 'linear-gradient',
colors: [0x273c5aff, 0xf0b77aff],
start: { x: 0, y: 0 },
end: { x: 1, y: 1 },
},
}}
/>
)
}Supply at least two colors. For uneven spacing, pass one locations value per color, in ascending order between zero and one.