【问题标题】:Does react-native support NSDataDetector?react-native 是否支持 NSDataDetector?
【发布时间】:2018-11-28 20:18:16
【问题描述】:

有没有办法从react-native 访问Cocoa 的NSDataDetector

类似于UITextViewdataDetectorTypes

我想用它来自动检测地址,链接到地图。

【问题讨论】:

    标签: ios cocoa react-native nsdatadetector


    【解决方案1】:

    我不认为 N​​SDataDetector 本身支持 RN atm。但是您可能会对几个库感兴趣。

    我不确定我的回答能否解决您的问题。但我需要启用可点击的文本链接和电话号码。

    反应原生 html 视图 - https://github.com/jsdf/react-native-htmlview.

    这帮助我解决了我的问题。 也可以看看AutoLinker

    【讨论】:

    • 感谢您的建议!
    【解决方案2】:

    React Native 的 TextInput 组件有一个 dataDetectorProps 可以完全满足您的需求。

    【讨论】:

    • 不完全是——那是用于输入文本,我想用它来装饰来自服务器的文本,在 中提供。
    • @David iOS 上的多行 TextInput 将是 UITextView。根据 Apple 的文档:UITextView supports the display of text using custom style information and also supports text editing. You typically use a text view to display multiple lines of text, such as when displaying the body of a large text document.。所以它不仅可以用于输入文本。理想情况下,您可以将其包装在另一个名称更好的组件中
    猜你喜欢
    • 1970-01-01
    • 2018-03-17
    • 1970-01-01
    • 1970-01-01
    • 2018-09-19
    • 1970-01-01
    • 2019-03-21
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多