Open ajprince21 opened 1 month ago
I don't think this library is supposed to handle corrupt HTML as you would expect a browser to do. The introduction at https://meliorence.github.io/react-native-render-html/docs/intro specifically says:
- The best use case for library is when the content to render is predictable (e.g. you know in advance the tags and classes to support)
- You should probably not use this library if you need to render arbitrary, unpredictable content.
Hii @SjaakSchilperoort
Since HTML data can be dynamic and unpredictable, enhancing the library to handle incorrect or malformed HTML gracefully would be beneficial. Instead of throwing an error that crashes the application, returning an empty element (<></>) would allow the app to maintain its stability and provide a better user experience.
This way, developers can handle unexpected HTML content without significant disruptions, making the library more robust for real-world use cases where HTML cannot be fully controlled. Implementing such a feature could improve usability significantly for those dealing with varied and dynamic HTML content.
Decision Table
<yyy>
is not rendered”Good Faith Declaration
Description
The react-native-render-html library crashes when rendering HTML content with invalid syntax, such as improperly paired tags. The application should handle these cases gracefully instead of crashing, providing a clear error message or fallback rendering.![Simulator Screenshot - iPhone 15 Pro - 2024-07-31 at 14 20 49](https://github.com/user-attachments/assets/571d191e-c809-4822-8bc4-33fc54e3967d)
React Native Information
RNRH Version
"react-native": "0.72.4", "react-native-webview": "^13.10.5", "react-native-render-html": "^6.3.4",
Tested Platforms
Reproduction Platforms
Minimal, Reproducible Example
can pass this content
const htmlContent = "
Sweep over cheeks with brush, blending from the apples of cheeks back towards the hairline.sampai ke hairline. ";Additional Notes
No response