first commit

This commit is contained in:
2026-03-10 16:18:05 +00:00
commit 11f9c069b5
31635 changed files with 3187747 additions and 0 deletions

View File

@@ -0,0 +1,22 @@
"use strict";
import { useTheme } from '@react-navigation/native';
import * as React from 'react';
import { Animated } from 'react-native';
import { jsx as _jsx } from "react/jsx-runtime";
export function Background({
style,
...rest
}) {
const {
colors
} = useTheme();
return /*#__PURE__*/_jsx(Animated.View, {
...rest,
style: [{
flex: 1,
backgroundColor: colors.background
}, style]
});
}
//# sourceMappingURL=Background.js.map

View File

@@ -0,0 +1 @@
{"version":3,"names":["useTheme","React","Animated","jsx","_jsx","Background","style","rest","colors","View","flex","backgroundColor","background"],"sourceRoot":"../../src","sources":["Background.tsx"],"mappings":";;AAAA,SAASA,QAAQ,QAAQ,0BAA0B;AACnD,OAAO,KAAKC,KAAK,MAAM,OAAO;AAC9B,SACEC,QAAQ,QAIH,cAAc;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAOtB,OAAO,SAASC,UAAUA,CAAC;EAAEC,KAAK;EAAE,GAAGC;AAAY,CAAC,EAAE;EACpD,MAAM;IAAEC;EAAO,CAAC,GAAGR,QAAQ,CAAC,CAAC;EAE7B,oBACEI,IAAA,CAACF,QAAQ,CAACO,IAAI;IAAA,GACRF,IAAI;IACRD,KAAK,EAAE,CAAC;MAAEI,IAAI,EAAE,CAAC;MAAEC,eAAe,EAAEH,MAAM,CAACI;IAAW,CAAC,EAAEN,KAAK;EAAE,CACjE,CAAC;AAEN","ignoreList":[]}

View File

@@ -0,0 +1,86 @@
"use strict";
import { useTheme } from '@react-navigation/native';
import Color from 'color';
import * as React from 'react';
import { Animated, Platform, StyleSheet } from 'react-native';
import { jsx as _jsx } from "react/jsx-runtime";
const useNativeDriver = Platform.OS !== 'web';
export function Badge({
children,
style,
visible = true,
size = 18,
...rest
}) {
const [opacity] = React.useState(() => new Animated.Value(visible ? 1 : 0));
const [rendered, setRendered] = React.useState(visible);
const {
colors,
fonts
} = useTheme();
React.useEffect(() => {
if (!rendered) {
return;
}
Animated.timing(opacity, {
toValue: visible ? 1 : 0,
duration: 150,
useNativeDriver
}).start(({
finished
}) => {
if (finished && !visible) {
setRendered(false);
}
});
return () => opacity.stopAnimation();
}, [opacity, rendered, visible]);
if (!rendered) {
if (visible) {
setRendered(true);
} else {
return null;
}
}
// @ts-expect-error: backgroundColor definitely exists
const {
backgroundColor = colors.notification,
...restStyle
} = StyleSheet.flatten(style) || {};
const textColor = Color(backgroundColor).isLight() ? 'black' : 'white';
const borderRadius = size / 2;
const fontSize = Math.floor(size * 3 / 4);
return /*#__PURE__*/_jsx(Animated.Text, {
numberOfLines: 1,
style: [{
transform: [{
scale: opacity.interpolate({
inputRange: [0, 1],
outputRange: [0.5, 1]
})
}],
color: textColor,
lineHeight: size - 1,
height: size,
minWidth: size,
opacity,
backgroundColor,
fontSize,
borderRadius,
borderCurve: 'continuous'
}, fonts.regular, styles.container, restStyle],
...rest,
children: children
});
}
const styles = StyleSheet.create({
container: {
alignSelf: 'flex-end',
textAlign: 'center',
paddingHorizontal: 4,
overflow: 'hidden'
}
});
//# sourceMappingURL=Badge.js.map

View File

@@ -0,0 +1 @@
{"version":3,"names":["useTheme","Color","React","Animated","Platform","StyleSheet","jsx","_jsx","useNativeDriver","OS","Badge","children","style","visible","size","rest","opacity","useState","Value","rendered","setRendered","colors","fonts","useEffect","timing","toValue","duration","start","finished","stopAnimation","backgroundColor","notification","restStyle","flatten","textColor","isLight","borderRadius","fontSize","Math","floor","Text","numberOfLines","transform","scale","interpolate","inputRange","outputRange","color","lineHeight","height","minWidth","borderCurve","regular","styles","container","create","alignSelf","textAlign","paddingHorizontal","overflow"],"sourceRoot":"../../src","sources":["Badge.tsx"],"mappings":";;AAAA,SAASA,QAAQ,QAAQ,0BAA0B;AACnD,OAAOC,KAAK,MAAM,OAAO;AACzB,OAAO,KAAKC,KAAK,MAAM,OAAO;AAC9B,SACEC,QAAQ,EACRC,QAAQ,EAERC,UAAU,QAGL,cAAc;AAAC,SAAAC,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AAC,GAC3D3B,UAAU,CAAC4B,OAAO,CAACrB,KAAK,CAAC,IAAI,CAAC,CAAC;EACjC,MAAMsB,SAAS,GAAGjC,KAAK,CAAC6B,eAAe,CAAC,CAACK,OAAO,CAAC,CAAC,GAAG,OAAO,GAAG,OAAO;EAEtE,MAAMC,YAAY,GAAGtB,IAAI,GAAG,CAAC;EAC7B,MAAMuB,QAAQ,GAAGC,IAAI,CAACC,KAAK,CAAEzB,IAAI,GAAG,CAAC,GAAI,CAAC,CAAC;EAE3C,oBACEP,IAAA,CAACJ,QAAQ,CAACqC,IAAI;IACZC,aAAa,EAAE,CAAE;IACjB7B,KAAK,EAAE,CACL;MACE8B,SAAS,EAAE,CACT;QACEC,KAAK,EAAE3B,OAAO,CAAC4B,WAAW,CAAC;UACzBC,UAAU,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;UAClBC,WAAW,EAAE,CAAC,GAAG,EAAE,CAAC;QACtB,CAAC;MACH,CAAC,CACF;MACDC,KAAK,EAAEb,SAAS;MAChBc,UAAU,EAAElC,IAAI,GAAG,CAAC;MACpBmC,MAAM,EAAEnC,IAAI;MACZoC,QAAQ,EAAEpC,IAAI;MACdE,OAAO;MACPc,eAAe;MACfO,QAAQ;MACRD,YAAY;MACZe,WAAW,EAAE;IACf,CAAC,EACD7B,KAAK,CAAC8B,OAAO,EACbC,MAAM,CAACC,SAAS,EAChBtB,SAAS,CACT;IAAA,GACEjB,IAAI;IAAAJ,QAAA,EAEPA;EAAQ,CACI,CAAC;AAEpB;AAEA,MAAM0C,MAAM,GAAGhD,UAAU,CAACkD,MAAM,CAAC;EAC/BD,SAAS,EAAE;IACTE,SAAS,EAAE,UAAU;IACrBC,SAAS,EAAE,QAAQ;IACnBC,iBAAiB,EAAE,CAAC;IACpBC,QAAQ,EAAE;EACZ;AACF,CAAC,CAAC","ignoreList":[]}

View File

@@ -0,0 +1,107 @@
"use strict";
import { useLinkProps, useTheme } from '@react-navigation/native';
import Color from 'color';
import * as React from 'react';
import { Platform, StyleSheet } from 'react-native';
import { PlatformPressable } from "./PlatformPressable.js";
import { Text } from "./Text.js";
import { jsx as _jsx } from "react/jsx-runtime";
const BUTTON_RADIUS = 40;
export function Button(props) {
if ('screen' in props || 'action' in props) {
// @ts-expect-error: This is already type-checked by the prop types
return /*#__PURE__*/_jsx(ButtonLink, {
...props
});
} else {
return /*#__PURE__*/_jsx(ButtonBase, {
...props
});
}
}
function ButtonLink({
screen,
params,
action,
href,
...rest
}) {
// @ts-expect-error: This is already type-checked by the prop types
const props = useLinkProps({
screen,
params,
action,
href
});
return /*#__PURE__*/_jsx(ButtonBase, {
...rest,
...props
});
}
function ButtonBase({
variant = 'tinted',
color: customColor,
android_ripple,
style,
children,
...rest
}) {
const {
colors,
fonts
} = useTheme();
const color = customColor ?? colors.primary;
let backgroundColor;
let textColor;
switch (variant) {
case 'plain':
backgroundColor = 'transparent';
textColor = color;
break;
case 'tinted':
backgroundColor = Color(color).fade(0.85).string();
textColor = color;
break;
case 'filled':
backgroundColor = color;
textColor = Color(color).isDark() ? 'white' : Color(color).darken(0.71).string();
break;
}
return /*#__PURE__*/_jsx(PlatformPressable, {
...rest,
android_ripple: {
radius: BUTTON_RADIUS,
color: Color(textColor).fade(0.85).string(),
...android_ripple
},
pressOpacity: Platform.OS === 'ios' ? undefined : 1,
hoverEffect: {
color: textColor
},
style: [{
backgroundColor
}, styles.button, style],
children: /*#__PURE__*/_jsx(Text, {
style: [{
color: textColor
}, fonts.regular, styles.text],
children: children
})
});
}
const styles = StyleSheet.create({
button: {
paddingHorizontal: 24,
paddingVertical: 10,
borderRadius: BUTTON_RADIUS,
borderCurve: 'continuous'
},
text: {
fontSize: 14,
lineHeight: 20,
letterSpacing: 0.1,
textAlign: 'center'
}
});
//# sourceMappingURL=Button.js.map

View File

@@ -0,0 +1 @@
{"version":3,"names":["useLinkProps","useTheme","Color","React","Platform","StyleSheet","PlatformPressable","Text","jsx","_jsx","BUTTON_RADIUS","Button","props","ButtonLink","ButtonBase","screen","params","action","href","rest","variant","color","customColor","android_ripple","style","children","colors","fonts","primary","backgroundColor","textColor","fade","string","isDark","darken","radius","pressOpacity","OS","undefined","hoverEffect","styles","button","regular","text","create","paddingHorizontal","paddingVertical","borderRadius","borderCurve","fontSize","lineHeight","letterSpacing","textAlign"],"sourceRoot":"../../src","sources":["Button.tsx"],"mappings":";;AAAA,SAEEA,YAAY,EACZC,QAAQ,QACH,0BAA0B;AACjC,OAAOC,KAAK,MAAM,OAAO;AACzB,OAAO,KAAKC,KAAK,MAAM,OAAO;AAC9B,SAASC,QAAQ,EAAEC,UAAU,QAAQ,cAAc;AAEnD,SACEC,iBAAiB,QAEZ,wBAAqB;AAC5B,SAASC,IAAI,QAAQ,WAAQ;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAW9B,MAAMC,aAAa,GAAG,EAAE;AAQxB,OAAO,SAASC,MAAMA,CACpBC,KAAmD,EACnD;EACA,IAAI,QAAQ,IAAIA,KAAK,IAAI,QAAQ,IAAIA,KAAK,EAAE;IAC1C;IACA,oBAAOH,IAAA,CAACI,UAAU;MAAA,GAAKD;IAAK,CAAG,CAAC;EAClC,CAAC,MAAM;IACL,oBAAOH,IAAA,CAACK,UAAU;MAAA,GAAKF;IAAK,CAAG,CAAC;EAClC;AACF;AAEA,SAASC,UAAUA,CAAkD;EACnEE,MAAM;EACNC,MAAM;EACNC,MAAM;EACNC,IAAI;EACJ,GAAGC;AACuB,CAAC,EAAE;EAC7B;EACA,MAAMP,KAAK,GAAGZ,YAAY,CAAC;IAAEe,MAAM;IAAEC,MAAM;IAAEC,MAAM;IAAEC;EAAK,CAAC,CAAC;EAE5D,oBAAOT,IAAA,CAACK,UAAU;IAAA,GAAKK,IAAI;IAAA,GAAMP;EAAK,CAAG,CAAC;AAC5C;AAEA,SAASE,UAAUA,CAAC;EAClBM,OAAO,GAAG,QAAQ;EAClBC,KAAK,EAAEC,WAAW;EAClBC,cAAc;EACdC,KAAK;EACLC,QAAQ;EACR,GAAGN;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EF,MAAM,CAACG,IAAI,CAAE;MAAAlB,QAAA,EAC7DA;IAAQ,CACL;EAAC,CACU,CAAC;AAExB;AAEA,MAAMe,MAAM,GAAGnC,UAAU,CAACuC,MAAM,CAAC;EAC/BH,MAAM,EAAE;IACNI,iBAAiB,EAAE,EAAE;IACrBC,eAAe,EAAE,EAAE;IACnBC,YAAY,EAAErC,aAAa;IAC3BsC,WAAW,EAAE;EACf,CAAC;EACDL,IAAI,EAAE;IACJM,QAAQ,EAAE,EAAE;IACZC,UAAU,EAAE,EAAE;IACdC,aAAa,EAAE,GAAG;IAClBC,SAAS,EAAE;EACb;AACF,CAAC,CAAC","ignoreList":[]}

View File

