Repository navigation
feat: Card MD3 Expressive improvements #5116
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
e1b6147
5c45a3e
22d9368
c1446c2
968d7ca
ad93edf
4584880
dec349f
25f63ad
79920cc
8318785
efe5d34
21d5fd3
544f7b4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||
|---|---|---|---|---|
|
|
@@ -45,27 +45,27 @@ For React Native Paper theme to work, we need to use `PaperProvider` also at the | |||
| ```js | ||||
| import { NavigationContainer } from '@react-navigation/native'; | ||||
| import { createNativeStackNavigator } from '@react-navigation/native-stack'; | ||||
| import { TouchableOpacity } from 'react-native'; | ||||
| import { Card, Text, List, PaperProvider } from 'react-native-paper'; | ||||
|
|
||||
| const Stack = createNativeStackNavigator(); | ||||
|
|
||||
| const HomeScreen = ({ navigation }) => ( | ||||
| <TouchableOpacity | ||||
| <Card | ||||
| accessibilityLabel={`Open ${title}`} | ||||
| onPress={() => | ||||
| navigation?.push('Details', { | ||||
| title, | ||||
| content, | ||||
| }) | ||||
| } | ||||
| > | ||||
| <Card> | ||||
| title={title} | ||||
| content={ | ||||
| <Card.Content> | ||||
| <Text variant="titleLarge">{title}</Text> | ||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The Card now gets
Suggested change
(via Claude, verify if it makes sense) |
||||
| <Text variant="bodyMedium">{content}</Text> | ||||
| </Card.Content> | ||||
| </Card> | ||||
| </TouchableOpacity> | ||||
| } | ||||
| /> | ||||
| ); | ||||
|
|
||||
| const DetailsScreen = (props) => { | ||||
|
|
||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| import { describe, expect, it } from '@jest/globals'; | ||
| import path from 'node:path'; | ||
|
|
||
| import { createComponentParser } from '../parser'; | ||
|
|
||
| describe('component docs parser', () => { | ||
| it('documents every branch of the Card public prop unions', () => { | ||
| const repositoryRoot = process.cwd(); | ||
| const parse = createComponentParser( | ||
| path.join(repositoryRoot, 'tsconfig.source.json') | ||
| ); | ||
| const { props: documentedProps } = parse( | ||
| path.join(repositoryRoot, 'src', 'components'), | ||
| { source: 'Card/Card' } | ||
| ); | ||
| const props = new Map(documentedProps.map((prop) => [prop.name, prop])); | ||
|
|
||
| expect(props.get('variant')?.type).toContain('"filled"'); | ||
| expect(props.get('variant')?.type).toContain('"elevated"'); | ||
| expect(props.get('variant')?.type).toContain('"outlined"'); | ||
| expect(props.get('elevation')?.type).toContain('Elevation'); | ||
| expect(props.get('header')?.type).toBe('React.ReactNode'); | ||
| expect(props.get('title')?.type).toBe('React.ReactNode'); | ||
| }); | ||
| }); |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -206,22 +206,8 @@ const getProps = ( | |
| ? [item.type.getText(item.getSourceFile())] | ||
| : [] | ||
| ); | ||
| const hasUnionDeclarations = declarations.some((item) => { | ||
| let parent: ts.Node | undefined = item.parent; | ||
|
|
||
| while (parent && !ts.isTypeAliasDeclaration(parent)) { | ||
| if (ts.isUnionTypeNode(parent)) { | ||
| return true; | ||
| } | ||
|
|
||
| parent = parent.parent; | ||
| } | ||
|
|
||
| return false; | ||
| }); | ||
| const type = | ||
| (hasUnionDeclarations && new Set(declarationTypes).size > 1) || | ||
| !declarations.includes(property) | ||
| new Set(declarationTypes).size > 1 || !declarations.includes(property) | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This changes prop types on every component page. Have you checked the others? |
||
| ? checker.typeToString( | ||
| checker.getTypeOfSymbolAtLocation(symbol, property), | ||
| property, | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
efe5d34 removed the derived IDs, so the last sentence describes IDs that Card no longer renders.
(via Claude, verify if it makes sense)