Как разместить плавающую кнопку в реагирующем родном mapbox GL - PullRequest
0 голосов
/ 20 февраля 2019

Я работаю над React native и использую библиотеку Mapbox GL для отображения карты.Теперь я хочу добавить кнопку в центр просмотра Mapbox GL.Ниже то, что я получаю.screenshot

Вот код.

      <View style={styles.container}>

        <Mapbox.MapView
          style={{flex: 1}}
          styleURL={Mapbox.StyleURL.Dark}
          zoomLevel={15}
          centerCoordinate={[79.900424, 6.867281]}
          showUserLocation={true}
          logoEnabled={false}
          rotateEnabled={false}
          attributionEnabled={false}
          animated={true}
          style={styles.container}>
        </Mapbox.MapView>

        <View style={{width:30, backgroundColor:"transparent"}}>
          <Button title="Button"></Button>
        </View>

      </View>

      const styles = StyleSheet.create({
        container: {
          flex: 1,
        }
      });

Как я могу это исправить?

1 Ответ

0 голосов
/ 20 февраля 2019

попробуйте,

<View style={{width:30, backgroundColor:"transparent",position:'absolute',top:"50%",left:"50%",zIndex:10}}>
    <Button title="Button"></Button>
</View>
...