@@ -0,0 +1,363 @@
"use strict";
import { useNavigation, useTheme } from '@react-navigation/native';
import Color from 'color';
import * as React from 'react';
import { Animated, Platform, StyleSheet, View } from 'react-native';
import { useSafeAreaInsets } from 'react-native-safe-area-context';
import searchIcon from '../assets/search-icon.png';
import { useFrameSize } from "../useFrameSize.js";
import { getDefaultHeaderHeight } from "./getDefaultHeaderHeight.js";
import { HeaderBackButton } from "./HeaderBackButton.js";
import { HeaderBackground } from "./HeaderBackground.js";
import { HeaderButton } from "./HeaderButton.js";
import { HeaderIcon } from "./HeaderIcon.js";
import { HeaderSearchBar } from "./HeaderSearchBar.js";
import { HeaderShownContext } from "./HeaderShownContext.js";
import { HeaderTitle } from "./HeaderTitle.js";
// Width of the screen in split layout on portrait mode on iPad Mini
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
const IPAD_MINI_MEDIUM_WIDTH = 414;
const warnIfHeaderStylesDefined = styles => {
Object.keys(styles).forEach(styleProp => {
const value = styles[styleProp];
if (styleProp === 'position' && value === 'absolute') {
console.warn("position: 'absolute' is not supported on headerStyle. If you would like to render content under the header, use the 'headerTransparent' option.");
} else if (value !== undefined) {
console.warn(`${styleProp} was given a value of ${value}, this has no effect on headerStyle.`);
}
});
};
export function Header(props) {
const insets = useSafeAreaInsets();
const frame = useFrameSize(size => size, true);
const {
colors
} = useTheme();
const navigation = useNavigation();
const isParentHeaderShown = React.useContext(HeaderShownContext);
const [searchBarVisible, setSearchBarVisible] = React.useState(false);
const [titleLayout, setTitleLayout] = React.useState(undefined);
const onTitleLayout = e => {
const {
height,
width
} = e.nativeEvent.layout;
setTitleLayout(titleLayout => {
if (titleLayout && height === titleLayout.height && width === titleLayout.width) {
return titleLayout;
}
return {
height,
width
};
});
};
const {
layout = frame,
modal = false,
back,
title,
headerTitle: customTitle,
headerTitleAlign = Platform.OS === 'ios' ? 'center' : 'left',
headerLeft = back ? props => /*#__PURE__*/_jsx(HeaderBackButton, {
...props
}) : undefined,
headerSearchBarOptions,
headerTransparent,
headerTintColor,
headerBackground,
headerRight,
headerTitleAllowFontScaling: titleAllowFontScaling,
headerTitleStyle: titleStyle,
headerLeftContainerStyle: leftContainerStyle,
headerRightContainerStyle: rightContainerStyle,
headerTitleContainerStyle: titleContainerStyle,
headerBackButtonDisplayMode = Platform.OS === 'ios' ? 'default' : 'minimal',
headerBackTitleStyle,
headerBackgroundContainerStyle: backgroundContainerStyle,
headerStyle: customHeaderStyle,
headerShadowVisible,
headerPressColor,
headerPressOpacity,
headerStatusBarHeight = isParentHeaderShown ? 0 : insets.top
} = props;
const defaultHeight = getDefaultHeaderHeight(layout, modal, headerStatusBarHeight);
const {
height = defaultHeight,
maxHeight,
minHeight,
backfaceVisibility,
backgroundColor,
borderBlockColor,
borderBlockEndColor,
borderBlockStartColor,
borderBottomColor,
borderBottomEndRadius,
borderBottomLeftRadius,
borderBottomRightRadius,
borderBottomStartRadius,
borderBottomWidth,
borderColor,
borderCurve,
borderEndColor,
borderEndEndRadius,
borderEndStartRadius,
borderEndWidth,
borderLeftColor,
borderLeftWidth,
borderRadius,
borderRightColor,
borderRightWidth,
borderStartColor,
borderStartEndRadius,
borderStartStartRadius,
borderStartWidth,
borderStyle,
borderTopColor,
borderTopEndRadius,
borderTopLeftRadius,
borderTopRightRadius,
borderTopStartRadius,
borderTopWidth,
borderWidth,
boxShadow,
elevation,
filter,
mixBlendMode,
opacity,
shadowColor,
shadowOffset,
shadowOpacity,
shadowRadius,
transform,
transformOrigin,
...unsafeStyles
} = StyleSheet.flatten(customHeaderStyle || {});
if (process.env.NODE_ENV !== 'production') {
warnIfHeaderStylesDefined(unsafeStyles);
}
const safeStyles = {
backfaceVisibility,
backgroundColor,
borderBlockColor,
borderBlockEndColor,
borderBlockStartColor,
borderBottomColor,
borderBottomEndRadius,
borderBottomLeftRadius,
borderBottomRightRadius,
borderBottomStartRadius,
borderBottomWidth,
borderColor,
borderCurve,
borderEndColor,
borderEndEndRadius,
borderEndStartRadius,
borderEndWidth,
borderLeftColor,
borderLeftWidth,
borderRadius,
borderRightColor,
borderRightWidth,
borderStartColor,
borderStartEndRadius,
borderStartStartRadius,
borderStartWidth,
borderStyle,
borderTopColor,
borderTopEndRadius,
borderTopLeftRadius,
borderTopRightRadius,
borderTopStartRadius,
borderTopWidth,
borderWidth,
boxShadow,
elevation,
filter,
mixBlendMode,
opacity,
shadowColor,
shadowOffset,
shadowOpacity,
shadowRadius,
transform,
transformOrigin
};
// Setting a property to undefined triggers default style
// So we need to filter them out
// Users can use `null` instead
for (const styleProp in safeStyles) {
// @ts-expect-error: typescript wrongly complains that styleProp cannot be used to index safeStyles
if (safeStyles[styleProp] === undefined) {
// @ts-expect-error don't need to care about index signature for deletion
// eslint-disable-next-line @typescript-eslint/no-dynamic-delete
delete safeStyles[styleProp];
}
}
const backgroundStyle = {
...(headerTransparent && {
backgroundColor: 'transparent'
}),
...((headerTransparent || headerShadowVisible === false) && {
borderBottomWidth: 0,
...Platform.select({
android: {
elevation: 0
},
web: {
boxShadow: 'none'
},
default: {
shadowOpacity: 0
}
})
}),
...safeStyles
};
const iconTintColor = headerTintColor ?? Platform.select({
ios: colors.primary,
default: colors.text
});
const leftButton = headerLeft ? headerLeft({
tintColor: iconTintColor,
pressColor: headerPressColor,
pressOpacity: headerPressOpacity,
displayMode: headerBackButtonDisplayMode,
titleLayout,
screenLayout: layout,
canGoBack: Boolean(back),
onPress: back ? navigation.goBack : undefined,
label: back?.title,
labelStyle: headerBackTitleStyle,
href: back?.href
}) : null;
const rightButton = headerRight ? headerRight({
tintColor: iconTintColor,
pressColor: headerPressColor,
pressOpacity: headerPressOpacity,
canGoBack: Boolean(back)
}) : null;
const headerTitle = typeof customTitle !== 'function' ? props => /*#__PURE__*/_jsx(HeaderTitle, {
...props
}) : customTitle;
return /*#__PURE__*/_jsxs(Animated.View, {
pointerEvents: "box-none",
style: [{
height,
minHeight,
maxHeight,
opacity,
transform
}],
children: [/*#__PURE__*/_jsx(Animated.View, {
pointerEvents: "box-none",
style: [StyleSheet.absoluteFill, backgroundContainerStyle],
children: headerBackground ? headerBackground({
style: backgroundStyle
}) : /*#__PURE__*/_jsx(HeaderBackground, {
pointerEvents:
// Allow touch through the header when background color is transparent
headerTransparent && (backgroundStyle.backgroundColor === 'transparent' || Color(backgroundStyle.backgroundColor).alpha() === 0) ? 'none' : 'auto',
style: backgroundStyle
})
}), /*#__PURE__*/_jsx(View, {
pointerEvents: "none",
style: {
height: headerStatusBarHeight
}
}), /*#__PURE__*/_jsxs(View, {
pointerEvents: "box-none",
style: [styles.content, Platform.OS === 'ios' && frame.width >= IPAD_MINI_MEDIUM_WIDTH ? styles.large : null],
children: [/*#__PURE__*/_jsx(Animated.View, {
pointerEvents: "box-none",
style: [styles.start, !searchBarVisible && headerTitleAlign === 'center' && styles.expand, {
marginStart: insets.left
}, leftContainerStyle],
children: leftButton
}), Platform.OS === 'ios' || !searchBarVisible ? /*#__PURE__*/_jsxs(_Fragment, {
children: [/*#__PURE__*/_jsx(Animated.View, {
pointerEvents: "box-none",
style: [styles.title, {
// Avoid the title from going offscreen or overlapping buttons
maxWidth: headerTitleAlign === 'center' ? layout.width - ((leftButton ? headerBackButtonDisplayMode !== 'minimal' ? 80 : 32 : 16) + (rightButton || headerSearchBarOptions ? 16 : 0) + Math.max(insets.left, insets.right)) * 2 : layout.width - ((leftButton ? 52 : 16) + (rightButton || headerSearchBarOptions ? 52 : 16) + insets.left - insets.right)
}, headerTitleAlign === 'left' && leftButton ? {
marginStart: 4
} : {
marginHorizontal: 16
}, titleContainerStyle],
children: headerTitle({
children: title,
allowFontScaling: titleAllowFontScaling,
tintColor: headerTintColor,
onLayout: onTitleLayout,
style: titleStyle
})
}), /*#__PURE__*/_jsxs(Animated.View, {
pointerEvents: "box-none",
style: [styles.end, styles.expand, {
marginEnd: insets.right
}, rightContainerStyle],
children: [rightButton, headerSearchBarOptions ? /*#__PURE__*/_jsx(HeaderButton, {
tintColor: iconTintColor,
pressColor: headerPressColor,
pressOpacity: headerPressOpacity,
onPress: () => {
setSearchBarVisible(true);
headerSearchBarOptions?.onOpen?.();
},
children: /*#__PURE__*/_jsx(HeaderIcon, {
source: searchIcon,
tintColor: iconTintColor
})
}) : null]
})]
}) : null, Platform.OS === 'ios' || searchBarVisible ? /*#__PURE__*/_jsx(HeaderSearchBar, {
...headerSearchBarOptions,
visible: searchBarVisible,
onClose: () => {
setSearchBarVisible(false);
headerSearchBarOptions?.onClose?.();
},
tintColor: headerTintColor,
style: [Platform.OS === 'ios' ? [StyleSheet.absoluteFill, {
paddingTop: headerStatusBarHeight ? 0 : 4
}, {
backgroundColor: backgroundColor ?? colors.card
}] : !leftButton && {
marginStart: 8
}]
}) : null]
})]
});
}
const styles = StyleSheet.create({
content: {
flex: 1,
flexDirection: 'row',
alignItems: 'stretch'
},
large: {
marginHorizontal: 5
},
title: {
justifyContent: 'center'
},
start: {
flexDirection: 'row',
alignItems: 'center',
justifyContent: 'flex-start'
},
end: {
flexDirection: 'row',
alignItems: 'center',
justifyContent: 'flex-end'
},
expand: {
flexGrow: 1,
flexBasis: 0
}
});
//# sourceMappingURL=Header.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,188 @@
"use strict";
import { useLocale, useTheme } from '@react-navigation/native';
import * as React from 'react';
import { Animated, Image, Platform, StyleSheet, View } from 'react-native';
import backIcon from '../assets/back-icon.png';
import backIconMask from '../assets/back-icon-mask.png';
import { MaskedView } from '../MaskedView';
import { HeaderButton } from "./HeaderButton.js";
import { HeaderIcon, ICON_MARGIN } from "./HeaderIcon.js";
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
export function HeaderBackButton({
disabled,
allowFontScaling,
backImage,
label,
labelStyle,
displayMode = Platform.OS === 'ios' ? 'default' : 'minimal',
onLabelLayout,
onPress,
pressColor,
pressOpacity,
screenLayout,
tintColor,
titleLayout,
truncatedLabel = 'Back',
accessibilityLabel = label && label !== 'Back' ? `${label}, back` : 'Go back',
testID,
style,
href
}) {
const {
colors,
fonts
} = useTheme();
const {
direction
} = useLocale();
const [labelWidth, setLabelWidth] = React.useState(null);
const [truncatedLabelWidth, setTruncatedLabelWidth] = React.useState(null);
const renderBackImage = () => {
if (backImage) {
return backImage({
tintColor: tintColor ?? colors.text
});
} else {
return /*#__PURE__*/_jsx(HeaderIcon, {
source: backIcon,
tintColor: tintColor,
style: [styles.icon, displayMode !== 'minimal' && styles.iconWithLabel]
});
}
};
const renderLabel = () => {
if (displayMode === 'minimal') {
return null;
}
const availableSpace = titleLayout && screenLayout ? (screenLayout.width - titleLayout.width) / 2 - (ICON_WIDTH + ICON_MARGIN) : null;
const potentialLabelText = displayMode === 'default' ? label : truncatedLabel;
const finalLabelText = availableSpace && labelWidth && truncatedLabelWidth ? availableSpace > labelWidth ? potentialLabelText : availableSpace > truncatedLabelWidth ? truncatedLabel : null : potentialLabelText;
const commonStyle = [fonts.regular, styles.label, labelStyle];
const hiddenStyle = [commonStyle, {
position: 'absolute',
top: 0,
left: 0,
opacity: 0
}];
const labelElement = /*#__PURE__*/_jsxs(View, {
style: styles.labelWrapper,
children: [label && displayMode === 'default' ? /*#__PURE__*/_jsx(Animated.Text, {
style: hiddenStyle,
numberOfLines: 1,
onLayout: e => setLabelWidth(e.nativeEvent.layout.width),
children: label
}) : null, truncatedLabel ? /*#__PURE__*/_jsx(Animated.Text, {
style: hiddenStyle,
numberOfLines: 1,
onLayout: e => setTruncatedLabelWidth(e.nativeEvent.layout.width),
children: truncatedLabel
}) : null, finalLabelText ? /*#__PURE__*/_jsx(Animated.Text, {
accessible: false,
onLayout: onLabelLayout,
style: [tintColor ? {
color: tintColor
} : null, commonStyle],
numberOfLines: 1,
allowFontScaling: !!allowFontScaling,
children: finalLabelText
}) : null]
});
if (backImage || Platform.OS !== 'ios') {
// When a custom backimage is specified, we can't mask the label
// Otherwise there might be weird effect due to our mask not being the same as the image
return labelElement;
}
return /*#__PURE__*/_jsx(MaskedView, {
maskElement: /*#__PURE__*/_jsxs(View, {
style: [styles.iconMaskContainer,
// Extend the mask to the center of the screen so that label isn't clipped during animation
screenLayout ? {
minWidth: screenLayout.width / 2 - 27
} : null],
children: [/*#__PURE__*/_jsx(Image, {
source: backIconMask,
resizeMode: "contain",
style: [styles.iconMask, direction === 'rtl' && styles.flip]
}), /*#__PURE__*/_jsx(View, {
style: styles.iconMaskFillerRect
})]
}),
children: labelElement
});
};
const handlePress = () => {
if (onPress) {
requestAnimationFrame(() => onPress());
}
};
return /*#__PURE__*/_jsx(HeaderButton, {
disabled: disabled,
href: href,
accessibilityLabel: accessibilityLabel,
testID: testID,
onPress: handlePress,
pressColor: pressColor,
pressOpacity: pressOpacity,
style: [styles.container, style],
children: /*#__PURE__*/_jsxs(React.Fragment, {
children: [renderBackImage(), renderLabel()]
})
});
}
const ICON_WIDTH = Platform.OS === 'ios' ? 13 : 24;
const ICON_MARGIN_END = Platform.OS === 'ios' ? 22 : 3;
const styles = StyleSheet.create({
container: {
paddingHorizontal: 0,
minWidth: StyleSheet.hairlineWidth,
// Avoid collapsing when title is long
...Platform.select({
ios: null,
default: {
marginVertical: 3,
marginHorizontal: 11
}
})
},
label: {
fontSize: 17,
// Title and back label are a bit different width due to title being bold
// Adjusting the letterSpacing makes them coincide better
letterSpacing: 0.35
},
labelWrapper: {
// These styles will make sure that the label doesn't fill the available space
// Otherwise it messes with the measurement of the label
flexDirection: 'row',
alignItems: 'flex-start',
marginEnd: ICON_MARGIN
},
icon: {
width: ICON_WIDTH,
marginEnd: ICON_MARGIN_END
},
iconWithLabel: Platform.OS === 'ios' ? {
marginEnd: 6
} : {},
iconMaskContainer: {
flex: 1,
flexDirection: 'row',
justifyContent: 'center'
},
iconMaskFillerRect: {
flex: 1,
backgroundColor: '#000'
},
iconMask: {
height: 21,
width: 13,
marginStart: -14.5,
marginVertical: 12,
alignSelf: 'center'
},
flip: {
transform: 'scaleX(-1)'
}
});
//# sourceMappingURL=HeaderBackButton.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,5 @@
"use strict";
import { getNamedContext } from "../getNamedContext.js";
export const HeaderBackContext = getNamedContext('HeaderBackContext', undefined);
//# sourceMappingURL=HeaderBackContext.js.map

