File tree Expand file tree Collapse file tree 1 file changed +10
-3
lines changed
source/views/transportation/bus Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ import type {TopLevelViewPropsType} from '../../types'
1010import { getScheduleForNow } from './lib'
1111import zip from 'lodash/zip'
1212import uniqBy from 'lodash/uniqBy'
13+ import isEqual from 'lodash/isEqual'
1314
1415import { data as defaultBusLines } from '../../../../docs/bus-times.json'
1516
@@ -60,13 +61,19 @@ export class BusMapView extends React.PureComponent {
6061 } ,
6162 }
6263
63- onRegionChange = ( region : {
64+ onRegionChangeComplete = ( newRegion : {
6465 latitude : number ,
6566 latitudeDelta : number ,
6667 longitude : number ,
6768 longitudeDelta : number ,
6869 } ) => {
69- this . setState ( ( ) => ( { region} ) )
70+ this . setState ( state => {
71+ if ( isEqual ( state . region , newRegion ) ) {
72+ return
73+ }
74+
75+ return { region : newRegion }
76+ } )
7077 }
7178
7279 updateTime = ( ) => {
@@ -109,7 +116,7 @@ export class BusMapView extends React.PureComponent {
109116 < MapView
110117 region = { this . state . region }
111118 style = { styles . map }
112- onRegionChange = { this . onRegionChange }
119+ onRegionChangeComplete = { this . onRegionChangeComplete }
113120 loadingEnabled = { true }
114121 >
115122 { markers . map ( ( [ [ latitude , longitude ] , title ] , i ) =>
You can’t perform that action at this time.
0 commit comments