-
Notifications
You must be signed in to change notification settings - Fork 111
Determine where children belong using .displayName #143
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
Closed
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
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.
Because of the weird situation I'm in with usage of
react-native-dialog
(and because the build failed) I didn't install that exact version, but instead copied those changes into our internal version and it did work as expected with your code; huzzah! I assume the rationale is to try to fallback to the component's name so that the user doesn't need to manually add adisplayName
.I think the
child.type
should always be readable, because a string should never actually end up as a direct child ofContainer
, right? So in that case the optional chaining shouldn't be necessary if I'm not mistaken. It doesn't affect the TypeScript error. I'm not really sure howtype DialogContainerProps = PropsWithChildren<{}>
works, but I guess ideally we'd let TypeScript know that the only valid children here areReactElement
and neverstring
. Any thoughts on how to approach that? Or if it would be too convoluted, we could just stick with thatts-ignore
comment.Unfortunately when I'm trying to run the
build
script on my end, I'm getting additional TypeScript errors I don't recall having seen when trying to build previously, but nothing has changed that I can see. I even rolled back to the latest commit onmaster
(0a9366b65f5b57a268a359604445406e93af1876
) but I still get the issues. Maybe I'm just having an incorrect memory here and these errors always occurred for me?I know you're not able to get React Native running yet, but can you confirm if you're seeing these issues with the build script?
PS: Getting React Native running is such a pain!
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.
Sorry for the late reply on my end 😞
Yep!
I think so. Good call.
I'm fine with the
@ts-ignore
👍 (Unless you're able to fix it on the prop side, which would be even better (but I'm not sure how to do it properly honesty).Both this branch and the

master
one work for me (and work in CI too).Any chances you used
yarn
instead ofnpm
? Try runninggit clean -f -d && rm -rf node_modules && npm i && npm run build
.