View File

@@ -0,0 +1 @@
{"version":3,"names":["getNamedContext","HeaderBackContext","undefined"],"sourceRoot":"../../../src","sources":["Header/HeaderBackContext.tsx"],"mappings":";;AAAA,SAASA,eAAe,QAAQ,uBAAoB;AAEpD,OAAO,MAAMC,iBAAiB,GAAGD,eAAe,CAE9C,mBAAmB,EAAEE,SAAS,CAAC","ignoreList":[]}

View File

@@ -0,0 +1,47 @@
"use strict";
import { useTheme } from '@react-navigation/native';
import * as React from 'react';
import { Animated, Platform, StyleSheet } from 'react-native';
import { jsx as _jsx } from "react/jsx-runtime";
export function HeaderBackground({
style,
...rest
}) {
const {
colors,
dark
} = useTheme();
return /*#__PURE__*/_jsx(Animated.View, {
style: [styles.container, {
backgroundColor: colors.card,
borderBottomColor: colors.border,
...(Platform.OS === 'ios' && {
shadowColor: dark ? 'rgba(255, 255, 255, 0.45)' : 'rgba(0, 0, 0, 1)'
})
}, style],
...rest
});
}
const styles = StyleSheet.create({
container: {
flex: 1,
...Platform.select({
android: {
elevation: 4
},
ios: {
shadowOpacity: 0.3,
shadowRadius: 0,
shadowOffset: {
width: 0,
height: StyleSheet.hairlineWidth
}
},
default: {
borderBottomWidth: StyleSheet.hairlineWidth
}
})
}
});
//# sourceMappingURL=HeaderBackground.js.map

View File

@@ -0,0 +1 @@
{"version":3,"names":["useTheme","React","Animated","Platform","StyleSheet","jsx","_jsx","HeaderBackground","style","rest","colors","dark","View","styles","container","backgroundColor","card","borderBottomColor","border","OS","shadowColor","create","flex","select","android","elevation","ios","shadowOpacity","shadowRadius","shadowOffset","width","height","hairlineWidth","default","borderBottomWidth"],"sourceRoot":"../../../src","sources":["Header/HeaderBackground.tsx"],"mappings":";;AAAA,SAASA,QAAQ,QAAQ,0BAA0B;AACnD,OAAO,KAAKC,KAAK,MAAM,OAAO;AAC9B,SACEC,QAAQ,EACRC,QAAQ,EAERC,UAAU,QAGL,cAAc;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAOtB,OAAO,SAASC,gBAAgBA,CAAC;EAAEC,KAAK;EAAE,GAAGC;AAAY,CAAC,EAAE;EAC1D,MAAM;IAAEC,MAAM;IAAEC;EAAK,CAAC,GAAGX,QAAQ,CAAC,CAAC;EAEnC,oBACEM,IAAA,CAACJ,QAAQ,CAACU,IAAI;IACZJ,KAAK,EAAE,CACLK,MAAM,CAACC,SAAS,EAChB;MACEC,eAAe,EAAEL,MAAM,CAACM,IAAI;MAC5BC,iBAAiB,EAAEP,MAAM,CAACQ,MAAM;MAChC,IAAIf,QAAQ,CAACgB,EAAE,KAAK,KAAK,IAAI;QAC3BC,WAAW,EAAET,IAAI,GACb,2BAA2B,GAC3B;MACN,CAAC;IACH,CAAC,EACDH,KAAK,CACL;IAAA,GACEC;EAAI,CACT,CAAC;AAEN;AAEA,MAAMI,MAAM,GAAGT,UAAU,CAACiB,MAAM,CAAC;EAC/BP,SAAS,EAAE;IACTQ,IAAI,EAAE,CAAC;IACP,GAAGnB,QAAQ,CAACoB,MAAM,CAAC;MACjBC,OAAO,EAAE;QACPC,SAAS,EAAE;MACb,CAAC;MACDC,GAAG,EAAE;QACHC,aAAa,EAAE,GAAG;QAClBC,YAAY,EAAE,CAAC;QACfC,YAAY,EAAE;UACZC,KAAK,EAAE,CAAC;UACRC,MAAM,EAAE3B,UAAU,CAAC4B;QACrB;MACF,CAAC;MACDC,OAAO,EAAE;QACPC,iBAAiB,EAAE9B,UAAU,CAAC4B;MAChC;IACF,CAAC;EACH;AACF,CAAC,CAAC","ignoreList":[]}

View File

@@ -0,0 +1,61 @@
"use strict";
import * as React from 'react';
import { Platform, StyleSheet } from 'react-native';
import { PlatformPressable } from "../PlatformPressable.js";
import { jsx as _jsx } from "react/jsx-runtime";
function HeaderButtonInternal({
disabled,
onPress,
pressColor,
pressOpacity,
accessibilityLabel,
testID,
style,
href,
children
}, ref) {
return /*#__PURE__*/_jsx(PlatformPressable, {
ref: ref,
disabled: disabled,
href: href,
"aria-label": accessibilityLabel,
testID: testID,
onPress: onPress,
pressColor: pressColor,
pressOpacity: pressOpacity,
android_ripple: androidRipple,
style: [styles.container, disabled && styles.disabled, style],
hitSlop: Platform.select({
ios: undefined,
default: {
top: 16,
right: 16,
bottom: 16,
left: 16
}
}),
children: children
});
}
export const HeaderButton = /*#__PURE__*/React.forwardRef(HeaderButtonInternal);
HeaderButton.displayName = 'HeaderButton';
const androidRipple = {
borderless: true,
foreground: Platform.OS === 'android' && Platform.Version >= 23,
radius: 20
};
const styles = StyleSheet.create({
container: {
flexDirection: 'row',
alignItems: 'center',
paddingHorizontal: 8,
// Roundness for iPad hover effect
borderRadius: 10,
borderCurve: 'continuous'
},
disabled: {
opacity: 0.5
}
});
//# sourceMappingURL=HeaderButton.js.map

View File

