react-native-render-html icon indicating copy to clipboard operation
react-native-render-html copied to clipboard

Fix deprecated defaultProps error warning

Open tristanheilman opened this issue 7 months ago • 16 comments

  • upgraded to work with react native 0.75.5
  • tested locally with react native 0.75.5
  • upgraded to typescript v5
  • fixed linting error

Checks

  • [x] I have read the contribution guidelines regarding Pull Requests here: https://git.io/JJ0Pg

Description

Below is a public repository that provides a simple test on a barebones React Native 0.75.5 project. v1.0.0 shows the error that this issue describes. v2.0.0 shows the provided patch and passing tests.

https://github.com/tristanheilman/react-native-render-html-684-test/releases

NOTE: There was one item that I didn't spend time figuring out and that was the website portion of this repository. I was getting errors with the rdocusaurus-plugin-sass repository due it using a git branch checkout. I was unable to run yarn install until providing a valid repository version.

Fixes issue #684

tristanheilman avatar May 23 '25 02:05 tristanheilman

Any updates on this?

besouro7 avatar Jun 13 '25 14:06 besouro7

Why no updates on this? Any patch or suggestion to do if the update is not coming soon?

dev-sulav avatar Jun 24 '25 12:06 dev-sulav

BUMP

JustinKubicz avatar Jun 24 '25 13:06 JustinKubicz

+1 bump

paul7aa avatar Jun 24 '25 15:06 paul7aa

Why no updates on this? Any patch or suggestion to do if the update is not coming soon?

A patch file is provided in the test repository that I shared. It can be found at this link: https://github.com/tristanheilman/react-native-render-html-684-test/blob/main/.yarn/patches/react-native-render-html-npm-6.3.4-35624feabf.patch

I'm unsure if yarn will allow you to straight copy over the patch file into your .yarn/patches folder. You may need to follow the below steps to patch from scratch.

To patch the library temporarily, you can follow the below steps:

  1. Clone the https://github.com/tristanheilman/react-native-render-html-684-test repository
  2. Run yarn install
  • You will utilize the node_modules/react-native-render-html folder later
  1. Install the react-native-render-html library in your main project using yarn
  2. Run yarn patch react-native-render-html
➤ YN0000: Package react-native-render-html@npm:6.3.4 got extracted with success!
➤ YN0000: You can now edit the following folder: /private/var/folders/_q/5t99hgx90cg4_4hjs5fg0gsr0000gn/T/xfs-682b0fea/user
➤ YN0000: Once you are done run yarn patch-commit -s /private/var/folders/_q/5t99hgx90cg4_4hjs5fg0gsr0000gn/T/xfs-682b0fea/user and Yarn will store a patchfile based on your changes.
➤ YN0000: Done in 0s 121ms
  1. Navigate to the folder that yarn has created to edit the contents of the library
  2. Copy over the contents of the node_modules/react-native-render-html project from the 684-test repository into the yarn private folder and replace everything that is a duplicate
  3. Run yarn patch-commit -s {folderName}

The patch file should be created and stored in your .yarn/patches folder. You can compare it to the patch file created in the 684-test repository to confirm.

tristanheilman avatar Jun 24 '25 19:06 tristanheilman

Any plans to merge this soon??? This error is getting annoying.

dlujan avatar Jun 25 '25 16:06 dlujan

When will this fix be merged?

ThiaAlves avatar Jul 09 '25 17:07 ThiaAlves

This is now a P0 since it become an error on Expo 52 (React Native 0.76.* and Android sdk 34 target) and Google policies requires apps to be update to Android sdk 35 till August 31th.

carlosascastro avatar Aug 06 '25 00:08 carlosascastro

Hey, for anyone who don't want to go through all steps @tristanheilman mentions. This is his patch file you can put directly in /patches folder and just use patch-package. react-native-render-html+6.3.4.patch

palicko avatar Aug 12 '25 08:08 palicko

Hey, if patch from @palicko doesn't work, please try mine: react-native-render-html+6.3.4.patch

olegmilan avatar Aug 18 '25 14:08 olegmilan

@olegmilan Thanks, the patch worked perfectly

AvinashShine avatar Aug 21 '25 07:08 AvinashShine

Hey, for whom patch form @palicko doesn't work, please try mine: react-native-render-html+6.3.4.patch

Seems to work well for me RN 0.79+, Thanks

noumantahir avatar Aug 25 '25 11:08 noumantahir

+1

thomas-kroeniger-dfl avatar Sep 03 '25 07:09 thomas-kroeniger-dfl

thank you for the patch, it worked.

but we need this as default. any release plans?

mertcankat-ha avatar Sep 03 '25 08:09 mertcankat-ha

Hey, for whom patch form @palicko doesn't work, please try mine: react-native-render-html+6.3.4.patch

This worked well for me.

However I was still getting some other warnings like : "Warning: Failed prop type: The prop ignoredStyles is marked as required in TRenderEngineProvider, but its value is undefined.", "Warning: Failed prop type: The prop customHTMLElementModels is marked as required in TRenderEngineProvider, but its value is undefined.", "Warning: Failed prop type: The prop emSize is marked as required in TRenderEngineProvider, but its value is undefined.",

If you get these warnings as well, just try passing these props explicitly into your <RenderHTML />:
------
import RenderHTML, { defaultSystemFonts } from 'react-native-render-html';

<RenderHTML
 customHTMLElementModels={{}}
 ignoredStyles={[]}
 emSize={16}
 systemFonts={[...defaultSystemFonts]}
/>
------

NxsHbb avatar Sep 09 '25 03:09 NxsHbb

+1 can we please merge this

stevecooktimjob avatar Nov 14 '25 21:11 stevecooktimjob