meliorence / react-native-render-html

iOS/Android pure javascript react-native component that renders your HTML into 100% native views
https://meliorence.github.io/react-native-render-html/
BSD 2-Clause "Simplified" License
3.48k stars 589 forks source link

When I use customRender To replace a to div it doesn's work, or wrap a tag. #578

Closed jamninetyfive closed 2 years ago

jamninetyfive commented 2 years ago

Decision Table

Good Faith Declaration

Description

When I use customRender To replace a to div it doesn's work, or wrap a tag.

React Native Information

System:
    OS: macOS 12.4
    CPU: (8) arm64 Apple M1 Pro
    Memory: 102.94 MB / 16.00 GB
    Shell: 5.8.1 - /bin/zsh
  Binaries:
    Node: 14.19.1 - /opt/homebrew/opt/node@14/bin/node
    Yarn: 1.22.18 - /opt/homebrew/bin/yarn
    npm: 6.14.16 - /opt/homebrew/opt/node@14/bin/npm
    Watchman: 2022.03.21.00 - /opt/homebrew/bin/watchman
  Managers:
    CocoaPods: 1.11.3 - /opt/homebrew/bin/pod
  SDKs:
    iOS SDK:
      Platforms: DriverKit 21.4, iOS 15.5, macOS 12.3, tvOS 15.4, watchOS 8.5
    Android SDK: Not Found
  IDEs:
    Android Studio: 2021.2 AI-212.5712.43.2112.8609683
    Xcode: 13.4.1/13F100 - /usr/bin/xcodebuild
  Languages:
    Java: 11.0.15 - /usr/bin/javac
  npmPackages:
    @react-native-community/cli: Not Found
    react: 17.0.2 => 17.0.2 
    react-native: Not Found
    react-native-macos: Not Found
  npmGlobalPackages:
    *react-native*: Not Found

RNRH Version

6.3.4

Tested Platforms

Reproduction Platforms

Minimal, Reproducible Example

const htmlTpl = <a href="action1" style="outline: none;text-decoration: none;color:#fff;width: 72px;height:24px;line-height:24px;text-align:center;font-size:10px;background:#49C167;border-radius: 20px;">text</a>

const onPress = () => Toast.show(11111)

// (TypeScript) Notice the type for intellisense const DivRenderer: CustomBlockRenderer = function DivRenderer({ TDefaultRenderer, ...props }) { return <TDefaultRenderer {...props} onPress={onPress} />; }

const renderers = { a: DivRenderer };

<RenderHTML contentWidth={230} source={ { html: htmlView } } renderersProps={renderers} />

Additional Notes

i wanna replace a to div. or add onpress to div.

both doesn't work. need help .please