Skip to content

Commit

Permalink
Merge pull request #580 from panbibi/dev
Browse files Browse the repository at this point in the history
fix(Typography):调整Div组件
  • Loading branch information
ChenlingasMx committed Apr 10, 2023
2 parents d5588ab + 06488b9 commit 9877e64
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions packages/core/src/Typography/Div.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
import React, { Fragment } from 'react';
import { Text, TextProps, ViewProps } from 'react-native';
import { Theme } from '../theme';
import { useTheme } from '@shopify/restyle';
import { TextProps, ViewProps } from 'react-native';
import Text from './Text';

interface DivProps {
children?: React.ReactNode;
}

export default function Div<T>({ children, ...otherProps }: DivProps & TextProps & ViewProps): JSX.Element | null {
const theme = useTheme<Theme>();
const textColor = theme.colors.primary_text || '#ccc';
if (!children) {
return null;
}
Expand All @@ -18,7 +15,7 @@ export default function Div<T>({ children, ...otherProps }: DivProps & TextProps
return typeof item === 'string' || (item && (item as any).type && (item as any).type.displayName === 'Text');
});
if (someStr) {
return <Text {...otherProps} children={children} style={{ color: textColor }} />;
return <Text color="text" {...otherProps} children={children} />;
}
return (
<Fragment>
Expand Down

0 comments on commit 9877e64

Please sign in to comment.