24jieqi / react-native-xiaoshu

🌈 React Native UI library
https://24jieqi.github.io/react-native-xiaoshu/
Apache License 2.0
222 stars 23 forks source link

Field.TextInput的type为textArea后,设置valueStyle调整marginTop无法生效 #65

Closed geeker-cmc closed 3 months ago

geeker-cmc commented 3 months ago

设置的值被内部直接覆盖

onlyling commented 3 months ago
yarn add @fruits-chain/react-native-xiaoshu@0.4.1-beta.0

试试这个小补丁版本。

geeker-cmc commented 3 months ago

可以了,看了修复方式

 return (
    <Cell
      {...cellProps}
      valueStyle={[
        cellProps.valueStyle,
        cellProps.vertical
          ? {
              marginTop: outerValueStyle.marginTop ?? TOKENS.space_2,
            }
          : null,
      ]}
      value={
        <TextInput
          {...otherProps}
          style={textInputStyle}
          type={type}
          bordered={textInputBordered}
          textAlign={textAlign}
        />
      }
    />
  )

这个地方是否可以直接将cellProps.valueStyle放在数组最后,这样组件既有内部样式,又保障了组件样式的可拓展性。不用特意去判断是否设置了marginTop。个人的理解,不知道是否可行。

onlyling commented 3 months ago

当前的改的是临时补丁,满足业务优先,后面会优化一下。