-
Notifications
You must be signed in to change notification settings - Fork 693
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of https://github.com/mapbox/react-native-mapbo…
- Loading branch information
Showing
11 changed files
with
168 additions
and
115 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,54 +1,70 @@ | ||
'use strict' | ||
|
||
var React = require('react-native'); | ||
var { NativeModules, requireNativeComponent } = React; | ||
|
||
var ReactMapView = requireNativeComponent('RCTMapbox', { | ||
name: 'RCTMapbox', | ||
propTypes: { | ||
accessToken: React.PropTypes.string.isRequired, | ||
annotations: React.PropTypes.arrayOf(React.PropTypes.shape({ | ||
title: React.PropTypes.string, | ||
subtitle: React.PropTypes.string, | ||
coordinates: React.PropTypes.arrayOf(), | ||
alpha: React.PropTypes.number, | ||
fillColor: React.PropTypes.string, | ||
strokeColor: React.PropTypes.string, | ||
strokeWidth: React.PropTypes.number | ||
})), | ||
centerCoordinate: React.PropTypes.shape({ | ||
latitude: React.PropTypes.number.isRequired, | ||
longitude: React.PropTypes.number.isRequired | ||
}), | ||
debugActive: React.PropTypes.bool, | ||
direction: React.PropTypes.number, | ||
rotationEnabled: React.PropTypes.bool, | ||
scrollEnabled: React.PropTypes.bool, | ||
showsUserLocation: React.PropTypes.bool, | ||
styleUrl: React.PropTypes.string, | ||
UserLocationTrackingMode: React.PropTypes.oneOf(['NONE', 'FOLLOW']), | ||
zoomEnabled: React.PropTypes.bool, | ||
zoomLevel: React.PropTypes.number, | ||
onRegionChange: React.PropTypes.func, | ||
// Fix for https://github.com/mapbox/react-native-mapbox-gl/issues/118 | ||
scaleY: React.PropTypes.number, | ||
scaleX: React.PropTypes.number, | ||
translateY: React.PropTypes.number, | ||
translateX: React.PropTypes.number, | ||
rotation: React.PropTypes.number | ||
}, | ||
defaultProps() { | ||
return { | ||
centerCoordinate: { | ||
latitude: 0, | ||
longitude: 0 | ||
}, | ||
debugActive: false, | ||
direction: 0, | ||
rotationEnabled: true, | ||
scrollEnabled: true, | ||
showsUserLocation: false, | ||
styleUrl: 'asset://styles/streets-v8.json', | ||
UserLocationTrackingMode: 'NONE', | ||
zoomEnabled: true, | ||
zoomLevel: 0 | ||
}; | ||
} | ||
}); | ||
|
||
var MapView = React.createClass({ | ||
propTypes: { | ||
accessToken: React.PropTypes.string.isRequired, | ||
annotations: React.PropTypes.arrayOf(React.PropTypes.shape({ | ||
title: React.PropTypes.string, | ||
subtitle: React.PropTypes.string, | ||
coordinates: React.PropTypes.arrayOf(), | ||
alpha: React.PropTypes.number, | ||
fillColor: React.PropTypes.string, | ||
strokeColor: React.PropTypes.string, | ||
strokeWidth: React.PropTypes.number | ||
})), | ||
centerCoordinate: React.PropTypes.shape({ | ||
latitude: React.PropTypes.number.isRequired, | ||
longitude: React.PropTypes.number.isRequired | ||
}), | ||
debugActive: React.PropTypes.bool, | ||
direction: React.PropTypes.number, | ||
rotationEnabled: React.PropTypes.bool, | ||
scrollEnabled: React.PropTypes.bool, | ||
showsUserLocation: React.PropTypes.bool, | ||
styleUrl: React.PropTypes.string, | ||
UserLocationTrackingMode: React.PropTypes.string, | ||
zoomEnabled: React.PropTypes.bool, | ||
zoomLevel: React.PropTypes.number | ||
var ReactMapViewWrapper = React.createClass({ | ||
handleOnChange(event) { | ||
if (this.props.onRegionChange) this.props.onRegionChange(event.nativeEvent.src); | ||
}, | ||
getDefaultProps() { | ||
return { | ||
centerCoordinate: { | ||
latitude: 0, | ||
longitude: 0 | ||
}, | ||
debugActive: false, | ||
direction: 0, | ||
rotationEnabled: true, | ||
scrollEnabled: true, | ||
showsUserLocation: false, | ||
styleUrl: 'asset://styles/streets-v8.json', | ||
UserLocationTrackingMode: 'NONE', | ||
zoomEnabled: true, | ||
zoomLevel: 0 | ||
}; | ||
}, | ||
render: function() { | ||
return (<Mapbox {...this.props} />); | ||
render() { | ||
return <ReactMapView | ||
{...this.props} | ||
onChange={this.handleOnChange} /> | ||
} | ||
}); | ||
|
||
|
||
module.exports = requireNativeComponent('RCTMapbox', MapView); | ||
module.exports = ReactMapViewWrapper; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.