Pro component
Requires all-access to use the source code
Wrap the _layout.tsx
in <KeyboardProvider>
with the 2 boolean props of statusBarTranslucent and navigationBarTranslucent
import * as React from 'react';
import { Pressable, ScrollView, View } from 'react-native';
import { KeyboardAvoidingView } from 'react-native-keyboard-controller';
import Animated, { FadeIn, ZoomOut } from 'react-native-reanimated';
import { useColorScheme } from '@/lib/useColorScheme';
import { Button } from '@/components/nativewindui/Button';
import { Icon } from '@/components/nativewindui/Icon';
import { Text } from '@/components/nativewindui/Text';
import { LargeTitleHeader } from '@/components/nativewindui/LargeTitleHeader';
import type { LargeTitleSearchBarMethods } from '@/components/nativewindui/LargeTitleHeader/types';
export default function Screen() {
const { colors } = useColorScheme();
const searchBarRef = React.useRef<LargeTitleSearchBarMethods>(null);
function onTryNewSearch() {
searchBarRef.current?.focus();
}
return (
<>
<LargeTitleHeader
title="Large title"
iosBackButtonTitle="Back"
searchBar={{
ref: searchBarRef,
onChangeText: (text) => {
console.log(text);
},
materialRightView() {
return (
<Animated.View entering={FadeIn} exiting={ZoomOut}>
<Button variant="plain" size="icon">
<Icon name="gearshape" color={colors.foreground} />
</Button>
</Animated.View>
);
},
content: (
<KeyboardAvoidingView
behavior="padding"
className="ios:bg-background flex-1 items-center justify-center gap-0.5 p-4">
<Text variant="title1" className="font-bold">
Type anything
</Text>
<View className="flex-row items-center">
<Text variant="callout" className="text-muted-foreground text-center">
This is a demo of the LargeTitleHeader component.
</Text>
</View>
</KeyboardAvoidingView>
),
}}
/>
<ScrollView contentContainerClassName="flex-1 items-center justify-center">
<Text variant="title1" className="font-bold">
No Results
</Text>
<View className="flex-row flex-wrap items-center">
<Text variant="callout" className="text-muted-foreground text-center">
There were no results.{' '}
</Text>
<Pressable onPress={onTryNewSearch}>
<Text variant="callout" className="text-muted-foreground text-center">
Try a new search.
</Text>
</Pressable>
</View>
</ScrollView>
</>
);
}
Unlock All Pro Templates & Components
Elevate your app with powerful, native-feeling components and templates. Build faster with beautiful ready-to-use designs.
The Large Title Header can only be used with screens that are part of a Stack Navigator.
If your screen is part of a different type of navigation (like a Tab or Drawer Navigator), you’ll need to place that screen inside a Stack Navigator to use the Large Title Header.
For help on how to nest navigators, check out Expo's documentation.
import { LargeTitleHeader } from '@/components/nativewindui/LargeTitleHeader';
<LargeTitleHeader title="Large title" />
LargeTitleHeader
Prop | Type | Description |
---|---|---|
iosBackButtonMenuEnabled | boolean | Enables or disables the iOS back button menu. |
iosBackButtonTitle | string | Title for the iOS back button. |
iosBackButtonTitleVisible | boolean | Determines if the iOS back button title is visible. |
iosBlurEffect | HeaderOptions["headerBlurEffect"] | "none" | The blur effect for the iOS header. Default is "systemMaterial". |
materialPreset | 'stack' | 'inline' | Material design preset for the header layout. |
materialTitleClassName | string | Class name for styling the Android title. |
backVisible | boolean | Determines if the back button is visible. |
shadowVisible | boolean | Controls the visibility of the shadow. For iOS, iosBlurEffect must be "none". |
leftView | HeaderOptions["headerLeft"] | Custom component for the left side of the header. |
rightView | HeaderOptions["headerRight"] | Custom component for the right side of the header. |
shown | boolean | Controls the visibility of the header. |
title | string | Title text for the header. |
backgroundColor | string | Background color for the header. |
screen | ScreenOptions | Options for screen navigation and presentation. |
searchBar | object | Options and configuration for the search bar within the header. |
searchBar.iosCancelButtonText | string | Text for the iOS search bar cancel button. |
searchBar.iosHideWhenScrolling | boolean | Hides the search bar when scrolling on iOS. |
searchBar.iosTintColor | string | Tint color for the iOS search bar. |
searchBar.materialRightView | HeaderOptions["headerRight"] | Custom component for the right side of the Android search bar. |
searchBar.materialBlurOnSubmit | boolean | Blurs the search bar when submitting input on Android. |
searchBar.materialOnSubmitEditing | ((e: NativeSyntheticEvent<TextInputSubmitEditingEventData>) => void) | undefined | Callback function triggered when submitting input. |
searchBar.autoCapitalize | NativeStackNavigationSearchBarOptions["autoCapitalize"] | Configures the auto-capitalization behavior. |
searchBar.inputType | NativeStackNavigationSearchBarOptions["inputType"] | Defines the input type for the search bar. |
searchBar.onBlur | () => void | Callback function triggered when the search bar loses focus. |
searchBar.onCancelButtonPress | () => void | Callback function triggered when the cancel button is pressed. |
searchBar.onChangeText | (text: string) => void | Callback function triggered when the text in the search bar changes. |
searchBar.onFocus | () => void | Callback function triggered when the search bar gains focus. |
searchBar.onSearchButtonPress | () => void | Callback function triggered when the search button is pressed. |
searchBar.placeholder | string | Placeholder text for the search bar. |
searchBar.ref | React.RefObject<LargeTitleSearchBarRef> | Reference to the search bar commands. |
searchBar.textColor | string | Text color for the search bar input. |
searchBar.content | React.ReactNode | Custom content to display within the search bar. |