Skip to content

Commit 9877e64

Browse files
authored
Merge pull request #580 from panbibi/dev
fix(Typography):调整Div组件
2 parents d5588ab + 06488b9 commit 9877e64

File tree

1 file changed

+3
-6
lines changed
  • packages/core/src/Typography

1 file changed

+3
-6
lines changed

packages/core/src/Typography/Div.tsx

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,12 @@
11
import React, { Fragment } from 'react';
2-
import { Text, TextProps, ViewProps } from 'react-native';
3-
import { Theme } from '../theme';
4-
import { useTheme } from '@shopify/restyle';
2+
import { TextProps, ViewProps } from 'react-native';
3+
import Text from './Text';
54

65
interface DivProps {
76
children?: React.ReactNode;
87
}
98

109
export default function Div<T>({ children, ...otherProps }: DivProps & TextProps & ViewProps): JSX.Element | null {
11-
const theme = useTheme<Theme>();
12-
const textColor = theme.colors.primary_text || '#ccc';
1310
if (!children) {
1411
return null;
1512
}
@@ -18,7 +15,7 @@ export default function Div<T>({ children, ...otherProps }: DivProps & TextProps
1815
return typeof item === 'string' || (item && (item as any).type && (item as any).type.displayName === 'Text');
1916
});
2017
if (someStr) {
21-
return <Text {...otherProps} children={children} style={{ color: textColor }} />;
18+
return <Text color="text" {...otherProps} children={children} />;
2219
}
2320
return (
2421
<Fragment>

0 commit comments

Comments
 (0)