在我的本机应用程序中,我有一个使用 react-navigation-material-bottom-tabs 的路由器组件。
在那个组件中,我像这样创建了它。
const tabNavigator = createMaterialBottomTabNavigator({
home: {
screen: Home,
navigationOptions: ({ navigation }) => ({
title: ''
})
},
createCampaign: {
screen: CreateCampaign,
navigationOptions: ({ navigation }) => ({
title: '',
tabBarVisible: false
})
},
settings: {
screen: AllSettings,
navigationOptions: ({ navigation }) => ({
title: ''
})
}
});
Run Code Online (Sandbox Code Playgroud)
这工作正常。但我想在某些情况下禁用此栏的某些选项卡。例如,如果配置文件尚未获得批准,请禁用设置选项卡。有什么办法可以在我的屏幕上执行此操作吗?(最好不在路由器中,因为我无法在路由器中发送 API 请求)。如何访问屏幕中的 tabBar 选项?如何禁用选项卡?请帮忙。
我试图将我的项目文件推送到我的存储库.但是,当我这样做时,我会收到错误,如下面的截图所示.
之前我在该项目文件中有一个存储库,我删除了它.现在我在该项目文件中创建了另一个具有不同名称的存储库.但我现在得到这些错误.请告诉我应该怎么做.
在我的应用程序中,我有谷歌地图。它的实现如下所示。
<MapView style={[styles.mapStyle, { flex: 1, width: this.state.mapWidth }]}
initialRegion={{
latitude: this.state.latitude,
longitude: this.state.longitude,
latitudeDelta: 0.1,
longitudeDelta: 0.1,
}}
provider={PROVIDER_GOOGLE}
onPress={this.onMapPress.bind(this)}
showsUserLocation={true}
followsUserLocation={true}
showsMyLocationButton={true}
showsCompass={true}
showsTraffic={true}
toolbarEnabled={true}
onMapReady={() => this.setState({ width: width - 1 })}
>
<Marker draggable
coordinate={{
latitude: this.state.latitude,
longitude: this.state.longitude,
}}
onDragEnd={(e) => this.setState({ x: e.nativeEvent.coordinate })}
/>
<Circle
center={{
latitude: this.state.latitude,
longitude: this.state.longitude,
}}
radius={this.state.radius}
fillColor='rgba(253, 48, 4,0.5)'
strokeColor='rgba(253, 48, 4,1)'
/>
</MapView>
Run Code Online (Sandbox Code Playgroud)
当我单击一个按钮时,我会更改地图区域的状态值。
changeRegion(){
this.setState({ latitude: 6.86, longitude: 6.86 });
}
Run Code Online (Sandbox Code Playgroud)
这成功地改变了地图标记的位置。
我的问题是,地图没有移动到选定的位置。我怎样才能做到这一点?