@@ -0,0 +1 @@
{"version":3,"names":["React","Platform","StyleSheet","PlatformPressable","jsx","_jsx","HeaderButtonInternal","disabled","onPress","pressColor","pressOpacity","accessibilityLabel","testID","style","href","children","ref","android_ripple","androidRipple","styles","container","hitSlop","select","ios","undefined","default","top","right","bottom","left","HeaderButton","forwardRef","displayName","borderless","foreground","OS","Version","radius","create","flexDirection","alignItems","paddingHorizontal","borderRadius","borderCurve","opacity"],"sourceRoot":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,CAACmC,OAAO,IAAI,EAAE;EAC/DC,MAAM,EAAE;AACV,CAAC;AAED,MAAMlB,MAAM,GAAGjB,UAAU,CAACoC,MAAM,CAAC;EAC/BlB,SAAS,EAAE;IACTmB,aAAa,EAAE,KAAK;IACpBC,UAAU,EAAE,QAAQ;IACpBC,iBAAiB,EAAE,CAAC;IACpB;IACAC,YAAY,EAAE,EAAE;IAChBC,WAAW,EAAE;EACf,CAAC;EACDpC,QAAQ,EAAE;IACRqC,OAAO,EAAE;EACX;AACF,CAAC,CAAC","ignoreList":[]}

View File

@@ -0,0 +1,5 @@
"use strict";
import { getNamedContext } from "../getNamedContext.js";
export const HeaderHeightContext = getNamedContext('HeaderHeightContext', undefined);
//# sourceMappingURL=HeaderHeightContext.js.map

View File

@@ -0,0 +1 @@
{"version":3,"names":["getNamedContext","HeaderHeightContext","undefined"],"sourceRoot":"../../../src","sources":["Header/HeaderHeightContext.tsx"],"mappings":";;AAAA,SAASA,eAAe,QAAQ,uBAAoB;AAEpD,OAAO,MAAMC,mBAAmB,GAAGD,eAAe,CAChD,qBAAqB,EACrBE,SACF,CAAC","ignoreList":[]}

View File

@@ -0,0 +1,38 @@
"use strict";
import { useLocale, useTheme } from '@react-navigation/native';
import { Image, Platform, StyleSheet } from 'react-native';
import { jsx as _jsx } from "react/jsx-runtime";
export function HeaderIcon({
source,
style,
...rest
}) {
const {
colors
} = useTheme();
const {
direction
} = useLocale();
return /*#__PURE__*/_jsx(Image, {
source: source,
resizeMode: "contain",
fadeDuration: 0,
tintColor: colors.text,
style: [styles.icon, direction === 'rtl' && styles.flip, style],
...rest
});
}
export const ICON_SIZE = Platform.OS === 'ios' ? 21 : 24;
export const ICON_MARGIN = Platform.OS === 'ios' ? 8 : 3;
const styles = StyleSheet.create({
icon: {
width: ICON_SIZE,
height: ICON_SIZE,
margin: ICON_MARGIN
},
flip: {
transform: 'scaleX(-1)'
}
});
//# sourceMappingURL=HeaderIcon.js.map

View File

@@ -0,0 +1 @@
{"version":3,"names":["useLocale","useTheme","Image","Platform","StyleSheet","jsx","_jsx","HeaderIcon","source","style","rest","colors","direction","resizeMode","fadeDuration","tintColor","text","styles","icon","flip","ICON_SIZE","OS","ICON_MARGIN","create","width","height","margin","transform"],"sourceRoot":"../../../src","sources":["Header/HeaderIcon.tsx"],"mappings":";;AAAA,SAASA,SAAS,EAAEC,QAAQ,QAAQ,0BAA0B;AAC9D,SAASC,KAAK,EAAmBC,QAAQ,EAAEC,UAAU,QAAQ,cAAc;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAE5E,OAAO,SAASC,UAAUA,CAAC;EAAEC,MAAM;EAAEC,KAAK;EAAE,GAAGC;AAAiB,CAAC,EAAE;EACjE,MAAM;IAAEC;EAAO,CAAC,GAAGV,QAAQ,CAAC,CAAC;EAC7B,MAAM;IAAEW;EAAU,CAAC,GAAGZ,SAAS,CAAC,CAAC;EAEjC,oBACEM,IAAA,CAACJ,KAAK;IACJM,MAAM,EAAEA,MAAO;IACfK,UAAU,EAAC,SAAS;IACpBC,YAAY,EAAE,CAAE;IAChBC,SAAS,EAAEJ,MAAM,CAACK,IAAK;IACvBP,KAAK,EAAE,CAACQ,MAAM,CAACC,IAAI,EAAEN,SAAS,KAAK,KAAK,IAAIK,MAAM,CAACE,IAAI,EAAEV,KAAK,CAAE;IAAA,GAC5DC;EAAI,CACT,CAAC;AAEN;AAEA,OAAO,MAAMU,SAAS,GAAGjB,QAAQ,CAACkB,EAAE,KAAK,KAAK,GAAG,EAAE,GAAG,EAAE;AACxD,OAAO,MAAMC,WAAW,GAAGnB,QAAQ,CAACkB,EAAE,KAAK,KAAK,GAAG,CAAC,GAAG,CAAC;AAExD,MAAMJ,MAAM,GAAGb,UAAU,CAACmB,MAAM,CAAC;EAC/BL,IAAI,EAAE;IACJM,KAAK,EAAEJ,SAAS;IAChBK,MAAM,EAAEL,SAAS;IACjBM,MAAM,EAAEJ;EACV,CAAC;EACDH,IAAI,EAAE;IACJQ,SAAS,EAAE;EACb;AACF,CAAC,CAAC","ignoreList":[]}

View File

@@ -0,0 +1,286 @@
"use strict";
import { useNavigation, useTheme } from '@react-navigation/native';
import Color from 'color';
import * as React from 'react';
import { Animated, Image, Platform, StyleSheet, TextInput, View } from 'react-native';
import clearIcon from '../assets/clear-icon.png';
import closeIcon from '../assets/close-icon.png';
import searchIcon from '../assets/search-icon.png';
import { PlatformPressable } from "../PlatformPressable.js";
import { Text } from "../Text.js";
import { HeaderButton } from "./HeaderButton.js";
import { HeaderIcon } from "./HeaderIcon.js";
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
const INPUT_TYPE_TO_MODE = {
text: 'text',
number: 'numeric',
phone: 'tel',
email: 'email'
};
const useNativeDriver = Platform.OS !== 'web';
function HeaderSearchBarInternal({
visible,
inputType,
autoFocus = true,
autoCapitalize,
placeholder = 'Search',
cancelButtonText = 'Cancel',
enterKeyHint = 'search',
onChangeText,
onClose,
tintColor,
style,
...rest
}, ref) {
const navigation = useNavigation();
const {
dark,
colors,
fonts
} = useTheme();
const [value, setValue] = React.useState('');
const [rendered, setRendered] = React.useState(visible);
const [visibleAnim] = React.useState(() => new Animated.Value(visible ? 1 : 0));
const [clearVisibleAnim] = React.useState(() => new Animated.Value(0));
const visibleValueRef = React.useRef(visible);
const clearVisibleValueRef = React.useRef(false);
const inputRef = React.useRef(null);
React.useEffect(() => {
// Avoid act warning in tests just by rendering header
if (visible === visibleValueRef.current) {
return;
}
Animated.timing(visibleAnim, {
toValue: visible ? 1 : 0,
duration: 100,
useNativeDriver
}).start(({
finished
}) => {
if (finished) {
setRendered(visible);
visibleValueRef.current = visible;
}
});
return () => {
visibleAnim.stopAnimation();
};
}, [visible, visibleAnim]);
const hasText = value !== '';
React.useEffect(() => {
if (clearVisibleValueRef.current === hasText) {
return;
}
Animated.timing(clearVisibleAnim, {
toValue: hasText ? 1 : 0,
duration: 100,
useNativeDriver
}).start(({
finished
}) => {
if (finished) {
clearVisibleValueRef.current = hasText;
}
});
}, [clearVisibleAnim, hasText]);
const clearText = React.useCallback(() => {
inputRef.current?.clear();
inputRef.current?.focus();
setValue('');
}, []);
const onClear = React.useCallback(() => {
clearText();
// FIXME: figure out how to create a SyntheticEvent
// @ts-expect-error: we don't have the native event here
onChangeText?.({
nativeEvent: {
text: ''
}
});
}, [clearText, onChangeText]);
const cancelSearch = React.useCallback(() => {
onClear();
onClose();
}, [onClear, onClose]);
React.useEffect(() => navigation?.addListener('blur', cancelSearch), [cancelSearch, navigation]);
React.useImperativeHandle(ref, () => ({
focus: () => {
inputRef.current?.focus();
},
blur: () => {
inputRef.current?.blur();
},
setText: text => {
inputRef.current?.setNativeProps({
text
});
setValue(text);
},
clearText,
cancelSearch
}), [cancelSearch, clearText]);
if (!visible && !rendered) {
return null;
}
const textColor = tintColor ?? colors.text;
return /*#__PURE__*/_jsxs(Animated.View, {
pointerEvents: visible ? 'auto' : 'none',
"aria-live": "polite",
"aria-hidden": !visible,
style: [styles.container, {
opacity: visibleAnim
}, style],
children: [/*#__PURE__*/_jsxs(View, {
style: styles.searchbarContainer,
children: [/*#__PURE__*/_jsx(HeaderIcon, {
source: searchIcon,
tintColor: textColor,
style: styles.inputSearchIcon
}), /*#__PURE__*/_jsx(TextInput, {
...rest,
ref: inputRef,
onChange: onChangeText,
onChangeText: setValue,
autoFocus: autoFocus,
autoCapitalize: autoCapitalize === 'systemDefault' ? undefined : autoCapitalize,
inputMode: INPUT_TYPE_TO_MODE[inputType ?? 'text'],
enterKeyHint: enterKeyHint,
placeholder: placeholder,
placeholderTextColor: Color(textColor).alpha(0.5).string(),
cursorColor: colors.primary,
selectionHandleColor: colors.primary,
selectionColor: Color(colors.primary).alpha(0.3).string(),
style: [fonts.regular, styles.searchbar, {
backgroundColor: Platform.select({
ios: dark ? 'rgba(255, 255, 255, 0.1)' : 'rgba(0, 0, 0, 0.1)',
default: 'transparent'
}),
color: textColor,
borderBottomColor: Color(textColor).alpha(0.2).string()
}]
}), Platform.OS === 'ios' ? /*#__PURE__*/_jsx(PlatformPressable, {
onPress: onClear,
style: [{
opacity: clearVisibleAnim,
transform: [{
scale: clearVisibleAnim
}]
}, styles.clearButton],
children: /*#__PURE__*/_jsx(Image, {
source: clearIcon,
resizeMode: "contain",
tintColor: textColor,
style: styles.clearIcon
})
}) : null]
}), Platform.OS !== 'ios' ? /*#__PURE__*/_jsx(HeaderButton, {
onPress: () => {
if (value) {
onClear();
} else {
onClose();
}
},
style: styles.closeButton,
children: /*#__PURE__*/_jsx(HeaderIcon, {
source: closeIcon,
tintColor: textColor
})
}) : null, Platform.OS === 'ios' ? /*#__PURE__*/_jsx(PlatformPressable, {
onPress: cancelSearch,
style: styles.cancelButton,
children: /*#__PURE__*/_jsx(Text, {
style: [fonts.regular, {
color: tintColor ?? colors.primary
}, styles.cancelText],
children: cancelButtonText
})
}) : null]
});
}
const styles = StyleSheet.create({
container: {
flex: 1,
flexDirection: 'row',
alignItems: 'stretch'
},
inputSearchIcon: {
position: 'absolute',
opacity: 0.5,
left: Platform.select({
ios: 16,
default: 4
}),
top: Platform.select({
ios: -1,
default: 17
}),
...Platform.select({
ios: {
height: 18,
width: 18
},
default: {}
})
},
closeButton: {
position: 'absolute',
opacity: 0.5,
right: Platform.select({
ios: 0,
default: 8
}),
top: Platform.select({
ios: -2,
default: 17
})
},
clearButton: {
position: 'absolute',
right: 0,
top: -7,
bottom: 0,
justifyContent: 'center',
padding: 8
},
clearIcon: {
height: 16,
width: 16,
opacity: 0.5
},
cancelButton: {
alignSelf: 'center',
top: -4
},
cancelText: {
fontSize: 17,
marginHorizontal: 12
},
searchbarContainer: {
flex: 1
},
searchbar: Platform.select({
ios: {
flex: 1,
fontSize: 17,
paddingHorizontal: 32,
marginLeft: 16,
marginTop: -1,
marginBottom: 4,
borderRadius: 8,
borderCurve: 'continuous'
},
default: {
flex: 1,
fontSize: 18,
paddingHorizontal: 36,
marginRight: 8,
marginTop: 8,
marginBottom: 8,
borderBottomWidth: 1
}
})
});
export const HeaderSearchBar = /*#__PURE__*/React.forwardRef(HeaderSearchBarInternal);
//# sourceMappingURL=HeaderSearchBar.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,5 @@
"use strict";
import { getNamedContext } from "../getNamedContext.js";
export const HeaderShownContext = getNamedContext('HeaderShownContext', false);
//# sourceMappingURL=HeaderShownContext.js.map

View File

@@ -0,0 +1 @@
{"version":3,"names":["getNamedContext","HeaderShownContext"],"sourceRoot":"../../../src","sources":["Header/HeaderShownContext.tsx"],"mappings":";;AAAA,SAASA,eAAe,QAAQ,uBAAoB;AAEpD,OAAO,MAAMC,kBAAkB,GAAGD,eAAe,CAAC,oBAAoB,EAAE,KAAK,CAAC","ignoreList":[]}

View File

@@ -0,0 +1,41 @@
"use strict";
import { useTheme } from '@react-navigation/native';
import { Animated, Platform, StyleSheet } from 'react-native';
import { jsx as _jsx } from "react/jsx-runtime";
export function HeaderTitle({
tintColor,
style,
...rest
}) {
const {
colors,
fonts
} = useTheme();
return /*#__PURE__*/_jsx(Animated.Text, {
role: "heading",
"aria-level": "1",
numberOfLines: 1,
...rest,
style: [{
color: tintColor === undefined ? colors.text : tintColor
}, Platform.select({
ios: fonts.bold,
default: fonts.medium
}), styles.title, style]
});
}
const styles = StyleSheet.create({
title: Platform.select({
ios: {
fontSize: 17
},
android: {
fontSize: 20
},
default: {
fontSize: 18
}
})
});
//# sourceMappingURL=HeaderTitle.js.map

View File

@@ -0,0 +1 @@
{"version":3,"names":["useTheme","Animated","Platform","StyleSheet","jsx","_jsx","HeaderTitle","tintColor","style","rest","colors","fonts","Text","role","numberOfLines","color","undefined","text","select","ios","bold","default","medium","styles","title","create","fontSize","android"],"sourceRoot":"../../../src","sources":["Header/HeaderTitle.tsx"],"mappings":";;AAAA,SAASA,QAAQ,QAAQ,0BAA0B;AACnD,SACEC,QAAQ,EACRC,QAAQ,EAERC,UAAU,QAGL,cAAc;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAQtB,OAAO,SAASC,WAAWA,CAAC;EAAEC,SAAS;EAAEC,KAAK;EAAE,GAAGC;AAAY,CAAC,EAAE;EAChE,MAAM;IAAEC,MAAM;IAAEC;EAAM,CAAC,GAAGX,QAAQ,CAAC,CAAC;EAEpC,oBACEK,IAAA,CAACJ,QAAQ,CAACW,IAAI;IACZC,IAAI,EAAC,SAAS;IACd,cAAW,GAAG;IACdC,aAAa,EAAE,CAAE;IAAA,GACbL,IAAI;IACRD,KAAK,EAAE,CACL;MAAEO,KAAK,EAAER,SAAS,KAAKS,SAAS,GAAGN,MAAM,CAACO,IAAI,GAAGV;IAAU,CAAC,EAC5DL,QAAQ,CAACgB,MAAM,CAAC;MAAEC,GAAG,EAAER,KAAK,CAACS,IAAI;MAAEC,OAAO,EAAEV,KAAK,CAACW;IAAO,CAAC,CAAC,EAC3DC,MAAM,CAACC,KAAK,EACZhB,KAAK;EACL,CACH,CAAC;AAEN;AAEA,MAAMe,MAAM,GAAGpB,UAAU,CAACsB,MAAM,CAAC;EAC/BD,KAAK,EAAEtB,QAAQ,CAACgB,MAAM,CAAC;IACrBC,GAAG,EAAE;MACHO,QAAQ,EAAE;IACZ,CAAC;IACDC,OAAO,EAAE;MACPD,QAAQ,EAAE;IACZ,CAAC;IACDL,OAAO,EAAE;MACPK,QAAQ,EAAE;IACZ;EACF,CAAC;AACH,CAAC,CAAC","ignoreList":[]}

View File

@@ -0,0 +1,34 @@
"use strict";
import { PixelRatio, Platform } from 'react-native';
export function getDefaultHeaderHeight(layout, modalPresentation, topInset) {
let headerHeight;
// On models with Dynamic Island the status bar height is smaller than the safe area top inset.
const hasDynamicIsland = Platform.OS === 'ios' && topInset > 50;
const statusBarHeight = hasDynamicIsland ? topInset - (5 + 1 / PixelRatio.get()) : topInset;
const isLandscape = layout.width > layout.height;
if (Platform.OS === 'ios') {
if (Platform.isPad || Platform.isTV) {
if (modalPresentation) {
headerHeight = 56;
} else {
headerHeight = 50;
}
} else {
if (isLandscape) {
headerHeight = 32;
} else {
if (modalPresentation) {
headerHeight = 56;
} else {
headerHeight = 44;
}
}
}
} else {
headerHeight = 64;
}
return headerHeight + statusBarHeight;
}
//# sourceMappingURL=getDefaultHeaderHeight.js.map

View File

@@ -0,0 +1 @@
{"version":3,"names":["PixelRatio","Platform","getDefaultHeaderHeight","layout","modalPresentation","topInset","headerHeight","hasDynamicIsland","OS","statusBarHeight","get","isLandscape","width","height","isPad","isTV"],"sourceRoot":"../../../src","sources":["Header/getDefaultHeaderHeight.tsx"],"mappings":";;AAAA,SAASA,UAAU,EAAEC,QAAQ,QAAQ,cAAc;AAInD,OAAO,SAASC,sBAAsBA,CACpCC,MAAc,EACdC,iBAA0B,EAC1BC,QAAgB,EACR;EACR,IAAIC,YAAY;;EAEhB;EACA,MAAMC,gBAAgB,GAAGN,QAAQ,CAACO,EAAE,KAAK,KAAK,IAAIH,QAAQ,GAAG,EAAE;EAC/D,MAAMI,eAAe,GAAGF,gBAAgB,GACpCF,QAAQ,IAAI,CAAC,GAAG,CAAC,GAAGL,UAAU,CAACU,GAAG,CAAC,CAAC,CAAC,GACrCL,QAAQ;EAEZ,MAAMM,WAAW,GAAGR,MAAM,CAACS,KAAK,GAAGT,MAAM,CAACU,MAAM;EAEhD,IAAIZ,QAAQ,CAACO,EAAE,KAAK,KAAK,EAAE;IACzB,IAAIP,QAAQ,CAACa,KAAK,IAAIb,QAAQ,CAACc,IAAI,EAAE;MACnC,IAAIX,iBAAiB,EAAE;QACrBE,YAAY,GAAG,EAAE;MACnB,CAAC,MAAM;QACLA,YAAY,GAAG,EAAE;MACnB;IACF,CAAC,MAAM;MACL,IAAIK,WAAW,EAAE;QACfL,YAAY,GAAG,EAAE;MACnB,CAAC,MAAM;QACL,IAAIF,iBAAiB,EAAE;UACrBE,YAAY,GAAG,EAAE;QACnB,CAAC,MAAM;UACLA,YAAY,GAAG,EAAE;QACnB;MACF;IACF;EACF,CAAC,MAAM;IACLA,YAAY,GAAG,EAAE;EACnB;EAEA,OAAOA,YAAY,GAAGG,eAAe;AACvC","ignoreList":[]}

View File

@@ -0,0 +1,6 @@
"use strict";
export function getHeaderTitle(options, fallback) {
return typeof options.headerTitle === 'string' ? options.headerTitle : options.title !== undefined ? options.title : fallback;
}
//# sourceMappingURL=getHeaderTitle.js.map

View File

@@ -0,0 +1 @@
{"version":3,"names":["getHeaderTitle","options","fallback","headerTitle","title","undefined"],"sourceRoot":"../../../src","sources":["Header/getHeaderTitle.tsx"],"mappings":";;AAEA,OAAO,SAASA,cAAcA,CAC5BC,OAAuE,EACvEC,QAAgB,EACR;EACR,OAAO,OAAOD,OAAO,CAACE,WAAW,KAAK,QAAQ,GAC1CF,OAAO,CAACE,WAAW,GACnBF,OAAO,CAACG,KAAK,KAAKC,SAAS,GACzBJ,OAAO,CAACG,KAAK,GACbF,QAAQ;AAChB","ignoreList":[]}

View File

@@ -0,0 +1,12 @@
"use strict";
import * as React from 'react';
import { HeaderHeightContext } from "./HeaderHeightContext.js";
export function useHeaderHeight() {
const height = React.useContext(HeaderHeightContext);
if (height === undefined) {
throw new Error("Couldn't find the header height. Are you inside a screen in a navigator with a header?");
}
return height;
}
//# sourceMappingURL=useHeaderHeight.js.map

View File

@@ -0,0 +1 @@
{"version":3,"names":["React","HeaderHeightContext","useHeaderHeight","height","useContext","undefined","Error"],"sourceRoot":"../../../src","sources":["Header/useHeaderHeight.tsx"],"mappings":";;AAAA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAE9B,SAASC,mBAAmB,QAAQ,0BAAuB;AAE3D,OAAO,SAASC,eAAeA,CAAA,EAAG;EAChC,MAAMC,MAAM,GAAGH,KAAK,CAACI,UAAU,CAACH,mBAAmB,CAAC;EAEpD,IAAIE,MAAM,KAAKE,SAAS,EAAE;IACxB,MAAM,IAAIC,KAAK,CACb,wFACF,CAAC;EACH;EAEA,OAAOH,MAAM;AACf","ignoreList":[]}

View File

@@ -0,0 +1,25 @@
"use strict";
import { StyleSheet } from 'react-native';
import { Text } from "../Text.js";
import { jsx as _jsx } from "react/jsx-runtime";
export function Label({
tintColor,
style,
...rest
}) {
return /*#__PURE__*/_jsx(Text, {
numberOfLines: 1,
...rest,
style: [styles.label, tintColor != null && {
color: tintColor
}, style]
});
}
const styles = StyleSheet.create({
label: {
textAlign: 'center',
backgroundColor: 'transparent'
}
});
//# sourceMappingURL=Label.js.map

View File

@@ -0,0 +1 @@
{"version":3,"names":["StyleSheet","Text","jsx","_jsx","Label","tintColor","style","rest","numberOfLines","styles","label","color","create","textAlign","backgroundColor"],"sourceRoot":"../../../src","sources":["Label/Label.tsx"],"mappings":";;AAAA,SAEEA,UAAU,QAGL,cAAc;AAErB,SAASC,IAAI,QAAQ,YAAS;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAQ/B,OAAO,SAASC,KAAKA,CAAC;EAAEC,SAAS;EAAEC,KAAK;EAAE,GAAGC;AAAY,CAAC,EAAE;EAC1D,oBACEJ,IAAA,CAACF,IAAI;IACHO,aAAa,EAAE,CAAE;IAAA,GACbD,IAAI;IACRD,KAAK,EAAE,CAACG,MAAM,CAACC,KAAK,EAAEL,SAAS,IAAI,IAAI,IAAI;MAAEM,KAAK,EAAEN;IAAU,CAAC,EAAEC,KAAK;EAAE,CACzE,CAAC;AAEN;AAEA,MAAMG,MAAM,GAAGT,UAAU,CAACY,MAAM,CAAC;EAC/BF,KAAK,EAAE;IACLG,SAAS,EAAE,QAAQ;IACnBC,eAAe,EAAE;EACnB;AACF,CAAC,CAAC","ignoreList":[]}

View File

@@ -0,0 +1,6 @@
"use strict";
export function getLabel(options, fallback) {
return options.label !== undefined ? options.label : options.title !== undefined ? options.title : fallback;
}
//# sourceMappingURL=getLabel.js.map

View File

@@ -0,0 +1 @@
{"version":3,"names":["getLabel","options","fallback","label","undefined","title"],"sourceRoot":"../../../src","sources":["Label/getLabel.tsx"],"mappings":";;AAAA,OAAO,SAASA,QAAQA,CACtBC,OAA2C,EAC3CC,QAAgB,EACR;EACR,OAAOD,OAAO,CAACE,KAAK,KAAKC,SAAS,GAC9BH,OAAO,CAACE,KAAK,GACbF,OAAO,CAACI,KAAK,KAAKD,SAAS,GACzBH,OAAO,CAACI,KAAK,GACbH,QAAQ;AAChB","ignoreList":[]}

View File

@@ -0,0 +1,42 @@
"use strict";
import * as React from 'react';
/**
* Render content lazily based on visibility.
*
* When enabled:
* - If content is visible, it will render immediately
* - If content is not visible, it won't render until it becomes visible
*
* Otherwise:
* - If content is visible, it will render immediately
* - If content is not visible, it will defer rendering until idle
*
* Once rendered, the content remains rendered.
*/
export function Lazy({
enabled,
visible,
children
}) {
const [rendered, setRendered] = React.useState(enabled ? visible : false);
const shouldRenderInIdle = !(enabled || visible || rendered);
React.useEffect(() => {
if (shouldRenderInIdle === false) {
return;
}
const id = requestIdleCallback(() => {
setRendered(true);
});
return () => cancelIdleCallback(id);
}, [shouldRenderInIdle]);
if (visible && rendered === false) {
setRendered(true);
return children;
}
if (rendered) {
return children;
}
return null;
}
//# sourceMappingURL=Lazy.js.map

View File

@@ -0,0 +1 @@
{"version":3,"names":["React","Lazy","enabled","visible","children","rendered","setRendered","useState","shouldRenderInIdle","useEffect","id","requestIdleCallback","cancelIdleCallback"],"sourceRoot":"../../src","sources":["Lazy.tsx"],"mappings":";;AAAA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAiB9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,IAAIA,CAAC;EAAEC,OAAO;EAAEC,OAAO;EAAEC;AAAgB,CAAC,EAAE;EAC1D,MAAM,CAACC,QAAQ,EAAEC,WAAW,CAAC,GAAGN,KAAK,CAACO,QAAQ,CAACL,OAAO,GAAGC,OAAO,GAAG,KAAK,CAAC;EAEzE,MAAMK,kBAAkB,GAAG,EAAEN,OAAO,IAAIC,OAAO,IAAIE,QAAQ,CAAC;EAE5DL,KAAK,CAACS,SAAS,CAAC,MAAM;IACpB,IAAID,kBAAkB,KAAK,KAAK,EAAE;MAChC;IACF;IAEA,MAAME,EAAE,GAAGC,mBAAmB,CAAC,MAAM;MACnCL,WAAW,CAAC,IAAI,CAAC;IACnB,CAAC,CAAC;IAEF,OAAO,MAAMM,kBAAkB,CAACF,EAAE,CAAC;EACrC,CAAC,EAAE,CAACF,kBAAkB,CAAC,CAAC;EAExB,IAAIL,OAAO,IAAIE,QAAQ,KAAK,KAAK,EAAE;IACjCC,WAAW,CAAC,IAAI,CAAC;IAEjB,OAAOF,QAAQ;EACjB;EAEA,IAAIC,QAAQ,EAAE;IACZ,OAAOD,QAAQ;EACjB;EAEA,OAAO,IAAI;AACb","ignoreList":[]}

View File

@@ -0,0 +1,4 @@
"use strict";
export { MaskedView } from "./MaskedViewNative.js";
//# sourceMappingURL=MaskedView.android.js.map

View File

@@ -0,0 +1 @@
{"version":3,"names":["MaskedView"],"sourceRoot":"../../src","sources":["MaskedView.android.tsx"],"mappings":";;AAAA,SAASA,UAAU,QAAQ,uBAAoB","ignoreList":[]}

View File

@@ -0,0 +1,4 @@
"use strict";
export { MaskedView } from "./MaskedViewNative.js";
//# sourceMappingURL=MaskedView.ios.js.map

View File

@@ -0,0 +1 @@
{"version":3,"names":["MaskedView"],"sourceRoot":"../../src","sources":["MaskedView.ios.tsx"],"mappings":";;AAAA,SAASA,UAAU,QAAQ,uBAAoB","ignoreList":[]}

View File

@@ -0,0 +1,12 @@
"use strict";
/**
* Use a stub for MaskedView on all Platforms that don't support it.
*/
export function MaskedView({
children
}) {
return children;
}
//# sourceMappingURL=MaskedView.js.map

View File

@@ -0,0 +1 @@
{"version":3,"names":["MaskedView","children"],"sourceRoot":"../../src","sources":["MaskedView.tsx"],"mappings":";;AAAA;AACA;AACA;;AAQA,OAAO,SAASA,UAAUA,CAAC;EAAEC;AAAgB,CAAC,EAAE;EAC9C,OAAOA,QAAQ;AACjB","ignoreList":[]}

View File

@@ -0,0 +1,30 @@
"use strict";
/**
* The native MaskedView that we explicitly re-export for supported platforms: Android, iOS.
*/
import * as React from 'react';
import { UIManager } from 'react-native';
import { jsx as _jsx } from "react/jsx-runtime";
let RNCMaskedView;
try {
// Add try/catch to support usage even if it's not installed, since it's optional.
// Newer versions of Metro will handle it properly.
RNCMaskedView = require('@react-native-masked-view/masked-view').default;
} catch (e) {
// Ignore
}
const isMaskedViewAvailable = UIManager.getViewManagerConfig('RNCMaskedView') != null;
export function MaskedView({
children,
...rest
}) {
if (isMaskedViewAvailable && RNCMaskedView) {
return /*#__PURE__*/_jsx(RNCMaskedView, {
...rest,
children: children
});
}
return children;
}
//# sourceMappingURL=MaskedViewNative.js.map

View File

@@ -0,0 +1 @@
{"version":3,"names":["React","UIManager","jsx","_jsx","RNCMaskedView","require","default","e","isMaskedViewAvailable","getViewManagerConfig","MaskedView","children","rest"],"sourceRoot":"../../src","sources":["MaskedViewNative.tsx"],"mappings":";;AAAA;AACA;AACA;AACA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAC9B,SAASC,SAAS,QAAQ,cAAc;AAAC,SAAAC,GAAA,IAAAC,IAAA;AASzC,IAAIC,aAAyC;AAE7C,IAAI;EACF;EACA;EACAA,aAAa,GAAGC,OAAO,CAAC,uCAAuC,CAAC,CAACC,OAAO;AAC1E,CAAC,CAAC,OAAOC,CAAC,EAAE;EACV;AAAA;AAGF,MAAMC,qBAAqB,GACzBP,SAAS,CAACQ,oBAAoB,CAAC,eAAe,CAAC,IAAI,IAAI;AAEzD,OAAO,SAASC,UAAUA,CAAC;EAAEC,QAAQ;EAAE,GAAGC;AAAY,CAAC,EAAE;EACvD,IAAIJ,qBAAqB,IAAIJ,aAAa,EAAE;IAC1C,oBAAOD,IAAA,CAACC,aAAa;MAAA,GAAKQ,IAAI;MAAAD,QAAA,EAAGA;IAAQ,CAAgB,CAAC;EAC5D;EAEA,OAAOA,QAAQ;AACjB","ignoreList":[]}

View File

@@ -0,0 +1,24 @@
"use strict";
import { StyleSheet } from 'react-native';
import { Text } from "./Text.js";
import { jsx as _jsx } from "react/jsx-runtime";
export function MissingIcon({
color,
size,
style
}) {
return /*#__PURE__*/_jsx(Text, {
style: [styles.icon, {
color,
fontSize: size
}, style],
children: "\u23F7"
});
}
const styles = StyleSheet.create({
icon: {
backgroundColor: 'transparent'
}
});
//# sourceMappingURL=MissingIcon.js.map

View File

@@ -0,0 +1 @@
{"version":3,"names":["StyleSheet","Text","jsx","_jsx","MissingIcon","color","size","style","styles","icon","fontSize","children","create","backgroundColor"],"sourceRoot":"../../src","sources":["MissingIcon.tsx"],"mappings":";;AAAA,SAAyBA,UAAU,QAAwB,cAAc;AAEzE,SAASC,IAAI,QAAQ,WAAQ;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAQ9B,OAAO,SAASC,WAAWA,CAAC;EAAEC,KAAK;EAAEC,IAAI;EAAEC;AAAa,CAAC,EAAE;EACzD,oBAAOJ,IAAA,CAACF,IAAI;IAACM,KAAK,EAAE,CAACC,MAAM,CAACC,IAAI,EAAE;MAAEJ,KAAK;MAAEK,QAAQ,EAAEJ;IAAK,CAAC,EAAEC,KAAK,CAAE;IAAAI,QAAA,EAAC;EAAC,CAAM,CAAC;AAC/E;AAEA,MAAMH,MAAM,GAAGR,UAAU,CAACY,MAAM,CAAC;EAC/BH,IAAI,EAAE;IACJI,eAAe,EAAE;EACnB;AACF,CAAC,CAAC","ignoreList":[]}

View File

@@ -0,0 +1,145 @@
"use strict";
import { useTheme } from '@react-navigation/native';
import * as React from 'react';
import { Animated, Easing, Platform, Pressable } from 'react-native';
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
const AnimatedPressable = Animated.createAnimatedComponent(Pressable);
const ANDROID_VERSION_LOLLIPOP = 21;
const ANDROID_SUPPORTS_RIPPLE = Platform.OS === 'android' && Platform.Version >= ANDROID_VERSION_LOLLIPOP;
const useNativeDriver = Platform.OS !== 'web';
/**
* PlatformPressable provides an abstraction on top of Pressable to handle platform differences.
*/
function PlatformPressableInternal({
disabled,
onPress,
onPressIn,
onPressOut,
android_ripple,
pressColor,
pressOpacity = 0.3,
hoverEffect,
style,
children,
...rest
}, ref) {
const {
dark
} = useTheme();
const [opacity] = React.useState(() => new Animated.Value(1));
const animateTo = (toValue, duration) => {
if (ANDROID_SUPPORTS_RIPPLE) {
return;
}
Animated.timing(opacity, {
toValue,
duration,
easing: Easing.inOut(Easing.quad),
useNativeDriver
}).start();
};
const handlePress = e => {
if (Platform.OS === 'web' && rest.href !== null) {
// ignore clicks with modifier keys
const hasModifierKey = 'metaKey' in e && e.metaKey || 'altKey' in e && e.altKey || 'ctrlKey' in e && e.ctrlKey || 'shiftKey' in e && e.shiftKey;
// only handle left clicks
const isLeftClick = 'button' in e ? e.button == null || e.button === 0 : true;
// let browser handle "target=_blank" etc.
const isSelfTarget = e.currentTarget && 'target' in e.currentTarget ? [undefined, null, '', 'self'].includes(e.currentTarget.target) : true;
if (!hasModifierKey && isLeftClick && isSelfTarget) {
e.preventDefault();
// call `onPress` only when browser default is prevented
// this prevents app from handling the click when a link is being opened
onPress?.(e);
}
} else {
onPress?.(e);
}
};
const handlePressIn = e => {
animateTo(pressOpacity, 0);
onPressIn?.(e);
};
const handlePressOut = e => {
animateTo(1, 200);
onPressOut?.(e);
};
return /*#__PURE__*/_jsxs(AnimatedPressable, {
ref: ref,
accessible: true,
role: Platform.OS === 'web' && rest.href != null ? 'link' : 'button',
onPress: disabled ? undefined : handlePress,
onPressIn: disabled ? undefined : handlePressIn,
onPressOut: disabled ? undefined : handlePressOut,
android_ripple: ANDROID_SUPPORTS_RIPPLE && !disabled ? {
color: pressColor !== undefined ? pressColor : dark ? 'rgba(255, 255, 255, .32)' : 'rgba(0, 0, 0, .32)',
...android_ripple
} : undefined,
style: [{
cursor: (Platform.OS === 'web' || Platform.OS === 'ios') && !disabled ?
// Pointer cursor on web
// Hover effect on iPad and visionOS
'pointer' : 'auto',
opacity: !ANDROID_SUPPORTS_RIPPLE && !disabled ? opacity : 1
}, style],
...rest,
children: [!disabled ? /*#__PURE__*/_jsx(HoverEffect, {
...hoverEffect
}) : null, children]
});
}
export const PlatformPressable = /*#__PURE__*/React.forwardRef(PlatformPressableInternal);
PlatformPressable.displayName = 'PlatformPressable';
const css = String.raw;
const CLASS_NAME = `__react-navigation_elements_Pressable_hover`;
const CSS_TEXT = css`
.${CLASS_NAME} {
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
border-radius: inherit;
background-color: var(--overlay-color);
opacity: 0;
transition: opacity 0.15s;
pointer-events: none;
}
a:hover > .${CLASS_NAME}, button:hover > .${CLASS_NAME} {
opacity: var(--overlay-hover-opacity);
}
a:active > .${CLASS_NAME}, button:active > .${CLASS_NAME} {
opacity: var(--overlay-active-opacity);
}
`;
const HoverEffect = ({
color,
hoverOpacity = 0.08,
activeOpacity = 0.16
}) => {
if (Platform.OS !== 'web' || color == null) {
return null;
}
return /*#__PURE__*/_jsxs(_Fragment, {
children: [/*#__PURE__*/_jsx("style", {
href: CLASS_NAME,
precedence: "elements",
children: CSS_TEXT
}), /*#__PURE__*/_jsx("div", {
className: CLASS_NAME,
style: {
// @ts-expect-error: CSS variables are not typed
'--overlay-color': color,
'--overlay-hover-opacity': hoverOpacity,
'--overlay-active-opacity': activeOpacity
}
})]
});
};
//# sourceMappingURL=PlatformPressable.js.map

View File

@@ -0,0 +1 @@
{"version":3,"names":["useTheme","React","Animated","Easing","Platform","Pressable","jsx","_jsx","jsxs","_jsxs","Fragment","_Fragment","AnimatedPressable","createAnimatedComponent","ANDROID_VERSION_LOLLIPOP","ANDROID_SUPPORTS_RIPPLE","OS","Version","useNativeDriver","PlatformPressableInternal","disabled","onPress","onPressIn","onPressOut","android_ripple","pressColor","pressOpacity","hoverEffect","style","children","rest","ref","dark","opacity","useState","Value","animateTo","toValue","duration","timing","easing","inOut","quad","start","handlePress","e","href","hasModifierKey","metaKey","altKey","ctrlKey","shiftKey","isLeftClick","button","isSelfTarget","currentTarget","undefined","includes","target","preventDefault","handlePressIn","handlePressOut","accessible","role","color","cursor","HoverEffect","PlatformPressable","forwardRef","displayName","css","String","raw","CLASS_NAME","CSS_TEXT","hoverOpacity","activeOpacity","precedence","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U;AACf;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAeA,UAAU,qBAAqBA,UAAU;AACxD;AACA;AACA;AACA,gBAAgBA,UAAU,sBAAsBA,UAAU;AAC1D;AACA;AACA,CAAC;AAED,MAAMP,WAAW,GAAGA,CAAC;EACnBF,KAAK;EACLW,YAAY,GAAG,IAAI;EACnBC,aAAa,GAAG;AACA,CAAC,KAAK;EACtB,IAAIxE,QAAQ,CAACY,EAAE,KAAK,KAAK,IAAIgD,KAAK,IAAI,IAAI,EAAE;IAC1C,OAAO,IAAI;EACb;EAEA,oBACEvD,KAAA,CAAAE,SAAA;IAAAkB,QAAA,gBACEtB,IAAA;MAAOuC,IAAI,EAAE2B,UAAW;MAACI,UAAU,EAAC,UAAU;MAAAhD,QAAA,EAC3C6C;IAAQ,CACJ,CAAC,eACRnE,IAAA;MACEuE,SAAS,EAAEL,UAAW;MACtB7C,KAAK,EAAE;QACL;QACA,iBAAiB,EAAEoC,KAAK;QACxB,yBAAyB,EAAEW,YAAY;QACvC,0BAA0B,EAAEC;MAC9B;IAAE,CACH,CAAC;EAAA,CACF,CAAC;AAEP,CAAC","ignoreList":[]}

View File

@@ -0,0 +1,57 @@
"use strict";
import * as React from 'react';
import { Platform, StyleSheet, View } from 'react-native';
import { jsx as _jsx } from "react/jsx-runtime";
const FAR_FAR_AWAY = 30000; // this should be big enough to move the whole view out of its container
export function ResourceSavingView({
visible,
children,
style,
...rest
}) {
if (Platform.OS === 'web') {
return /*#__PURE__*/_jsx(View
// @ts-expect-error: hidden exists on web, but not in React Native
, {
hidden: !visible,
style: [{
display: visible ? 'flex' : 'none'
}, styles.container, style],
pointerEvents: visible ? 'auto' : 'none',
...rest,
children: children
});
}
return /*#__PURE__*/_jsx(View, {
style: [styles.container, style]
// box-none doesn't seem to work properly on Android
,
pointerEvents: visible ? 'auto' : 'none',
children: /*#__PURE__*/_jsx(View, {
collapsable: false,
removeClippedSubviews:
// On iOS & macOS, set removeClippedSubviews to true only when not focused
// This is an workaround for a bug where the clipped view never re-appears
Platform.OS === 'ios' || Platform.OS === 'macos' ? !visible : true,
pointerEvents: visible ? 'auto' : 'none',
style: visible ? styles.attached : styles.detached,
children: children
})
});
}
const styles = StyleSheet.create({
container: {
flex: 1,
overflow: 'hidden'
},
attached: {
flex: 1
},
detached: {
flex: 1,
top: FAR_FAR_AWAY
}
});
//# sourceMappingURL=ResourceSavingView.js.map

View File

@@ -0,0 +1 @@
{"version":3,"names":["React","Platform","StyleSheet","View","jsx","_jsx","FAR_FAR_AWAY","ResourceSavingView","visible","children","style","rest","OS","hidden","display","styles","container","pointerEvents","collapsable","removeClippedSubviews","attached","detached","create","flex","overflow","top"],"sourceRoot":"../../src","sources":["ResourceSavingView.tsx"],"mappings":";;AAAA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAC9B,SACEC,QAAQ,EAERC,UAAU,EACVC,IAAI,QAEC,cAAc;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAQtB,MAAMC,YAAY,GAAG,KAAK,CAAC,CAAC;;AAE5B,OAAO,SAASC,kBAAkBA,CAAC;EACjCC,OAAO;EACPC,QAAQ;EACRC,KAAK;EACL,GAAGC;AACE,CAAC,EAAE;EACR,IAAIV,QAAQ,CAACW,EAAE,KAAK,KAAK,EAAE;IACzB,oBACEP,IAAA,CAACF;IACC;IAAA;MACAU,MAAM,EAAE,CAACL,OAAQ;MACjBE,KAAK,EAAE,CACL;QAAEI,OAAO,EAAEN,OAAO,GAAG,MAAM,GAAG;MAAO,CAAC,EACtCO,MAAM,CAACC,SAAS,EAChBN,KAAK,CACL;MACFO,aAAa,EAAET,OAAO,GAAG,MAAM,GAAG,MAAO;MAAA,GACrCG,IAAI;MAAAF,QAAA,EAEPA;IAAQ,CACL,CAAC;EAEX;EAEA,oBACEJ,IAAA,CAACF,IAAI;IACHO,KAAK,EAAE,CAACK,MAAM,CAACC,SAAS,EAAEN,KAAK;IAC/B;IAAA;IACAO,aAAa,EAAET,OAAO,GAAG,MAAM,GAAG,MAAO;IAAAC,QAAA,eAEzCJ,IAAA,CAACF,IAAI;MACHe,WAAW,EAAE,KAAM;MACnBC,qBAAqB;MACnB;MACA;MACAlB,QAAQ,CAACW,EAAE,KAAK,KAAK,IAAIX,QAAQ,CAACW,EAAE,KAAK,OAAO,GAAG,CAACJ,OAAO,GAAG,IAC/D;MACDS,aAAa,EAAET,OAAO,GAAG,MAAM,GAAG,MAAO;MACzCE,KAAK,EAAEF,OAAO,GAAGO,MAAM,CAACK,QAAQ,GAAGL,MAAM,CAACM,QAAS;MAAAZ,QAAA,EAElDA;IAAQ,CACL;EAAC,CACH,CAAC;AAEX;AAEA,MAAMM,MAAM,GAAGb,UAAU,CAACoB,MAAM,CAAC;EAC/BN,SAAS,EAAE;IACTO,IAAI,EAAE,CAAC;IACPC,QAAQ,EAAE;EACZ,CAAC;EACDJ,QAAQ,EAAE;IACRG,IAAI,EAAE;EACR,CAAC;EACDF,QAAQ,EAAE;IACRE,IAAI,EAAE,CAAC;IACPE,GAAG,EAAEnB;EACP;AACF,CAAC,CAAC","ignoreList":[]}

View File

@@ -0,0 +1,70 @@
"use strict";
import * as React from 'react';
import { Dimensions, Platform, StyleSheet, View } from 'react-native';
import { initialWindowMetrics, SafeAreaInsetsContext, SafeAreaProvider } from 'react-native-safe-area-context';
import { FrameSizeProvider } from "./useFrameSize.js";
import { jsx as _jsx } from "react/jsx-runtime";
const {
width = 0,
height = 0
} = Dimensions.get('window');
// To support SSR on web, we need to have empty insets for initial values
// Otherwise there can be mismatch between SSR and client output
// We also need to specify empty values to support tests environments
const initialMetrics = Platform.OS === 'web' || initialWindowMetrics == null ? {
frame: {
x: 0,
y: 0,
width,
height
},
insets: {
top: 0,
left: 0,
right: 0,
bottom: 0
}
} : initialWindowMetrics;
export function SafeAreaProviderCompat({
children,
style
}) {
const insets = React.useContext(SafeAreaInsetsContext);
return /*#__PURE__*/_jsx(FrameSizeProvider, {
initialFrame: initialMetrics.frame,
render: ({
ref,
onLayout
}) => {
if (insets) {
// If we already have insets, don't wrap the stack in another safe area provider
// This avoids an issue with updates at the cost of potentially incorrect values
// https://github.com/react-navigation/react-navigation/issues/174
return /*#__PURE__*/_jsx(View, {
ref: ref,
onLayout: onLayout,
style: [styles.container, style],
children: children
});
}
// SafeAreaProvider doesn't forward ref
// So we only pass onLayout to it
return /*#__PURE__*/_jsx(SafeAreaProvider, {
initialMetrics: initialMetrics,
style: style,
onLayout: onLayout,
children: children
});
}
});
}
SafeAreaProviderCompat.initialMetrics = initialMetrics;
const styles = StyleSheet.create({
container: {
flex: 1
}
});
//# sourceMappingURL=SafeAreaProviderCompat.js.map

View File

@@ -0,0 +1 @@
{"version":3,"names":["React","Dimensions","Platform","StyleSheet","View","initialWindowMetrics","SafeAreaInsetsContext","SafeAreaProvider","FrameSizeProvider","jsx","_jsx","width","height","get","initialMetrics","OS","frame","x","y","insets","top","left","right","bottom","SafeAreaProviderCompat","children","style","useContext","initialFrame","render","ref","onLayout","styles","container","create","flex"],"sourceRoot":"../../src","sources":["SafeAreaProviderCompat.tsx"],"mappings":";;AAAA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAC9B,SACEC,UAAU,EACVC,QAAQ,EAERC,UAAU,EACVC,IAAI,QAEC,cAAc;AACrB,SACEC,oBAAoB,EACpBC,qBAAqB,EACrBC,gBAAgB,QACX,gCAAgC;AAEvC,SAASC,iBAAiB,QAAQ,mBAAgB;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAOnD,MAAM;EAAEC,KAAK,GAAG,CAAC;EAAEC,MAAM,GAAG;AAAE,CAAC,GAAGX,UAAU,CAACY,GAAG,CAAC,QAAQ,CAAC;;AAE1D;AACA;AACA;AACA,MAAMC,cAAc,GAClBZ,QAAQ,CAACa,EAAE,KAAK,KAAK,IAAIV,oBAAoB,IAAI,IAAI,GACjD;EACEW,KAAK,EAAE;IAAEC,CAAC,EAAE,CAAC;IAAEC,CAAC,EAAE,CAAC;IAAEP,KAAK;IAAEC;EAAO,CAAC;EACpCO,MAAM,EAAE;IAAEC,GAAG,EAAE,CAAC;IAAEC,IAAI,EAAE,CAAC;IAAEC,KAAK,EAAE,CAAC;IAAEC,MAAM,EAAE;EAAE;AACjD,CAAC,GACDlB,oBAAoB;AAE1B,OAAO,SAASmB,sBAAsBA,CAAC;EAAEC,QAAQ;EAAEC;AAAa,CAAC,EAAE;EACjE,MAAMP,MAAM,GAAGnB,KAAK,CAAC2B,UAAU,CAACrB,qBAAqB,CAAC;EAEtD,oBACEI,IAAA,CAACF,iBAAiB;IAChBoB,YAAY,EAAEd,cAAc,CAACE,KAAM;IACnCa,MAAM,EAAEA,CAAC;MAAEC,GAAG;MAAEC;IAAS,CAAC,KAAK;MAC7B,IAAIZ,MAAM,EAAE;QACV;QACA;QACA;QACA,oBACET,IAAA,CAACN,IAAI;UACH0B,GAAG,EAAEA,GAAI;UACTC,QAAQ,EAAEA,QAAS;UACnBL,KAAK,EAAE,CAACM,MAAM,CAACC,SAAS,EAAEP,KAAK,CAAE;UAAAD,QAAA,EAEhCA;QAAQ,CACL,CAAC;MAEX;;MAEA;MACA;MACA,oBACEf,IAAA,CAACH,gBAAgB;QACfO,cAAc,EAAEA,cAAe;QAC/BY,KAAK,EAAEA,KAAM;QACbK,QAAQ,EAAEA,QAAS;QAAAN,QAAA,EAElBA;MAAQ,CACO,CAAC;IAEvB;EAAE,CACH,CAAC;AAEN;AAEAD,sBAAsB,CAACV,cAAc,GAAGA,cAAc;AAEtD,MAAMkB,MAAM,GAAG7B,UAAU,CAAC+B,MAAM,CAAC;EAC/BD,SAAS,EAAE;IACTE,IAAI,EAAE;EACR;AACF,CAAC,CAAC","ignoreList":[]}

View File

@@ -0,0 +1,88 @@
"use strict";
import { NavigationProvider } from '@react-navigation/native';
import * as React from 'react';
import { StyleSheet, View } from 'react-native';
import { useSafeAreaInsets } from 'react-native-safe-area-context';
import { Background } from "./Background.js";
import { getDefaultHeaderHeight } from "./Header/getDefaultHeaderHeight.js";
import { HeaderHeightContext } from "./Header/HeaderHeightContext.js";
import { HeaderShownContext } from "./Header/HeaderShownContext.js";
import { useFrameSize } from "./useFrameSize.js";
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
export function Screen(props) {
const insets = useSafeAreaInsets();
const isParentHeaderShown = React.useContext(HeaderShownContext);
const parentHeaderHeight = React.useContext(HeaderHeightContext);
const {
focused,
modal = false,
header,
headerShown = true,
headerTransparent,
headerStatusBarHeight = isParentHeaderShown ? 0 : insets.top,
navigation,
route,
children,
style
} = props;
const defaultHeaderHeight = useFrameSize(size => getDefaultHeaderHeight(size, modal, headerStatusBarHeight));
const headerRef = React.useRef(null);
const [headerHeight, setHeaderHeight] = React.useState(defaultHeaderHeight);
React.useLayoutEffect(() => {
headerRef.current?.measure((_x, _y, _width, height) => {
setHeaderHeight(height);
});
}, [route.name]);
return /*#__PURE__*/_jsxs(Background, {
"aria-hidden": !focused,
style: [styles.container, style]
// On Fabric we need to disable collapsing for the background to ensure
// that we won't render unnecessary views due to the view flattening.
,
collapsable: false,
children: [headerShown ? /*#__PURE__*/_jsx(NavigationProvider, {
route: route,
navigation: navigation,
children: /*#__PURE__*/_jsx(View, {
ref: headerRef,
pointerEvents: "box-none",
onLayout: e => {
const {
height
} = e.nativeEvent.layout;
setHeaderHeight(height);
},
style: [styles.header, headerTransparent ? styles.absolute : null],
children: header
})
}) : null, /*#__PURE__*/_jsx(View, {
style: styles.content,
children: /*#__PURE__*/_jsx(HeaderShownContext.Provider, {
value: isParentHeaderShown || headerShown !== false,
children: /*#__PURE__*/_jsx(HeaderHeightContext.Provider, {
value: headerShown ? headerHeight : parentHeaderHeight ?? 0,
children: children
})
})
})]
});
}
const styles = StyleSheet.create({
container: {
flex: 1
},
content: {
flex: 1
},
header: {
zIndex: 1
},
absolute: {
position: 'absolute',
top: 0,
start: 0,
end: 0
}
});
//# sourceMappingURL=Screen.js.map

View File

@@ -0,0 +1 @@
{"version":3,"names":["NavigationProvider","React","StyleSheet","View","useSafeAreaInsets","Background","getDefaultHeaderHeight","HeaderHeightContext","HeaderShownContext","useFrameSize","jsx","_jsx","jsxs","_jsxs","Screen","props","insets","isParentHeaderShown","useContext","parentHeaderHeight","focused","modal","header","headerShown","headerTransparent","headerStatusBarHeight","top","navigation","route","children","style","defaultHeaderHeight","size","headerRef","useRef","headerHeight","setHeaderHeight","useState","useLayoutEffect","current","measure","_x","_y","_width","height","name","styles","container","collapsable","ref","pointerEvents","onLayout","e","nativeEvent","layout","absolute","content","Provider","value","create","flex","zIndex","position","start","end"],"sourceRoot":"../../src","sources":["Screen.tsx"],"mappings":";;AAAA,SAEEA,kBAAkB,QAGb,0BAA0B;AACjC,OAAO,KAAKC,KAAK,MAAM,OAAO;AAC9B,SAGEC,UAAU,EACVC,IAAI,QAEC,cAAc;AACrB,SAASC,iBAAiB,QAAQ,gCAAgC;AAElE,SAASC,UAAU,QAAQ,iBAAc;AACzC,SAASC,sBAAsB,QAAQ,oCAAiC;AACxE,SAASC,mBAAmB,QAAQ,iCAA8B;AAClE,SAASC,kBAAkB,QAAQ,gCAA6B;AAChE,SAASC,YAAY,QAAQ,mBAAgB;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAe9C,OAAO,SAASC,MAAMA,CAACC,KAAY,EAAE;EACnC,MAAMC,MAAM,GAAGZ,iBAAiB,CAAC,CAAC;EAElC,MAAMa,mBAAmB,GAAGhB,KAAK,CAACiB,UAAU,CAACV,kBAAkB,CAAC;EAChE,MAAMW,kBAAkB,GAAGlB,KAAK,CAACiB,UAAU,CAACX,mBAAmB,CAAC;EAEhE,MAAM;IACJa,OAAO;IACPC,KAAK,GAAG,KAAK;IACbC,MAAM;IACNC,WAAW,GAAG,IAAI;IAClBC,iBAAiB;IACjBC,qBAAqB,GAAGR,mBAAmB,GAAG,CAAC,GAAGD,MAAM,CAACU,GAAG;IAC5DC,UAAU;IACVC,KAAK;IACLC,QAAQ;IACRC;EACF,CAAC,GAAGf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AACR,IAAI;MAAC2B,KAAK,EAAEgB,MAAM,CAACU,OAAQ;MAAA3B,QAAA,eAC1BlB,IAAA,CAACH,kBAAkB,CAACiD,QAAQ;QAC1BC,KAAK,EAAEzC,mBAAmB,IAAIM,WAAW,KAAK,KAAM;QAAAM,QAAA,eAEpDlB,IAAA,CAACJ,mBAAmB,CAACkD,QAAQ;UAC3BC,KAAK,EAAEnC,WAAW,GAAGY,YAAY,GAAIhB,kBAAkB,IAAI,CAAG;UAAAU,QAAA,EAE7DA;QAAQ,CACmB;MAAC,CACJ;IAAC,CAC1B,CAAC;EAAA,CACG,CAAC;AAEjB;AAEA,MAAMiB,MAAM,GAAG5C,UAAU,CAACyD,MAAM,CAAC;EAC/BZ,SAAS,EAAE;IACTa,IAAI,EAAE;EACR,CAAC;EACDJ,OAAO,EAAE;IACPI,IAAI,EAAE;EACR,CAAC;EACDtC,MAAM,EAAE;IACNuC,MAAM,EAAE;EACV,CAAC;EACDN,QAAQ,EAAE;IACRO,QAAQ,EAAE,UAAU;IACpBpC,GAAG,EAAE,CAAC;IACNqC,KAAK,EAAE,CAAC;IACRC,GAAG,EAAE;EACP;AACF,CAAC,CAAC","ignoreList":[]}

View File

@@ -0,0 +1,22 @@
"use strict";
import { useTheme } from '@react-navigation/native';
// eslint-disable-next-line no-restricted-imports
import { Text as NativeText } from 'react-native';
import { jsx as _jsx } from "react/jsx-runtime";
export function Text({
style,
...rest
}) {
const {
colors,
fonts
} = useTheme();
return /*#__PURE__*/_jsx(NativeText, {
...rest,
style: [{
color: colors.text
}, fonts.regular, style]
});
}
//# sourceMappingURL=Text.js.map

View File

@@ -0,0 +1 @@
{"version":3,"names":["useTheme","Text","NativeText","jsx","_jsx","style","rest","colors","fonts","color","text","regular"],"sourceRoot":"../../src","sources":["Text.tsx"],"mappings":";;AAAA,SAASA,QAAQ,QAAQ,0BAA0B;AACnD;AACA,SAASC,IAAI,IAAIC,UAAU,QAAwB,cAAc;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAElE,OAAO,SAASH,IAAIA,CAAC;EAAEI,KAAK;EAAE,GAAGC;AAAgB,CAAC,EAAE;EAClD,MAAM;IAAEC,MAAM;IAAEC;EAAM,CAAC,GAAGR,QAAQ,CAAC,CAAC;EAEpC,oBACEI,IAAA,CAACF,UAAU;IAAA,GACLI,IAAI;IACRD,KAAK,EAAE,CAAC;MAAEI,KAAK,EAAEF,MAAM,CAACG;IAAK,CAAC,EAAEF,KAAK,CAACG,OAAO,EAAEN,KAAK;EAAE,CACvD,CAAC;AAEN","ignoreList":[]}

Binary file not shown.

After

Width:  |  Height:  |  Size: 653 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 207 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 100 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 290 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 134 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 405 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 167 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 761 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 207 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 809 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 645 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 220 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 334 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 502 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 645 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 332 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 141 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 201 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 266 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 332 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 928 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 258 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 317 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 483 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 589 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 728 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 839 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 928 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 589 B

View File

@@ -0,0 +1,18 @@
"use strict";
const APPROX_APP_BAR_HEIGHT = 56;
const DEFAULT_DRAWER_WIDTH = 360;
export const getDefaultSidebarWidth = ({
width
}) => {
/**
* Default sidebar width is 360dp
* On screens smaller than 320dp, ideally the drawer would collapse to a tab bar
* https://m3.material.io/components/navigation-drawer/specs
*/
if (width - APPROX_APP_BAR_HEIGHT <= 360) {
return width - APPROX_APP_BAR_HEIGHT;
}
return DEFAULT_DRAWER_WIDTH;
};
//# sourceMappingURL=getDefaultSidebarWidth.js.map

View File

@@ -0,0 +1 @@
{"version":3,"names":["APPROX_APP_BAR_HEIGHT","DEFAULT_DRAWER_WIDTH","getDefaultSidebarWidth","width"],"sourceRoot":"../../src","sources":["getDefaultSidebarWidth.tsx"],"mappings":";;AAAA,MAAMA,qBAAqB,GAAG,EAAE;AAChC,MAAMC,oBAAoB,GAAG,GAAG;AAEhC,OAAO,MAAMC,sBAAsB,GAAGA,CAAC;EAAEC;AAAyB,CAAC,KAAK;EACtE;AACF;AACA;AACA;AACA;EACE,IAAIA,KAAK,GAAGH,qBAAqB,IAAI,GAAG,EAAE;IACxC,OAAOG,KAAK,GAAGH,qBAAqB;EACtC;EAEA,OAAOC,oBAAoB;AAC7B,CAAC","ignoreList":[]}

View File

@@ -0,0 +1,17 @@
"use strict";
import * as React from 'react';
const contexts = '__react_navigation__elements_contexts';
// We use a global variable to keep our contexts so that we can reuse same contexts across packages
globalThis[contexts] = globalThis[contexts] ?? new Map();
export function getNamedContext(name, initialValue) {
let context = globalThis[contexts].get(name);
if (context) {
return context;
}
context = /*#__PURE__*/React.createContext(initialValue);
context.displayName = name;
globalThis[contexts].set(name, context);
return context;
}
//# sourceMappingURL=getNamedContext.js.map

View File

@@ -0,0 +1 @@
{"version":3,"names":["React","contexts","globalThis","Map","getNamedContext","name","initialValue","context","get","createContext","displayName","set"],"sourceRoot":"../../src","sources":["getNamedContext.tsx"],"mappings":";;AAAA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAE9B,MAAMC,QAAQ,GAAG,uCAAuC;AAMxD;AACAC,UAAU,CAACD,QAAQ,CAAC,GAClBC,UAAU,CAACD,QAAQ,CAAC,IAAI,IAAIE,GAAG,CAA6B,CAAC;AAE/D,OAAO,SAASC,eAAeA,CAC7BC,IAAY,EACZC,YAAe,EACG;EAClB,IAAIC,OAAO,GAAGL,UAAU,CAACD,QAAQ,CAAC,CAACO,GAAG,CAACH,IAAI,CAAC;EAE5C,IAAIE,OAAO,EAAE;IACX,OAAOA,OAAO;EAChB;EAEAA,OAAO,gBAAGP,KAAK,CAACS,aAAa,CAAIH,YAAY,CAAC;EAC9CC,OAAO,CAACG,WAAW,GAAGL,IAAI;EAE1BH,UAAU,CAACD,QAAQ,CAAC,CAACU,GAAG,CAACN,IAAI,EAAEE,OAAO,CAAC;EAEvC,OAAOA,OAAO;AAChB","ignoreList":[]}

View File

@@ -0,0 +1,35 @@
"use strict";
import backIcon from './assets/back-icon.png';
import backIconMask from './assets/back-icon-mask.png';
import clearIcon from './assets/clear-icon.png';
import closeIcon from './assets/close-icon.png';
import searchIcon from './assets/search-icon.png';
export { Background } from "./Background.js";
export { Badge } from "./Badge.js";
export { Button } from "./Button.js";
export { getDefaultSidebarWidth } from "./getDefaultSidebarWidth.js";
export { getDefaultHeaderHeight } from "./Header/getDefaultHeaderHeight.js";
export { getHeaderTitle } from "./Header/getHeaderTitle.js";
export { Header } from "./Header/Header.js";
export { HeaderBackButton } from "./Header/HeaderBackButton.js";
export { HeaderBackContext } from "./Header/HeaderBackContext.js";
export { HeaderBackground } from "./Header/HeaderBackground.js";
export { HeaderButton } from "./Header/HeaderButton.js";
export { HeaderHeightContext } from "./Header/HeaderHeightContext.js";
export { HeaderShownContext } from "./Header/HeaderShownContext.js";
export { HeaderTitle } from "./Header/HeaderTitle.js";
export { useHeaderHeight } from "./Header/useHeaderHeight.js";
export { getLabel } from "./Label/getLabel.js";
export { Label } from "./Label/Label.js";
export { Lazy } from "./Lazy.js";
export { MissingIcon } from "./MissingIcon.js";
export { PlatformPressable } from "./PlatformPressable.js";
export { ResourceSavingView } from "./ResourceSavingView.js";
export { SafeAreaProviderCompat } from "./SafeAreaProviderCompat.js";
export { Screen } from "./Screen.js";
export { Text } from "./Text.js";
export { useFrameSize } from "./useFrameSize.js";
export const Assets = [backIcon, backIconMask, searchIcon, closeIcon, clearIcon];
export * from "./types.js";
//# sourceMappingURL=index.js.map

View File

@@ -0,0 +1 @@
{"version":3,"names":["backIcon","backIconMask","clearIcon","closeIcon","searchIcon","Background","Badge","Button","getDefaultSidebarWidth","getDefaultHeaderHeight","getHeaderTitle","Header","HeaderBackButton","HeaderBackContext","HeaderBackground","HeaderButton","HeaderHeightContext","HeaderShownContext","HeaderTitle","useHeaderHeight","getLabel","Label","Lazy","MissingIcon","PlatformPressable","ResourceSavingView","SafeAreaProviderCompat","Screen","Text","useFrameSize","Assets"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;AAAA,OAAOA,QAAQ,MAAM,wBAAwB;AAC7C,OAAOC,YAAY,MAAM,6BAA6B;AACtD,OAAOC,SAAS,MAAM,yBAAyB;AAC/C,OAAOC,SAAS,MAAM,yBAAyB;AAC/C,OAAOC,UAAU,MAAM,0BAA0B;AAEjD,SAASC,UAAU,QAAQ,iBAAc;AACzC,SAASC,KAAK,QAAQ,YAAS;AAC/B,SAASC,MAAM,QAAQ,aAAU;AACjC,SAASC,sBAAsB,QAAQ,6BAA0B;AACjE,SAASC,sBAAsB,QAAQ,oCAAiC;AACxE,SAASC,cAAc,QAAQ,4BAAyB;AACxD,SAASC,MAAM,QAAQ,oBAAiB;AACxC,SAASC,gBAAgB,QAAQ,8BAA2B;AAC5D,SAASC,iBAAiB,QAAQ,+BAA4B;AAC9D,SAASC,gBAAgB,QAAQ,8BAA2B;AAC5D,SAASC,YAAY,QAAQ,0BAAuB;AACpD,SAASC,mBAAmB,QAAQ,iCAA8B;AAClE,SAASC,kBAAkB,QAAQ,gCAA6B;AAChE,SAASC,WAAW,QAAQ,yBAAsB;AAClD,SAASC,eAAe,QAAQ,6BAA0B;AAC1D,SAASC,QAAQ,QAAQ,qBAAkB;AAC3C,SAASC,KAAK,QAAQ,kBAAe;AACrC,SAASC,IAAI,QAAQ,WAAQ;AAC7B,SAASC,WAAW,QAAQ,kBAAe;AAC3C,SAASC,iBAAiB,QAAQ,wBAAqB;AACvD,SAASC,kBAAkB,QAAQ,yBAAsB;AACzD,SAASC,sBAAsB,QAAQ,6BAA0B;AACjE,SAASC,MAAM,QAAQ,aAAU;AACjC,SAASC,IAAI,QAAQ,WAAQ;AAC7B,SAASC,YAAY,QAAQ,mBAAgB;AAE7C,OAAO,MAAMC,MAAM,GAAG,CACpB9B,QAAQ,EACRC,YAAY,EACZG,UAAU,EACVD,SAAS,EACTD,SAAS,CACV;AAED,cAAc,YAAS","ignoreList":[]}

View File

@@ -0,0 +1 @@
{"type":"module"}

View File

@@ -0,0 +1,4 @@
"use strict";
export {};
//# sourceMappingURL=types.js.map

View File

@@ -0,0 +1 @@
{"version":3,"names":[],"sourceRoot":"../../src","sources":["types.tsx"],"mappings":"","ignoreList":[]}

View File

@@ -0,0 +1,162 @@
"use strict";
import * as React from 'react';
import { Platform } from 'react-native';
import useLatestCallback from 'use-latest-callback';
import { useSyncExternalStoreWithSelector } from 'use-sync-external-store/with-selector';
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
const FrameContext = /*#__PURE__*/React.createContext(undefined);
export function useFrameSize(selector, throttle) {
const context = React.useContext(FrameContext);
if (context == null) {
throw new Error('useFrameSize must be used within a FrameSizeProvider');
}
const value = useSyncExternalStoreWithSelector(throttle ? context.subscribeThrottled : context.subscribe, context.getCurrent, context.getCurrent, selector);
return value;
}
export function FrameSizeProvider({
initialFrame,
render
}) {
const frameRef = React.useRef({
width: initialFrame.width,
height: initialFrame.height
});
const listeners = React.useRef(new Set());
const getCurrent = useLatestCallback(() => frameRef.current);
const subscribe = useLatestCallback(listener => {
listeners.current.add(listener);
return () => {
listeners.current.delete(listener);
};
});
const subscribeThrottled = useLatestCallback(listener => {
const delay = 100; // Throttle delay in milliseconds
let timer;
let updated = false;
let waiting = false;
const throttledListener = () => {
clearTimeout(timer);
updated = true;
if (waiting) {
// Schedule a timer to call the listener at the end
timer = setTimeout(() => {
if (updated) {
updated = false;
listener();
}
}, delay);
} else {
waiting = true;
setTimeout(function () {
waiting = false;
}, delay);
// Call the listener immediately at start
updated = false;
listener();
}
};
const unsubscribe = subscribe(throttledListener);
return () => {
unsubscribe();
clearTimeout(timer);
};
});
const context = React.useMemo(() => ({
getCurrent,
subscribe,
subscribeThrottled
}), [subscribe, subscribeThrottled, getCurrent]);
const onChange = useLatestCallback(frame => {
if (frameRef.current.height === frame.height && frameRef.current.width === frame.width) {
return;
}
frameRef.current = {
width: frame.width,
height: frame.height
};
listeners.current.forEach(listener => listener());
});
const viewRef = React.useRef(null);
React.useEffect(() => {
if (Platform.OS === 'web') {
// We use ResizeObserver on web
return;
}
viewRef.current?.measure((_x, _y, width, height) => {
onChange({
width,
height
});
});
}, [onChange]);
const onLayout = event => {
const {
width,
height
} = event.nativeEvent.layout;
onChange({
width,
height
});
};
return /*#__PURE__*/_jsxs(FrameContext.Provider, {
value: context,
children: [Platform.OS === 'web' ? /*#__PURE__*/_jsx(FrameSizeListenerWeb, {
onChange: onChange
}) : null, render({
ref: viewRef,
onLayout
})]
});
}
// FIXME: On the Web, `onLayout` doesn't fire on resize
// So we workaround this by using ResizeObserver
function FrameSizeListenerWeb({
onChange
}) {
const elementRef = React.useRef(null);
React.useEffect(() => {
if (elementRef.current == null) {
return;
}
const rect = elementRef.current.getBoundingClientRect();
onChange({
width: rect.width,
height: rect.height
});
const observer = new ResizeObserver(entries => {
const entry = entries[0];
if (entry) {
const {
width,
height
} = entry.contentRect;
onChange({
width,
height
});
}
});
observer.observe(elementRef.current);
return () => {
observer.disconnect();
};
}, [onChange]);
return /*#__PURE__*/_jsx("div", {
ref: elementRef,
style: {
position: 'absolute',
left: 0,
right: 0,
top: 0,
bottom: 0,
pointerEvents: 'none',
visibility: 'hidden'
}
});
}
//# sourceMappingURL=useFrameSize.js.map

File diff suppressed because one or more lines are too long