使用部分链接反应Native WebView source.html

时间:2017-12-11 09:07:52

标签: react-native react-native-ios

对于使用source.html内容的简单反应原生webview:

import * as React from 'react'

const contents =`
    <h1 id="1">Section 1</h1>        
    <h1 id="2">Section 2</h1>
`;

class AboutView extends React.Component {
    render() {
        return <WebView  source={{ html: contents, baseUrl: '' }} />
    }
}

有没有办法使用命名锚点将webview导航到特定部分,例如#1#2就像放入网址一样?我知道这可以用JS实现,但我想知道是否有更清洁的解决方案

0 个答案:

没有答案