我正在尝试使用 mapbox-sdk 从 npm 包中获取用于 react-native 的导航方向:
"@mapbox/mapbox-sdk": "^0.11.0"
为了渲染 mapbox-sdk 返回的方向,我使用了以下 npm 包:
"@react-native-mapbox-gl/maps": "^8.1.0-rc.8",
我用于检索方向的代码:
import MapboxGL from '@react-native-mapbox-gl/maps'
// Mapbox SDK related package
import MapboxDirectionsFactory from '@mapbox/mapbox-sdk/services/directions'
import { lineString as makeLineString } from '@turf/helpers'
import GeoLocationService from '../../services/geolocation/GeoLocationService';
import GeoLocationCore from '@react-native-community/geolocation'
const accessToken = "ACESS_TOKEN_FROM_MAPBOX_API_DASHBOARD"
const directionsClient = MapboxDirectionsFactory({accessToken})
constructor(props) {
super(props);
this.state = {
longitude: 0,
latitude: 0,
orderLongitude: 0,
orderLatitude: 0,
route: null,
};
}
async componentDidMount() {
const {route} = this.props
// …Run Code Online (Sandbox Code Playgroud) 我将<WebView>其嵌入到<Card.Content>我正在使用的a 中react-native-paper。我正在尝试可WebView滚动。网页视图显示但不可滚动。
我正在使用的代码:
<Card theme={{ roundness: 20 }} style={{ margin: 10, height: height*0.8 }} elevation={14}>
<Card.Content style={{ flex: 1 }}>
<View style={{ justifyContent: "center", alignItems: "center" }}>
<WebView
style={{ width: width * 0.8, height: height * 0.9 }}
allowsBackForwardNavigationGestures={false}
source={{ uri: "https://paypal.com"}}
pullToRefreshEnabled={false}
javaScriptEnabled
startInLoadingState
decelerationRate="normal"
scalesPageToFit={Platform.OS == "android"? false : true}
originWhitelist={['*']}
domStorageEnabled={true}
scrollEnabled
renderError={e => { console.log(e); }}
/>
</View>
</Card.Content>
</Card>
Run Code Online (Sandbox Code Playgroud)
我怎样才能使WebView滚动?
android ios react-native react-native-webview react-native-paper