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 { Icon } from '@roninoss/icons';
import * as React from 'react';
import { Platform, View } from 'react-native';
import { KeyboardAwareScrollView } from 'react-native-keyboard-controller';
import Animated, { FadeIn, LinearTransition, ZoomOut } from 'react-native-reanimated';
import { Button } from '../~/components/nativewindui/Button';
import { LargeTitleHeader } from '~/components/nativewindui/LargeTitleHeader';
import { LargeTitleSearchBarRef } from '~/components/nativewindui/LargeTitleHeader/types';
import { Text } from '~/components/nativewindui/Text';
import { useColorScheme } from '~/lib/useColorScheme';
export default function LargeTitleHeaderScreen() {
const { colors } = useColorScheme();
const searchBarRef = React.useRef<LargeTitleSearchBarRef>(null);
const [materialPreset, setMaterialPreset] = React.useState<'stack' | 'inline'>('stack');
return (
<>
<LargeTitleHeader
title="Large title"
materialPreset={materialPreset}
rightView={() => (
<Button variant="plain" size="icon">
<Icon size={24} name="account-circle-outline" color={colors.foreground} />
</Button>
)}
searchBar={{
ref: searchBarRef,
onChangeText: (text) => {
console.log(text);
},
materialRightView() {
return (
<Animated.View entering={FadeIn} exiting={ZoomOut}>
<Button variant="plain" size="icon">
<Icon size={24} name="cog-outline" color={colors.foreground} />
</Button>
</Animated.View>
);
},
content: (
<KeyboardAwareScrollView
className="ios:bg-background/95"
contentContainerClassName="flex-1"
keyboardShouldPersistTaps="always">
<View className="flex-1 items-center justify-center">
<Text>Search bar content</Text>
</View>
</KeyboardAwareScrollView>
),
}}
/>
<Animated.ScrollView
layout={LinearTransition}
contentInsetAdjustmentBehavior="automatic"
contentContainerClassName="flex-1 py-10 px-4 gap-12">
<Button
onPress={() => {
searchBarRef.current?.focus();
}}>
<Text>Focus input</Text>
</Button>
{Platform.OS !== 'ios' && (
<Button
variant={materialPreset === 'inline' ? 'secondary' : 'tonal'}
onPress={() => {
setMaterialPreset((prev) => (prev === 'inline' ? 'stack' : 'inline'));
}}>
<Text>Switch to {materialPreset === 'inline' ? 'stack' : 'inline'}</Text>
</Button>
)}
</Animated.ScrollView>
</>
);
}
Unlock All Pro Screens & 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. |