Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
accessibilityLabel,
testID,
onPress,
onLongPress,
horizontal,
activeTintColor: customActiveTintColor,
inactiveTintColor: customInactiveTintColor,
activeBackgroundColor = 'transparent',
inactiveBackgroundColor = 'transparent',
showLabel = true,
showIcon = true,
allowFontScaling,
labelStyle,
style,
}: Props) {
const { colors } = useTheme();
const activeTintColor =
customActiveTintColor === undefined
? colors.primary
: customActiveTintColor;
const inactiveTintColor =
customInactiveTintColor === undefined
? Color(colors.text)
.mix(Color(colors.card), 0.5)
.hex()
: customInactiveTintColor;
const renderLabel = ({ focused }: { focused: boolean }) => {
if (showLabel === false) {
return null;
} else {
onPageChangeCancel?.();
}
onTransitionStart?.({ route: scene.route }, closing);
closing && onGoBack({ route: scene.route });
};
const insets = {
top: safeAreaInsetTop,
right: safeAreaInsetRight,
bottom: safeAreaInsetBottom,
left: safeAreaInsetLeft,
};
const { colors } = useTheme();
return (
drawerContentOptions,
drawerStyle,
edgeWidth,
gestureHandlerProps,
minSwipeDistance,
sceneContainerStyle,
unmountInactiveScreens,
}: Props) {
const [loaded, setLoaded] = React.useState([state.index]);
const [drawerWidth, setDrawerWidth] = React.useState(() =>
getDefaultDrawerWidth(Dimensions.get('window'))
);
const drawerGestureRef = React.useRef(null);
const { colors } = useTheme();
React.useEffect(() => {
const updateWidth = ({ window }: { window: ScaledSize }) => {
setDrawerWidth(getDefaultDrawerWidth(window));
};
Dimensions.addEventListener('change', updateWidth);
return () => Dimensions.removeEventListener('change', updateWidth);
}, []);
if (!loaded.includes(state.index)) {
setLoaded([...loaded, state.index]);
}
const handleDrawerOpen = () => {
export default function DrawerItem(props: Props) {
const { colors } = useTheme();
const {
icon,
label,
labelStyle,
focused = false,
activeTintColor = colors.primary,
inactiveTintColor = Color(colors.text)
.alpha(0.68)
.rgb()
.string(),
activeBackgroundColor = Color(activeTintColor)
.alpha(0.12)
.rgb()
.string(),
inactiveBackgroundColor = 'transparent',
export default function MaterialBottomTabView({
state,
navigation,
descriptors,
...rest
}: Props) {
const { dark, colors } = useTheme();
const theme = React.useMemo(() => {
const t = dark ? DarkTheme : DefaultTheme;
return {
...t,
colors: {
...t.colors,
...colors,
surface: colors.card,
},
};
}, [colors, dark]);
return (
export default function HeaderConfig(props: Props) {
const { colors } = useTheme();
const {
route,
title,
headerRight,
headerTitle,
headerBackTitle,
headerBackTitleVisible = true,
headerHideBackButton,
headerHideShadow,
headerTintColor,
headerLargeTitle,
headerTranslucent,
headerStyle = {},
headerTitleStyle = {},
headerLargeTitleStyle = {},
headerBackTitleStyle = {},
function SceneContent({
isFocused,
children,
}: {
isFocused: boolean;
children: React.ReactNode;
}) {
const { colors } = useTheme();
return (
);
}
export default function Article({
date = '1st Jan 2025',
author = {
name: 'Knowledge Bot',
},
}: Props) {
const ref = React.useRef(null);
useScrollToTop(ref);
const { colors } = useTheme();
return (
export default function HeaderTitle({ tintColor, style, ...rest }: Props) {
const { colors } = useTheme();
return (
);
}
export default function HeaderBackButton({
disabled,
allowFontScaling,
backImage,
label,
labelStyle,
labelVisible = Platform.OS === 'ios',
onLabelLayout,
onPress,
pressColorAndroid: customPressColorAndroid,
screenLayout,
tintColor: customTintColor,
titleLayout,
truncatedLabel = 'Back',
}: Props) {
const { dark, colors } = useTheme();
const [initialLabelWidth, setInitialLabelWidth] = React.useState<
undefined | number
>(undefined);
const tintColor =
customTintColor !== undefined
? customTintColor
: Platform.select({
ios: colors.primary,
default: colors.text,
});
const pressColorAndroid =
customPressColorAndroid !== undefined
? customPressColorAndroid