@vvedantb/native-ui 0.6.0 → 0.6.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vvedantb/native-ui",
3
- "version": "0.6.0",
3
+ "version": "0.6.1",
4
4
  "license": "MIT",
5
5
  "description": "Shared React Native / Expo UI primitives. Floating surfaces, forms, overlays, toasts, settings chrome, tab bar, AI chat parts and the family app marks.",
6
6
  "type": "module",
@@ -1,5 +1,5 @@
1
- import { Platform, type StyleProp, type ViewStyle } from "react-native";
2
- import Svg, { G, Path } from "react-native-svg";
1
+ import { Platform, type ViewProps } from "react-native";
2
+ import Svg, { G, Path, type GProps } from "react-native-svg";
3
3
  import { svgA11yProps } from "../svgA11y";
4
4
  import { tokens } from "../tokens";
5
5
  import { useScheme } from "../useScheme";
@@ -26,7 +26,7 @@ export type AppIconProps = {
26
26
  align?: "center" | "start";
27
27
  /** Set as `data-testid` on web, where `Svg` does not map `testID`. */
28
28
  testID?: string;
29
- style?: StyleProp<ViewStyle>;
29
+ style?: ViewProps["style"];
30
30
  };
31
31
 
32
32
  export type AppIconComponent = ((props: AppIconProps) => React.JSX.Element) & {
@@ -54,7 +54,7 @@ function createAppIcon(app: AppName, displayName: string): AppIconComponent {
54
54
  stroke === undefined
55
55
  ? markStrokeWidth(app)
56
56
  : stroke * (viewBoxSide(app) / size);
57
- const glyphProps =
57
+ const glyphProps: GProps =
58
58
  kind === "fill"
59
59
  ? { fill }
60
60
  : {
@@ -1,5 +1,5 @@
1
- import { Platform, type StyleProp, type ViewStyle } from "react-native";
2
- import Svg, { G, Path, Rect } from "react-native-svg";
1
+ import { Platform, type ViewProps } from "react-native";
2
+ import Svg, { G, Path, Rect, type GProps } from "react-native-svg";
3
3
  import { svgA11yProps } from "../svgA11y";
4
4
  import { APP_ICONS } from "./AppIcons";
5
5
  import {
@@ -23,7 +23,7 @@ export type AppMarkProps = {
23
23
  title?: string;
24
24
  /** Set as `data-testid` on web, where `Svg` does not map `testID`. */
25
25
  testID?: string;
26
- style?: StyleProp<ViewStyle>;
26
+ style?: ViewProps["style"];
27
27
  };
28
28
 
29
29
  const TILE_TONES = {
@@ -50,7 +50,7 @@ export function AppMark({
50
50
  }
51
51
  const { kind, paths } = APP_MARKS[app];
52
52
  const tone = TILE_TONES[variant];
53
- const glyphProps =
53
+ const glyphProps: GProps =
54
54
  kind === "fill"
55
55
  ? { fill: tone.fg }
56
56
  : {
@@ -1,4 +1,4 @@
1
- import { Platform, type StyleProp, type ViewStyle } from "react-native";
1
+ import { Platform, type ViewProps } from "react-native";
2
2
  import Svg, { Path } from "react-native-svg";
3
3
  import { svgA11yProps } from "../svgA11y";
4
4
 
@@ -9,7 +9,7 @@ export type GoogleMarkProps = {
9
9
  title?: string;
10
10
  /** Set as `data-testid` on web, where `Svg` does not map `testID`. */
11
11
  testID?: string;
12
- style?: StyleProp<ViewStyle>;
12
+ style?: ViewProps["style"];
13
13
  };
14
14
 
15
15
  /** The four paths of the Google "G" on the 24 grid, each in its brand colour. */
package/src/floating.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { Platform, type ViewStyle } from "react-native";
1
+ import { Platform } from "react-native";
2
2
  import { tokens } from "./tokens";
3
3
 
4
4
  export const FLOATING_INSET = tokens.spacing.unit;
@@ -14,7 +14,21 @@ export const FLOATING_PILL_RADIUS = tokens.radius.pill;
14
14
 
15
15
  const FLOATING_BOX_SHADOW = "0px 8px 24px rgba(10, 10, 10, 0.12)";
16
16
 
17
- export const floatingShadow: ViewStyle =
17
+ /**
18
+ * Only the shadow keys, not `ViewStyle`: an Expo-widened `ViewStyle`
19
+ * (`position: "fixed"`, `backgroundImage`) is not assignable to a React
20
+ * Native 0.88 View `style`. A plain inferred type would be `{}` and lose
21
+ * `floatingShadow.shadowColor` and the rest for callers.
22
+ */
23
+ type FloatingShadowStyle = {
24
+ shadowColor?: string;
25
+ shadowOffset?: { width: number; height: number };
26
+ shadowOpacity?: number;
27
+ shadowRadius?: number;
28
+ boxShadow?: string;
29
+ };
30
+
31
+ export const floatingShadow: FloatingShadowStyle =
18
32
  Platform.select({
19
33
  ios: {
20
34
  shadowColor: "#0a0a0a",
@@ -1,6 +1,6 @@
1
1
  import * as SwitchPrimitives from "@rn-primitives/switch";
2
2
  import * as React from "react";
3
- import { Platform, type ViewStyle } from "react-native";
3
+ import { Platform, type ViewProps, type ViewStyle } from "react-native";
4
4
  import { cn } from "../cn";
5
5
 
6
6
  type SwitchProps = React.ComponentPropsWithoutRef<
@@ -13,7 +13,7 @@ type SwitchProps = React.ComponentPropsWithoutRef<
13
13
  * which spreads `style`, so these are the only styles applied there.
14
14
  */
15
15
  trackStyle?: ViewStyle;
16
- thumbStyle?: ViewStyle;
16
+ thumbStyle?: ViewProps["style"];
17
17
  };
18
18
 
19
19
  const Switch = React.forwardRef<