Skip to content

Commit

Permalink
Merge pull request #807 from thundersdata-frontend/form-issue
Browse files Browse the repository at this point in the history
fix: 修复Input组件在复杂布局场景下的样式问题
  • Loading branch information
chj-damon authored Jan 2, 2024
2 parents 1bbc064 + 2d63b59 commit 6d8a57e
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 16 deletions.
5 changes: 3 additions & 2 deletions packages/react-native/src/input/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ const Input = forwardRef<TextInput, InputProps>(
position="relative"
paddingHorizontal={'x1'}
flex={1}
style={style}
>
{!!leftIcon && <Box>{leftIcon}</Box>}
<Box flexGrow={1}>
Expand Down Expand Up @@ -138,15 +139,15 @@ const Input = forwardRef<TextInput, InputProps>(
);

return labelPosition === 'left' ? (
<Box style={style}>
<Box>
<Flex alignItems="center">
<Label {...{ colon, label, required }} />
{InputContent}
</Flex>
<Brief brief={brief} />
</Box>
) : (
<Box style={style}>
<Box>
<Label {...{ colon, label, required }} />
{InputContent}
<Brief brief={brief} />
Expand Down
17 changes: 10 additions & 7 deletions packages/react-native/src/number-keyboard/NumberKeyboardInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,14 @@ const NumberKeyboardInput = forwardRef<NumberKeyboardRef, NumberKeyboardInputPro
Keyboard.dismiss();
setTrue();
}}
style={{
paddingVertical: theme.spacing.x2,
justifyContent: 'center',
height: itemHeight,
}}
style={[
{
flex: 1,
paddingVertical: theme.spacing.x2,
height: itemHeight,
},
style,
]}
>
<Text variant="p1" color={currentText === placeholder ? 'gray300' : 'text'} style={inputStyle} selectable>
{currentText}
Expand All @@ -82,7 +85,7 @@ const NumberKeyboardInput = forwardRef<NumberKeyboardRef, NumberKeyboardInputPro

if (labelPosition === 'top')
return (
<Box style={style}>
<Box>
<Label {...{ colon, label, required }} />
{InputContent}
<Brief brief={brief} />
Expand All @@ -99,7 +102,7 @@ const NumberKeyboardInput = forwardRef<NumberKeyboardRef, NumberKeyboardInputPro
);

return (
<Box style={style}>
<Box>
<Flex alignItems="center">
<Label {...{ colon, label, required }} />
{InputContent}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,14 @@ const VehicleKeyboardInput = forwardRef<VehicleKeyboardRef, VehicleKeyboardInput
Keyboard.dismiss();
setTrue();
}}
style={{
paddingVertical: theme.spacing.x2,
justifyContent: 'center',
height: itemHeight,
}}
style={[
{
flex: 1,
paddingVertical: theme.spacing.x2,
height: itemHeight,
},
style,
]}
>
<Text variant="p1" color={currentText === placeholder ? 'gray300' : 'text'} style={inputStyle} selectable>
{currentText}
Expand All @@ -79,7 +82,7 @@ const VehicleKeyboardInput = forwardRef<VehicleKeyboardRef, VehicleKeyboardInput

if (labelPosition === 'top')
return (
<Box style={style}>
<Box>
<Label {...{ label, colon, required }} />
{InputContent}
<Brief brief={brief} />
Expand All @@ -96,7 +99,7 @@ const VehicleKeyboardInput = forwardRef<VehicleKeyboardRef, VehicleKeyboardInput
);

return (
<Box style={style}>
<Box>
<Flex alignItems="center">
<Label {...{ colon, label, required }} />
{InputContent}
Expand Down

0 comments on commit 6d8a57e

Please sign in to comment.