Skip to content
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

Cannot render elements with type of text or span using types #38

Open
ngregory-rbi opened this issue Feb 23, 2023 · 4 comments
Open

Cannot render elements with type of text or span using types #38

ngregory-rbi opened this issue Feb 23, 2023 · 4 comments
Labels

Comments

@ngregory-rbi
Copy link

It seems text and span elements default to their own render functions, even when overridden with the types object. Is thus to be expected?

@ngregory-rbi ngregory-rbi changed the title Cannot render text with type of text or span using types Cannot render elements with type of text or span using types Feb 23, 2023
@rexxars
Copy link
Member

rexxars commented Feb 23, 2023

You can implement renderers for specific marks (eg annotated text spans) using the marks prop, but not the very leaf nodes (pure text). Do you have a use case for customizing the latter?

@ngregory-rbi
Copy link
Author

Eh? More that I am using this in React Native, and renderText simply outputs a string, so I need to make sure that I always wrap those in a Text component. It's doable, but the lack of control feels weird to me. I am merely working on the consuming side though. I am not a content editor, so I don't know what processes they have.

@rexxars
Copy link
Member

rexxars commented Feb 23, 2023

Have you tried using @portabletext/react-native? It should use Text by default

@ngregory-rbi
Copy link
Author

We have our own custom Text component that we use. Currently, I am using it for the different block types, so that works so far. I'm not sure though how it will work in different scenarios.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants