html转换react native,React native HTML entities
I'm fetching some data in app from WordPress site successfully. Some entities like "?" react native don't want to make like quotes and many more issues I have.
Is there some way to make HTML entities right in React Native App?
Thanks in advance.
# Answer 1
You should be able to use something like html-entities to decode the text before rendering:
const entities = new Entities();
entities.decode('?') // "?" (double low quotation mark)
# Answer 2
Here's how to import and use a specific subpackage of Entities if the example in 'html-entities' README, which uses require(), won't work for you.
import {Html5Entities} from 'html-entities';
const entities = new Html5Entities();
entities.decode(stringToBeDecoded);
總結(jié)
以上是生活随笔為你收集整理的html转换react native,React native HTML entities的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 唐山一游客私自翻进园内逗大熊猫 危险:大
- 下一篇: 2023年安卓之光!小米13 Ultra