Skip to content

Commit

Permalink
fix(Form): 增加TreeSelect & Picker
Browse files Browse the repository at this point in the history
  • Loading branch information
ChenlingasMx committed Apr 10, 2023
1 parent c9c492a commit 7c776a9
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 12 deletions.
3 changes: 2 additions & 1 deletion example/examples/src/routes/Form/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@ const FormDemo = () => {
attr: {
showClear: true,
labelInValue: true,
placeholder: '请选择',
},
placeholder: '请输入',
},
{
type: 'stepper',
Expand Down Expand Up @@ -153,6 +153,7 @@ const FormDemo = () => {
{label: '4', value: '4'},
],
showClear: true,
placeholder: '请选择',
},
},
{
Expand Down
1 change: 0 additions & 1 deletion example/examples/src/routes/SearchBar/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ const SearchBarDemo = (props: ComProps) => {
labelInValue
options={data}
onChange={val => console.log('val', val)}
placeholderColor="#333"
placeholder="请输入"
/>
</SafeAreaView>
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/Form/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ export default FormDemo
| 参数 | 说明 | 类型 | 默认值 |
|------|------|-----|------|
| `field` | 字段名 | string | - |
| `type` | 字段类型(`input` \| `textArea` \| `slider` \| `rate` \| `radio` \| `search`\| `switch`\| `checkBox`\| `stepper`\| `cardList`) | string | - |
| `type` | 字段类型(`input` \| `textArea` \| `slider` \| `rate` \| `radio` \| `search`\| `switch`\| `checkBox`\| `stepper`\| `picker`\| `treeSelect`\ | `cardList`) | string | - |
| `name` | 标签名 | string | - |
| `validate` | 验证规则 | RulesOption['validate'] | - |
| `options` | 集合 | Array<{ label: string; value: KeyType }> | - |
Expand Down
15 changes: 6 additions & 9 deletions packages/core/src/SearchBar/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,10 @@ function SearchBar({
...searchInputBarProps
}: SearchBarProps) {
const theme = useTheme<Theme>();

const styles = createStyles({
maskBgColor: theme.colors.mask || '#F5F5F5',
bgColor: theme.colors.background || '#F5F5F5',
disabledColor: theme.colors.disabled || '#F5F5F5',
contentColor: theme.colors.background || '#000',
iconColor: theme.colors.primary_text || '#fff',
cancelColor: theme.colors.primary_text || '#7C7D7E',
});
Expand Down Expand Up @@ -96,10 +94,14 @@ function SearchBar({
setVisivble(true);
};

const placeholderStyle = placeholderColor ? { color: placeholderColor } : {};

return !visible ? (
<Pressable onPress={showSearchBar}>
<View style={[disabled ? styles.disabled : styles.content, contentStyle]}>
<Text style={[styles.contentTitle, { color: placeholderColor }]}>{textValue ? textValue : placeholder}</Text>
<Text color="text" style={{ fontSize: 16, ...placeholderStyle }}>
{textValue ? textValue : placeholder}
</Text>
{React.isValidElement(extra) ? (
extra
) : curValue && showClear ? (
Expand Down Expand Up @@ -178,22 +180,17 @@ export default memo(SearchBar);
type CreStyle = {
bgColor: string;
maskBgColor: string;
contentColor: string;
disabledColor: string;
iconColor: string;
cancelColor: string;
};

function createStyles({ maskBgColor, bgColor, contentColor, disabledColor, iconColor, cancelColor }: CreStyle) {
function createStyles({ maskBgColor, bgColor, disabledColor, iconColor, cancelColor }: CreStyle) {
return StyleSheet.create({
container: {
flex: 1,
backgroundColor: bgColor,
},
contentTitle: {
fontSize: 16,
color: contentColor,
},
icon: {
backgroundColor: iconColor,
paddingLeft: 10,
Expand Down

0 comments on commit 7c776a9

Please sign in to comment.