MCPcopy Create free account
hub / github.com/callstack/react-native-paper / AppbarContent

Function AppbarContent

src/components/Appbar/AppbarContent.tsx:103–213  ·  view source on GitHub ↗
({
  color: titleColor,
  subtitle,
  subtitleStyle,
  onPress,
  disabled,
  style,
  titleRef,
  titleStyle,
  title,
  titleMaxFontSizeMultiplier,
  mode = 'small',
  theme: themeOverrides,
  testID = 'appbar-content',
  ...rest
}: Props)

Source from the content-addressed store, hash-verified

101 * ```
102 */
103const AppbarContent = ({
104 color: titleColor,
105 subtitle,
106 subtitleStyle,
107 onPress,
108 disabled,
109 style,
110 titleRef,
111 titleStyle,
112 title,
113 titleMaxFontSizeMultiplier,
114 mode = 'small',
115 theme: themeOverrides,
116 testID = 'appbar-content',
117 ...rest
118}: Props) => {
119 const theme = useInternalTheme(themeOverrides);
120 const { isV3, colors } = theme;
121
122 const titleTextColor = titleColor
123 ? titleColor
124 : isV3
125 ? colors.onSurface
126 : white;
127
128 const subtitleColor = color(titleTextColor).alpha(0.7).rgb().string();
129
130 const modeContainerStyles = {
131 small: styles.v3DefaultContainer,
132 medium: styles.v3MediumContainer,
133 large: styles.v3LargeContainer,
134 'center-aligned': styles.v3DefaultContainer,
135 };
136
137 const variant = modeTextVariant[mode] as MD3TypescaleKey;
138
139 const contentWrapperProps = {
140 pointerEvents: 'box-none' as ViewProps['pointerEvents'],
141 style: [styles.container, isV3 && modeContainerStyles[mode], style],
142 testID,
143 ...rest,
144 };
145
146 const content = (
147 <>
148 {typeof title === 'string' ? (
149 <Text
150 {...(isV3 && { variant })}
151 ref={titleRef}
152 style={[
153 {
154 color: titleTextColor,
155 ...(isV3
156 ? theme.fonts[variant]
157 : Platform.OS === 'ios'
158 ? theme.fonts.regular
159 : theme.fonts.medium),
160 },

Callers

nothing calls this directly

Calls 1

useInternalThemeFunction · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…