Skip to content

Commit

Permalink
fix input element right show
Browse files Browse the repository at this point in the history
  • Loading branch information
lobor committed Feb 10, 2025
1 parent f0d7fb3 commit 4ecf2ef
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 17 deletions.
5 changes: 5 additions & 0 deletions .changeset/kind-chicken-hope.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@crossed/ui': patch
---

fix input element right
36 changes: 19 additions & 17 deletions packages/ui/src/forms/Input.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -173,23 +173,25 @@ export const Input = forwardRef<TextInput, InputProps>((allProps, ref) => {
onChangeText={setValue}
/>
</FormControl>
<XBox
style={composeStyles(form.elementRight, gapStyles.xs)}
onLayout={({ nativeEvent: { layout } }) =>
setElementRightWidth(layout.width)
}
>
{isValidElement(elementRight) &&
typeof elementRight.type !== 'string' &&
(elementRight.type as any).displayName === 'CrossedText'
? cloneElement(elementRight, {
style: [(elementRight as any).style, { color }],
} as any)
: elementRight}
{!!showClear && (
<CloseButton onPress={onClear} style={styles.close} />
)}
</XBox>
{!!elementRight && (
<XBox
style={composeStyles(form.elementRight, gapStyles.xs)}
onLayout={({ nativeEvent: { layout } }) =>
setElementRightWidth(layout.width)
}
>
{isValidElement(elementRight) &&
typeof elementRight.type !== 'string' &&
(elementRight.type as any).displayName === 'CrossedText'
? cloneElement(elementRight, {
style: [(elementRight as any).style, { color }],
} as any)
: elementRight}
{!!showClear && (
<CloseButton onPress={onClear} style={styles.close} />
)}
</XBox>
)}
</XBox>
{error && <Text color="error">{error.toString()}</Text>}
</YBox>
Expand Down

0 comments on commit 4ecf2ef

Please sign in to comment.