Skip to content

Commit 8bd74d3

Browse files
committed
fix: typescript errors and run tests
1 parent e9d4b43 commit 8bd74d3

2 files changed

Lines changed: 5 additions & 12 deletions

File tree

example/src/Examples/TextExample.tsx

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import {
1111
Subheading,
1212
customText,
1313
Title,
14-
Text as RNPText,
1514
} from 'react-native-paper';
1615

1716
import { useExampleTheme } from '..';
@@ -106,17 +105,11 @@ const TextExample = () => {
106105
<Text style={styles.text} variant="bodySmall">
107106
Body Small
108107
</Text>
109-
110108
<PaperProvider theme={theme}>
111109
<Text style={styles.text} variant="customVariant">
112110
Custom Variant
113111
</Text>
114112
</PaperProvider>
115-
116-
<RNPText style={{ color: 'red' }}>
117-
<RNPText>Nested </RNPText>
118-
Text
119-
</RNPText>
120113
</>
121114
)}
122115
</View>

src/components/Typography/Text.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -102,12 +102,12 @@ const Text = (
102102
let textStyle = [font, style];
103103

104104
if (
105-
React.isValidElement(rest.children) &&
106-
(rest.children.type === Component ||
107-
rest.children.type === AnimatedText ||
108-
rest.children.type === StyledText)
105+
React.isValidElement(children) &&
106+
(children.type === Component ||
107+
children.type === AnimatedText ||
108+
children.type === StyledText)
109109
) {
110-
const { props } = rest.children;
110+
const { props } = children;
111111

112112
// Context: Some components have the built-in `Text` component with a predefined variant,
113113
// that also accepts `children` as a `React.Node`. This can result in a situation,

0 commit comments

Comments
 (0)