我用react-native-maps的react-native,我愿意用我自己的按钮“左”“右”,“向上”和“向下”,而不是用手指轻扫。(也是一个旋转按钮)
我在网上搜索了很多,但找不到解决方案。
我可以使用 setInterval 并在经度或纬度上添加一个数字,但这是/非常数据密集,速度慢且不太流畅。
<MapView style={{ flex: 1 }}
initialRegion={this.state.region}
followUserLocation={false}
showsUserLocation={false}
zoomEnabled={false}
zoomControlEnabled={false}
zoomTapEnabled={false}
rotateEnabled={false}
scrollEnabled={false}
></MapView>
<Button title="up" onPress... />
<Button title="down" onPress.../>
<Button title="left" onPress... />
<Button title="right onPress... />
<Button title="rotate-left" onPress... />
<Button title="rotate-right" onPress... />
Run Code Online (Sandbox Code Playgroud)