@atlure/ui 0.12.0 → 0.12.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": "@atlure/ui",
3
- "version": "0.12.0",
3
+ "version": "0.12.1",
4
4
  "description": "Atlure React Native component library: NativeWind primitives built on @atlure/tokens, shipped as untranspiled TypeScript source",
5
5
  "license": "MIT",
6
6
  "author": "David Moreira",
@@ -37,9 +37,9 @@
37
37
  "class-variance-authority": "0.7.1",
38
38
  "clsx": "2.1.1",
39
39
  "tailwind-merge": "2.6.0",
40
- "@atlure/icons": "0.12.0",
41
- "@atlure/tokens": "0.12.0",
42
- "@atlure/types": "0.12.0"
40
+ "@atlure/icons": "0.12.1",
41
+ "@atlure/tokens": "0.12.1",
42
+ "@atlure/types": "0.12.1"
43
43
  },
44
44
  "peerDependencies": {
45
45
  "nativewind": "^4.2.6",
@@ -1,5 +1,5 @@
1
1
  import type { ComponentRef, ReactNode, Ref } from "react";
2
- import { TextInput, type TextInputProps, View } from "react-native";
2
+ import { Platform, TextInput, type TextInputProps, View } from "react-native";
3
3
 
4
4
  import { cn } from "../../lib/cn";
5
5
  import { touchTargetHitSlop } from "../../lib/touch-target";
@@ -22,6 +22,10 @@ export interface InputProps extends Omit<TextInputProps, "editable" | "multiline
22
22
  ref?: Ref<ComponentRef<typeof TextInput>>;
23
23
  }
24
24
 
25
+ const ANDROID_SINGLE_LINE_VERTICAL_FIX = Platform.OS === "android"
26
+ ? { paddingTop: 0, paddingBottom: 0, includeFontPadding: false as const }
27
+ : null;
28
+
25
29
  export function Input({
26
30
  size = "md",
27
31
  isDisabled,
@@ -32,6 +36,7 @@ export function Input({
32
36
  trailingIcon,
33
37
  className,
34
38
  nativeID,
39
+ style,
35
40
  ...textInputProps
36
41
  }: InputProps) {
37
42
  const field = useFormFieldControl();
@@ -39,6 +44,8 @@ export function Input({
39
44
  const isControlInvalid = isInvalid ?? field?.isInvalid ?? false;
40
45
  const isControlRequired = isRequired ?? field?.isRequired ?? false;
41
46
 
47
+ const verticalFix = isMultiline ? null : ANDROID_SINGLE_LINE_VERTICAL_FIX;
48
+
42
49
  const control = (
43
50
  <TextInput
44
51
  accessibilityState={{ disabled: isControlDisabled }}
@@ -51,6 +58,7 @@ export function Input({
51
58
  nativeID={nativeID ?? field?.nativeID}
52
59
  editable={!isControlDisabled}
53
60
  multiline={isMultiline}
61
+ textAlignVertical={isMultiline ? "top" : "center"}
54
62
  hitSlop={touchTargetHitSlop(size)}
55
63
  className={cn(
56
64
  inputVariants({
@@ -63,6 +71,7 @@ export function Input({
63
71
  }),
64
72
  className,
65
73
  )}
74
+ style={verticalFix ? [verticalFix, style] : style}
66
75
  {...textInputProps}
67
76
  />
68
77
  );