Skip to main content

Layout

ThemedView​

View with className support and an optional safe-area wrapper.

npx midestic-rn-library add themed-view
<ThemedView safe className="flex-1 justify-center px-[24px]">
{children}
</ThemedView>
PropTypeDefaultDescription
safebooleanfalseApply safe-area padding (top + bottom)
classNamestring""Extra classes

ThemedText / ThemedTitle / MyText​

Text primitives that read the theme colours.

Add the text primitive you need:

npx midestic-rn-library add themed-text
npx midestic-rn-library add themed-title
npx midestic-rn-library add my-text
<ThemedTitle>Page title</ThemedTitle>
<ThemedText className="text-text-light">Supporting copy</ThemedText>
<MyText className="font-[600]">Emphasised label</MyText>
ComponentExtendsExtra props
ThemedTextTextPropsclassName
ThemedTitleTextPropsclassName
MyTextTextPropsclassName, required children

ThemedScrollView​

Scroll container with optional safe areas and pull to refresh.

npx midestic-rn-library add themed-scrollview
<ThemedScrollView
safeTop
refreshing={refreshing}
onRefresh={async () => {
await reload();
}}
className="flex-1"
contentContainerClassName="gap-[12px] p-[16px]"
>
{rows}
</ThemedScrollView>
PropTypeDescription
safe / safeTop / safeBottombooleanSafe-area padding on the container
refreshingbooleanControlled pull-to-refresh spinner
onRefresh() => Promise<unknown> | voidCalled on pull to refresh
classNamestringClasses on the scroll view
contentContainerClassNamestringClasses on the content container

SafeTopView​

View padded by the top safe-area inset.

npx midestic-rn-library add safe-top-view
<SafeTopView className="flex-1 bg-background-light">
<HeaderBack title="Trip details" onBackPress={navigation.goBack} />
</SafeTopView>

HeaderBack​

Top bar with a back arrow and centered title.

npx midestic-rn-library add header-back
<HeaderBack title="Trip details" onBackPress={() => navigation.goBack()} className="h-[56px]" />
PropTypeDescription
titlestringCentered header text
onBackPress() => voidCalled when the arrow is pressed
classNamestringExtra classes