@robin-ux/native 0.1.0 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/components/HeaderView.d.ts +13 -0
- package/build/components/HeaderView.d.ts.map +1 -0
- package/build/components/HeaderView.js +36 -0
- package/build/components/HeaderView.js.map +1 -0
- package/build/components/index.d.ts +14 -12
- package/build/components/index.d.ts.map +1 -1
- package/build/components/index.js +7 -6
- package/build/components/index.js.map +1 -1
- package/build/index.d.ts +6 -6
- package/build/index.d.ts.map +1 -1
- package/build/index.js +3 -3
- package/build/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/HeaderView.tsx +60 -0
- package/src/components/index.ts +15 -12
- package/src/index.ts +20 -57
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { ScrollViewProps, StyleProp, ViewStyle } from "react-native";
|
|
3
|
+
export interface HeaderViewProps {
|
|
4
|
+
title: string;
|
|
5
|
+
actionButton?: React.ReactNode;
|
|
6
|
+
children: React.ReactNode;
|
|
7
|
+
scrollViewProps?: ScrollViewProps;
|
|
8
|
+
style?: StyleProp<ViewStyle>;
|
|
9
|
+
fixed?: boolean;
|
|
10
|
+
defaultStyle?: "light" | "dark";
|
|
11
|
+
}
|
|
12
|
+
export declare function HeaderView({ title, actionButton, children, scrollViewProps, style, defaultStyle, fixed }: HeaderViewProps): React.JSX.Element;
|
|
13
|
+
//# sourceMappingURL=HeaderView.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HeaderView.d.ts","sourceRoot":"","sources":["../../src/components/HeaderView.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAiB,MAAM,OAAO,CAAC;AACtC,OAAO,EAAY,eAAe,EAAE,SAAS,EAAQ,SAAS,EAAE,MAAM,cAAc,CAAC;AAMrF,MAAM,WAAW,eAAe;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,YAAY,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC/B,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,eAAe,CAAC,EAAE,eAAe,CAAC;IAClC,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC7B,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,YAAY,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;CACnC;AAED,wBAAgB,UAAU,CAAC,EAAE,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAE,eAAe,EAAE,KAAK,EAAE,YAAY,EAAE,KAAa,EAAE,EAAE,eAAe,qBA0CjI"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import React, { useRef } from "react";
|
|
2
|
+
import { Animated, View } from "react-native";
|
|
3
|
+
import { SafeAreaView } from "react-native-safe-area-context";
|
|
4
|
+
import { layouts, spacing, useThemedStyles } from "../utils";
|
|
5
|
+
import { DynamicStatusBar } from "./DynamicStatusBar";
|
|
6
|
+
import { Text } from "./Text";
|
|
7
|
+
export function HeaderView({ title, actionButton, children, scrollViewProps, style, defaultStyle, fixed = false }) {
|
|
8
|
+
const scrollY = useRef(new Animated.Value(0)).current;
|
|
9
|
+
const styles = useThemedStyles((colors) => ({
|
|
10
|
+
container: {
|
|
11
|
+
flex: 1,
|
|
12
|
+
backgroundColor: colors.background,
|
|
13
|
+
},
|
|
14
|
+
header: {
|
|
15
|
+
paddingHorizontal: spacing.md,
|
|
16
|
+
paddingTop: spacing.md,
|
|
17
|
+
...layouts.rowBetween,
|
|
18
|
+
},
|
|
19
|
+
content: {
|
|
20
|
+
flexGrow: 1,
|
|
21
|
+
},
|
|
22
|
+
}));
|
|
23
|
+
return (<SafeAreaView style={[styles.container, style]} edges={["top", "left", "right"]}>
|
|
24
|
+
<DynamicStatusBar scrollY={scrollY} threshold={100} defaultStyle={defaultStyle}/>
|
|
25
|
+
<View style={styles.header}>
|
|
26
|
+
<Text variant="heading" weight="extrabold">
|
|
27
|
+
{title}
|
|
28
|
+
</Text>
|
|
29
|
+
{actionButton}
|
|
30
|
+
</View>
|
|
31
|
+
{fixed ? (<View style={styles.content}>{children}</View>) : (<Animated.ScrollView style={styles.container} contentContainerStyle={styles.content} onScroll={Animated.event([{ nativeEvent: { contentOffset: { y: scrollY } } }], { useNativeDriver: true })} scrollEventThrottle={16} {...scrollViewProps}>
|
|
32
|
+
{children}
|
|
33
|
+
</Animated.ScrollView>)}
|
|
34
|
+
</SafeAreaView>);
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=HeaderView.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HeaderView.js","sourceRoot":"","sources":["../../src/components/HeaderView.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACtC,OAAO,EAAE,QAAQ,EAA8B,IAAI,EAAa,MAAM,cAAc,CAAC;AACrF,OAAO,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AAC9D,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAC7D,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAY9B,MAAM,UAAU,UAAU,CAAC,EAAE,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAE,eAAe,EAAE,KAAK,EAAE,YAAY,EAAE,KAAK,GAAG,KAAK,EAAmB;IAC9H,MAAM,OAAO,GAAG,MAAM,CAAC,IAAI,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC;IAEtD,MAAM,MAAM,GAAG,eAAe,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;QACxC,SAAS,EAAE;YACP,IAAI,EAAE,CAAC;YACP,eAAe,EAAE,MAAM,CAAC,UAAU;SACrC;QACD,MAAM,EAAE;YACJ,iBAAiB,EAAE,OAAO,CAAC,EAAE;YAC7B,UAAU,EAAE,OAAO,CAAC,EAAE;YACtB,GAAG,OAAO,CAAC,UAAU;SACxB;QACD,OAAO,EAAE;YACL,QAAQ,EAAE,CAAC;SACd;KACJ,CAAC,CAAC,CAAC;IAEJ,OAAO,CACH,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC,CAC5E;YAAA,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,CAAC,SAAS,CAAC,CAAC,GAAG,CAAC,CAAC,YAAY,CAAC,CAAC,YAAY,CAAC,EAC/E;YAAA,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,CACvB;gBAAA,CAAC,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,MAAM,CAAC,WAAW,CACtC;oBAAA,CAAC,KAAK,CACV;gBAAA,EAAE,IAAI,CACN;gBAAA,CAAC,YAAY,CACjB;YAAA,EAAE,IAAI,CACN;YAAA,CAAC,KAAK,CAAC,CAAC,CAAC,CACL,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,IAAI,CAAC,CACjD,CAAC,CAAC,CAAC,CACA,CAAC,QAAQ,CAAC,UAAU,CAChB,KAAK,CAAC,CAAC,MAAM,CAAC,SAAS,CAAC,CACxB,qBAAqB,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CACtC,QAAQ,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,EAAE,WAAW,EAAE,EAAE,aAAa,EAAE,EAAE,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,eAAe,EAAE,IAAI,EAAE,CAAC,CAAC,CAC1G,mBAAmB,CAAC,CAAC,EAAE,CAAC,CACxB,IAAI,eAAe,CAAC,CAEpB;oBAAA,CAAC,QAAQ,CACb;gBAAA,EAAE,QAAQ,CAAC,UAAU,CAAC,CACzB,CACL;QAAA,EAAE,YAAY,CAAC,CAClB,CAAC;AACN,CAAC","sourcesContent":["import React, { useRef } from \"react\";\nimport { Animated, ScrollViewProps, StyleProp, View, ViewStyle } from \"react-native\";\nimport { SafeAreaView } from \"react-native-safe-area-context\";\nimport { layouts, spacing, useThemedStyles } from \"../utils\";\nimport { DynamicStatusBar } from \"./DynamicStatusBar\";\nimport { Text } from \"./Text\";\n\nexport interface HeaderViewProps {\n title: string;\n actionButton?: React.ReactNode;\n children: React.ReactNode;\n scrollViewProps?: ScrollViewProps;\n style?: StyleProp<ViewStyle>;\n fixed?: boolean;\n defaultStyle?: \"light\" | \"dark\";\n}\n\nexport function HeaderView({ title, actionButton, children, scrollViewProps, style, defaultStyle, fixed = false }: HeaderViewProps) {\n const scrollY = useRef(new Animated.Value(0)).current;\n\n const styles = useThemedStyles((colors) => ({\n container: {\n flex: 1,\n backgroundColor: colors.background,\n },\n header: {\n paddingHorizontal: spacing.md,\n paddingTop: spacing.md,\n ...layouts.rowBetween,\n },\n content: {\n flexGrow: 1,\n },\n }));\n\n return (\n <SafeAreaView style={[styles.container, style]} edges={[\"top\", \"left\", \"right\"]}>\n <DynamicStatusBar scrollY={scrollY} threshold={100} defaultStyle={defaultStyle} />\n <View style={styles.header}>\n <Text variant=\"heading\" weight=\"extrabold\">\n {title}\n </Text>\n {actionButton}\n </View>\n {fixed ? (\n <View style={styles.content}>{children}</View>\n ) : (\n <Animated.ScrollView\n style={styles.container}\n contentContainerStyle={styles.content}\n onScroll={Animated.event([{ nativeEvent: { contentOffset: { y: scrollY } } }], { useNativeDriver: true })}\n scrollEventThrottle={16}\n {...scrollViewProps}\n >\n {children}\n </Animated.ScrollView>\n )}\n </SafeAreaView>\n );\n}\n"]}
|
|
@@ -1,13 +1,15 @@
|
|
|
1
|
-
export { Button } from
|
|
2
|
-
export type { ButtonProps,
|
|
3
|
-
export { Text } from
|
|
4
|
-
export type {
|
|
5
|
-
export { Input, PasswordInput
|
|
6
|
-
export type { InputProps } from
|
|
7
|
-
export { SegmentedControl } from
|
|
8
|
-
export type {
|
|
9
|
-
export { Badge } from
|
|
10
|
-
export type { BadgeProps, BadgeStatus } from
|
|
11
|
-
export { DynamicStatusBar } from
|
|
12
|
-
export type { DynamicStatusBarProps } from
|
|
1
|
+
export { Button } from "./Button";
|
|
2
|
+
export type { ButtonProps, ButtonSize, ButtonVariant } from "./Button";
|
|
3
|
+
export { Text } from "./Text";
|
|
4
|
+
export type { TextAlign, TextColor, TextProps, TextVariant, TextWeight } from "./Text";
|
|
5
|
+
export { BaseInput, Input, PasswordInput } from "./Input";
|
|
6
|
+
export type { InputProps } from "./Input";
|
|
7
|
+
export { SegmentedControl } from "./SegmentedControl";
|
|
8
|
+
export type { Segment, SegmentedControlProps } from "./SegmentedControl";
|
|
9
|
+
export { Badge } from "./Badge";
|
|
10
|
+
export type { BadgeProps, BadgeStatus } from "./Badge";
|
|
11
|
+
export { DynamicStatusBar } from "./DynamicStatusBar";
|
|
12
|
+
export type { DynamicStatusBarProps } from "./DynamicStatusBar";
|
|
13
|
+
export { HeaderView } from "./HeaderView";
|
|
14
|
+
export type { HeaderViewProps } from "./HeaderView";
|
|
13
15
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,YAAY,EAAE,WAAW,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,YAAY,EAAE,WAAW,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAGvE,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,YAAY,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAGvF,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC1D,YAAY,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAG1C,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,YAAY,EAAE,OAAO,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAGzE,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,YAAY,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAGvD,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,YAAY,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAEhE,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,YAAY,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC"}
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
// Button
|
|
2
|
-
export { Button } from
|
|
2
|
+
export { Button } from "./Button";
|
|
3
3
|
// Text
|
|
4
|
-
export { Text } from
|
|
4
|
+
export { Text } from "./Text";
|
|
5
5
|
// Input
|
|
6
|
-
export { Input, PasswordInput
|
|
6
|
+
export { BaseInput, Input, PasswordInput } from "./Input";
|
|
7
7
|
// SegmentedControl
|
|
8
|
-
export { SegmentedControl } from
|
|
8
|
+
export { SegmentedControl } from "./SegmentedControl";
|
|
9
9
|
// Badge
|
|
10
|
-
export { Badge } from
|
|
10
|
+
export { Badge } from "./Badge";
|
|
11
11
|
// DynamicStatusBar
|
|
12
|
-
export { DynamicStatusBar } from
|
|
12
|
+
export { DynamicStatusBar } from "./DynamicStatusBar";
|
|
13
|
+
export { HeaderView } from "./HeaderView";
|
|
13
14
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAAA,SAAS;AACT,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAGlC,OAAO;AACP,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAG9B,QAAQ;AACR,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAAA,SAAS;AACT,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAGlC,OAAO;AACP,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAG9B,QAAQ;AACR,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAG1D,mBAAmB;AACnB,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAGtD,QAAQ;AACR,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAGhC,mBAAmB;AACnB,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAGtD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC","sourcesContent":["// Button\nexport { Button } from \"./Button\";\nexport type { ButtonProps, ButtonSize, ButtonVariant } from \"./Button\";\n\n// Text\nexport { Text } from \"./Text\";\nexport type { TextAlign, TextColor, TextProps, TextVariant, TextWeight } from \"./Text\";\n\n// Input\nexport { BaseInput, Input, PasswordInput } from \"./Input\";\nexport type { InputProps } from \"./Input\";\n\n// SegmentedControl\nexport { SegmentedControl } from \"./SegmentedControl\";\nexport type { Segment, SegmentedControlProps } from \"./SegmentedControl\";\n\n// Badge\nexport { Badge } from \"./Badge\";\nexport type { BadgeProps, BadgeStatus } from \"./Badge\";\n\n// DynamicStatusBar\nexport { DynamicStatusBar } from \"./DynamicStatusBar\";\nexport type { DynamicStatusBarProps } from \"./DynamicStatusBar\";\n\nexport { HeaderView } from \"./HeaderView\";\nexport type { HeaderViewProps } from \"./HeaderView\";\n"]}
|
package/build/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export type { Theme, ThemeColors, ThemeContextValue, ThemeProviderProps
|
|
3
|
-
export {
|
|
4
|
-
export type {
|
|
5
|
-
export {
|
|
6
|
-
export type {
|
|
1
|
+
export { defaultDarkColors, defaultDarkTheme, defaultLightColors, defaultTheme, ThemeContext, ThemeProvider, useTheme, useThemeSafe } from "./theme";
|
|
2
|
+
export type { Theme, ThemeColors, ThemeContextValue, ThemeProviderProps } from "./theme";
|
|
3
|
+
export { Badge, BaseInput, Button, DynamicStatusBar, HeaderView, Input, PasswordInput, SegmentedControl, Text } from "./components";
|
|
4
|
+
export type { BadgeProps, BadgeStatus, ButtonProps, ButtonSize, ButtonVariant, DynamicStatusBarProps, InputProps, Segment, SegmentedControlProps, TextAlign, TextColor, TextProps, TextVariant, TextWeight, } from "./components";
|
|
5
|
+
export { borderRadius, createThemedStyle, layouts, shadows, spacing, typography, useThemedStyles } from "./utils";
|
|
6
|
+
export type { BorderRadiusKey, LayoutKey, ShadowKey, SpacingKey, TypographyVariant } from "./utils";
|
|
7
7
|
//# sourceMappingURL=index.d.ts.map
|
package/build/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAKA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,YAAY,EAAE,YAAY,EAAE,aAAa,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAErJ,YAAY,EAAE,KAAK,EAAE,WAAW,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAGzF,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,gBAAgB,EAAE,UAAU,EAAE,KAAK,EAAE,aAAa,EAAE,gBAAgB,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAEpI,YAAY,EACR,UAAU,EACV,WAAW,EACX,WAAW,EACX,UAAU,EACV,aAAa,EACb,qBAAqB,EACrB,UAAU,EACV,OAAO,EACP,qBAAqB,EACrB,SAAS,EACT,SAAS,EACT,SAAS,EACT,WAAW,EACX,UAAU,GACb,MAAM,cAAc,CAAC;AAGtB,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAElH,YAAY,EAAE,eAAe,EAAE,SAAS,EAAE,SAAS,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC"}
|
package/build/index.js
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
// @robin-ux/native - Themeable React Native UI Components
|
|
3
3
|
// ============================================================================
|
|
4
4
|
// Theme system
|
|
5
|
-
export {
|
|
5
|
+
export { defaultDarkColors, defaultDarkTheme, defaultLightColors, defaultTheme, ThemeContext, ThemeProvider, useTheme, useThemeSafe } from "./theme";
|
|
6
6
|
// Components
|
|
7
|
-
export {
|
|
7
|
+
export { Badge, BaseInput, Button, DynamicStatusBar, HeaderView, Input, PasswordInput, SegmentedControl, Text } from "./components";
|
|
8
8
|
// Utilities
|
|
9
|
-
export {
|
|
9
|
+
export { borderRadius, createThemedStyle, layouts, shadows, spacing, typography, useThemedStyles } from "./utils";
|
|
10
10
|
//# sourceMappingURL=index.js.map
|
package/build/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,0DAA0D;AAC1D,+EAA+E;AAE/E,eAAe;AACf,OAAO,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,0DAA0D;AAC1D,+EAA+E;AAE/E,eAAe;AACf,OAAO,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,YAAY,EAAE,YAAY,EAAE,aAAa,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAIrJ,aAAa;AACb,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,gBAAgB,EAAE,UAAU,EAAE,KAAK,EAAE,aAAa,EAAE,gBAAgB,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAmBpI,YAAY;AACZ,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC","sourcesContent":["// ============================================================================\n// @robin-ux/native - Themeable React Native UI Components\n// ============================================================================\n\n// Theme system\nexport { defaultDarkColors, defaultDarkTheme, defaultLightColors, defaultTheme, ThemeContext, ThemeProvider, useTheme, useThemeSafe } from \"./theme\";\n\nexport type { Theme, ThemeColors, ThemeContextValue, ThemeProviderProps } from \"./theme\";\n\n// Components\nexport { Badge, BaseInput, Button, DynamicStatusBar, HeaderView, Input, PasswordInput, SegmentedControl, Text } from \"./components\";\n\nexport type {\n BadgeProps,\n BadgeStatus,\n ButtonProps,\n ButtonSize,\n ButtonVariant,\n DynamicStatusBarProps,\n InputProps,\n Segment,\n SegmentedControlProps,\n TextAlign,\n TextColor,\n TextProps,\n TextVariant,\n TextWeight,\n} from \"./components\";\n\n// Utilities\nexport { borderRadius, createThemedStyle, layouts, shadows, spacing, typography, useThemedStyles } from \"./utils\";\n\nexport type { BorderRadiusKey, LayoutKey, ShadowKey, SpacingKey, TypographyVariant } from \"./utils\";\n"]}
|
package/package.json
CHANGED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import React, { useRef } from "react";
|
|
2
|
+
import { Animated, ScrollViewProps, StyleProp, View, ViewStyle } from "react-native";
|
|
3
|
+
import { SafeAreaView } from "react-native-safe-area-context";
|
|
4
|
+
import { layouts, spacing, useThemedStyles } from "../utils";
|
|
5
|
+
import { DynamicStatusBar } from "./DynamicStatusBar";
|
|
6
|
+
import { Text } from "./Text";
|
|
7
|
+
|
|
8
|
+
export interface HeaderViewProps {
|
|
9
|
+
title: string;
|
|
10
|
+
actionButton?: React.ReactNode;
|
|
11
|
+
children: React.ReactNode;
|
|
12
|
+
scrollViewProps?: ScrollViewProps;
|
|
13
|
+
style?: StyleProp<ViewStyle>;
|
|
14
|
+
fixed?: boolean;
|
|
15
|
+
defaultStyle?: "light" | "dark";
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export function HeaderView({ title, actionButton, children, scrollViewProps, style, defaultStyle, fixed = false }: HeaderViewProps) {
|
|
19
|
+
const scrollY = useRef(new Animated.Value(0)).current;
|
|
20
|
+
|
|
21
|
+
const styles = useThemedStyles((colors) => ({
|
|
22
|
+
container: {
|
|
23
|
+
flex: 1,
|
|
24
|
+
backgroundColor: colors.background,
|
|
25
|
+
},
|
|
26
|
+
header: {
|
|
27
|
+
paddingHorizontal: spacing.md,
|
|
28
|
+
paddingTop: spacing.md,
|
|
29
|
+
...layouts.rowBetween,
|
|
30
|
+
},
|
|
31
|
+
content: {
|
|
32
|
+
flexGrow: 1,
|
|
33
|
+
},
|
|
34
|
+
}));
|
|
35
|
+
|
|
36
|
+
return (
|
|
37
|
+
<SafeAreaView style={[styles.container, style]} edges={["top", "left", "right"]}>
|
|
38
|
+
<DynamicStatusBar scrollY={scrollY} threshold={100} defaultStyle={defaultStyle} />
|
|
39
|
+
<View style={styles.header}>
|
|
40
|
+
<Text variant="heading" weight="extrabold">
|
|
41
|
+
{title}
|
|
42
|
+
</Text>
|
|
43
|
+
{actionButton}
|
|
44
|
+
</View>
|
|
45
|
+
{fixed ? (
|
|
46
|
+
<View style={styles.content}>{children}</View>
|
|
47
|
+
) : (
|
|
48
|
+
<Animated.ScrollView
|
|
49
|
+
style={styles.container}
|
|
50
|
+
contentContainerStyle={styles.content}
|
|
51
|
+
onScroll={Animated.event([{ nativeEvent: { contentOffset: { y: scrollY } } }], { useNativeDriver: true })}
|
|
52
|
+
scrollEventThrottle={16}
|
|
53
|
+
{...scrollViewProps}
|
|
54
|
+
>
|
|
55
|
+
{children}
|
|
56
|
+
</Animated.ScrollView>
|
|
57
|
+
)}
|
|
58
|
+
</SafeAreaView>
|
|
59
|
+
);
|
|
60
|
+
}
|
package/src/components/index.ts
CHANGED
|
@@ -1,23 +1,26 @@
|
|
|
1
1
|
// Button
|
|
2
|
-
export { Button } from
|
|
3
|
-
export type { ButtonProps,
|
|
2
|
+
export { Button } from "./Button";
|
|
3
|
+
export type { ButtonProps, ButtonSize, ButtonVariant } from "./Button";
|
|
4
4
|
|
|
5
5
|
// Text
|
|
6
|
-
export { Text } from
|
|
7
|
-
export type {
|
|
6
|
+
export { Text } from "./Text";
|
|
7
|
+
export type { TextAlign, TextColor, TextProps, TextVariant, TextWeight } from "./Text";
|
|
8
8
|
|
|
9
9
|
// Input
|
|
10
|
-
export { Input, PasswordInput
|
|
11
|
-
export type { InputProps } from
|
|
10
|
+
export { BaseInput, Input, PasswordInput } from "./Input";
|
|
11
|
+
export type { InputProps } from "./Input";
|
|
12
12
|
|
|
13
13
|
// SegmentedControl
|
|
14
|
-
export { SegmentedControl } from
|
|
15
|
-
export type {
|
|
14
|
+
export { SegmentedControl } from "./SegmentedControl";
|
|
15
|
+
export type { Segment, SegmentedControlProps } from "./SegmentedControl";
|
|
16
16
|
|
|
17
17
|
// Badge
|
|
18
|
-
export { Badge } from
|
|
19
|
-
export type { BadgeProps, BadgeStatus } from
|
|
18
|
+
export { Badge } from "./Badge";
|
|
19
|
+
export type { BadgeProps, BadgeStatus } from "./Badge";
|
|
20
20
|
|
|
21
21
|
// DynamicStatusBar
|
|
22
|
-
export { DynamicStatusBar } from
|
|
23
|
-
export type { DynamicStatusBarProps } from
|
|
22
|
+
export { DynamicStatusBar } from "./DynamicStatusBar";
|
|
23
|
+
export type { DynamicStatusBarProps } from "./DynamicStatusBar";
|
|
24
|
+
|
|
25
|
+
export { HeaderView } from "./HeaderView";
|
|
26
|
+
export type { HeaderViewProps } from "./HeaderView";
|
package/src/index.ts
CHANGED
|
@@ -3,68 +3,31 @@
|
|
|
3
3
|
// ============================================================================
|
|
4
4
|
|
|
5
5
|
// Theme system
|
|
6
|
-
export {
|
|
7
|
-
ThemeProvider,
|
|
8
|
-
ThemeContext,
|
|
9
|
-
useTheme,
|
|
10
|
-
useThemeSafe,
|
|
11
|
-
defaultTheme,
|
|
12
|
-
defaultDarkTheme,
|
|
13
|
-
defaultLightColors,
|
|
14
|
-
defaultDarkColors,
|
|
15
|
-
} from './theme';
|
|
6
|
+
export { defaultDarkColors, defaultDarkTheme, defaultLightColors, defaultTheme, ThemeContext, ThemeProvider, useTheme, useThemeSafe } from "./theme";
|
|
16
7
|
|
|
17
|
-
export type {
|
|
18
|
-
Theme,
|
|
19
|
-
ThemeColors,
|
|
20
|
-
ThemeContextValue,
|
|
21
|
-
ThemeProviderProps,
|
|
22
|
-
} from './theme';
|
|
8
|
+
export type { Theme, ThemeColors, ThemeContextValue, ThemeProviderProps } from "./theme";
|
|
23
9
|
|
|
24
10
|
// Components
|
|
25
|
-
export {
|
|
26
|
-
Button,
|
|
27
|
-
Text,
|
|
28
|
-
Input,
|
|
29
|
-
PasswordInput,
|
|
30
|
-
BaseInput,
|
|
31
|
-
SegmentedControl,
|
|
32
|
-
Badge,
|
|
33
|
-
DynamicStatusBar,
|
|
34
|
-
} from './components';
|
|
11
|
+
export { Badge, BaseInput, Button, DynamicStatusBar, HeaderView, Input, PasswordInput, SegmentedControl, Text } from "./components";
|
|
35
12
|
|
|
36
13
|
export type {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
} from
|
|
14
|
+
BadgeProps,
|
|
15
|
+
BadgeStatus,
|
|
16
|
+
ButtonProps,
|
|
17
|
+
ButtonSize,
|
|
18
|
+
ButtonVariant,
|
|
19
|
+
DynamicStatusBarProps,
|
|
20
|
+
InputProps,
|
|
21
|
+
Segment,
|
|
22
|
+
SegmentedControlProps,
|
|
23
|
+
TextAlign,
|
|
24
|
+
TextColor,
|
|
25
|
+
TextProps,
|
|
26
|
+
TextVariant,
|
|
27
|
+
TextWeight,
|
|
28
|
+
} from "./components";
|
|
52
29
|
|
|
53
30
|
// Utilities
|
|
54
|
-
export {
|
|
55
|
-
spacing,
|
|
56
|
-
borderRadius,
|
|
57
|
-
typography,
|
|
58
|
-
shadows,
|
|
59
|
-
layouts,
|
|
60
|
-
useThemedStyles,
|
|
61
|
-
createThemedStyle,
|
|
62
|
-
} from './utils';
|
|
31
|
+
export { borderRadius, createThemedStyle, layouts, shadows, spacing, typography, useThemedStyles } from "./utils";
|
|
63
32
|
|
|
64
|
-
export type {
|
|
65
|
-
SpacingKey,
|
|
66
|
-
BorderRadiusKey,
|
|
67
|
-
TypographyVariant,
|
|
68
|
-
ShadowKey,
|
|
69
|
-
LayoutKey,
|
|
70
|
-
} from './utils';
|
|
33
|
+
export type { BorderRadiusKey, LayoutKey, ShadowKey, SpacingKey, TypographyVariant } from "./utils";
|