对于使用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实现,但我想知道是否有更清洁的解决方案