2016-09-08 11 views
0

사용자가 화면에서 손가락을 드래그하지 않으면 API를 호출 할 수 있도록 일부 이벤트 수신기를 시작하려고합니다. 나는 네이티브 0.32 반응을 실행 중이고 react-native-maps npm 모듈을 사용하고 있습니다. 아래는 내가 사용하고 코드의 베어 본 버전은, 내가 예상처럼 작동 이벤트의 없음처럼 보인다React Native Maps : 이벤트 리스너가 작동하지 않습니다.

import React, { Component } from 'react'; 
import MapView from 'react-native-maps'; 
import { 
    StyleSheet, 
    View, 
} from 'react-native'; 

var styles = StyleSheet.create({ 
    container: { 
     backgroundColor: '#003D40', 
     flex: 1, 
     marginTop: 65 
    }, 
    map: { 
     position: 'absolute', 
     top: 0, 
     left: 0, 
     right: 0, 
     bottom: 0, 
     }, 
}) 
class Main extends React.Component{ 
    constructor(props) { 
     super(props); 
     this.state = { 
      region: { 
       latitude: 37.78825, 
       longitude: -122.4324, 
       latitudeDelta: 0.0922, 
       longitudeDelta: 0.0421, 
      } 
     } 
    } 
    onRegionChange(region) { 
     this.setState({ 
     region: region 
     }); 
    } 
    render() { 
     return (
      <View style={styles.container}> 
       <MapView.Animated 
         region={this.state.region} 
         onRegionChange={this.onRegionChange.bind(this)} 
         style={ styles.map }      
       > 
        <MapView.Marker 
          coordinate={this.state.region} 
          draggable 
          onSelect={() => console.log('onSelect', arguments)} 
          onDrag={() => console.log('onDrag', arguments)} 
          onDragStart={() => console.log('onDragStart', arguments)} 

         /> 
       </MapView.Animated> 
      </View> 
     ) 
    } 
} 
module.exports = Main; 

나는이 작업을 얻을 수있는 방법에 대한 아이디어? 어떤 도움을 주시면 감사하겠습니다!

답변

관련 문제