1313
1414var EdgeInsetsPropType = require ( 'EdgeInsetsPropType' ) ;
1515var NativeMethodsMixin = require ( 'NativeMethodsMixin' ) ;
16+ var Platform = require ( 'Platform' ) ;
1617var React = require ( 'React' ) ;
1718var ReactIOSViewAttributes = require ( 'ReactIOSViewAttributes' ) ;
1819var View = require ( 'View' ) ;
@@ -21,6 +22,7 @@ var createReactIOSNativeComponentClass = require('createReactIOSNativeComponentC
2122var deepDiffer = require ( 'deepDiffer' ) ;
2223var insetsDiffer = require ( 'insetsDiffer' ) ;
2324var merge = require ( 'merge' ) ;
25+ var requireNativeComponent = require ( 'requireNativeComponent' ) ;
2426
2527type Event = Object ;
2628type MapRegion = {
@@ -156,46 +158,30 @@ var MapView = React.createClass({
156158 } ,
157159
158160 render : function ( ) {
159- return (
160- < RCTMap
161- style = { this . props . style }
162- showsUserLocation = { this . props . showsUserLocation }
163- zoomEnabled = { this . props . zoomEnabled }
164- rotateEnabled = { this . props . rotateEnabled }
165- pitchEnabled = { this . props . pitchEnabled }
166- scrollEnabled = { this . props . scrollEnabled }
167- region = { this . props . region }
168- annotations = { this . props . annotations }
169- maxDelta = { this . props . maxDelta }
170- minDelta = { this . props . minDelta }
171- legalLabelInsets = { this . props . legalLabelInsets }
172- onChange = { this . _onChange }
173- onTouchStart = { this . props . onTouchStart }
174- onTouchMove = { this . props . onTouchMove }
175- onTouchEnd = { this . props . onTouchEnd }
176- onTouchCancel = { this . props . onTouchCancel }
177- />
178- ) ;
161+ return < RCTMap { ...this . props } onChange = { this . _onChange } /> ;
179162 } ,
180-
181163} ) ;
182164
183- var RCTMap = createReactIOSNativeComponentClass ( {
184- validAttributes : merge (
185- ReactIOSViewAttributes . UIView , {
186- showsUserLocation : true ,
187- zoomEnabled : true ,
188- rotateEnabled : true ,
189- pitchEnabled : true ,
190- scrollEnabled : true ,
191- region : { diff : deepDiffer } ,
192- annotations : { diff : deepDiffer } ,
193- maxDelta : true ,
194- minDelta : true ,
195- legalLabelInsets : { diff : insetsDiffer } ,
196- }
197- ) ,
198- uiViewClassName : 'RCTMap' ,
199- } ) ;
165+ if ( Platform . OS === 'android' ) {
166+ var RCTMap = createReactIOSNativeComponentClass ( {
167+ validAttributes : merge (
168+ ReactIOSViewAttributes . UIView , {
169+ showsUserLocation : true ,
170+ zoomEnabled : true ,
171+ rotateEnabled : true ,
172+ pitchEnabled : true ,
173+ scrollEnabled : true ,
174+ region : { diff : deepDiffer } ,
175+ annotations : { diff : deepDiffer } ,
176+ maxDelta : true ,
177+ minDelta : true ,
178+ legalLabelInsets : { diff : insetsDiffer } ,
179+ }
180+ ) ,
181+ uiViewClassName : 'RCTMap' ,
182+ } ) ;
183+ } else {
184+ var RCTMap = requireNativeComponent ( 'RCTMap' , MapView ) ;
185+ }
200186
201187module . exports = MapView ;
0 commit comments