Skip to content

Commit 4039af7

Browse files
author
Rob Gregg
committed
fix(PatternSTopCard.js): Fixed prop bug
#668
1 parent 826088d commit 4039af7

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

lib/editor/components/pattern/PatternStopCard.js

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ type Props = {
4444
rowStyle: {[string]: number | string},
4545
saveActiveGtfsEntity: typeof activeActions.saveActiveGtfsEntity,
4646
selectType: string,
47-
selectValue: string,
4847
setActiveEntity: typeof activeActions.setActiveEntity,
4948
setActiveStop: typeof tripPatternActions.setActiveStop,
5049
shouldHaveDisabledOption: boolean,
@@ -53,7 +52,8 @@ type Props = {
5352
stopIsActive: boolean,
5453
title: string,
5554
updateActiveGtfsEntity: typeof activeActions.updateActiveGtfsEntity,
56-
updatePatternStops: typeof tripPatternActions.updatePatternStops
55+
updatePatternStops: typeof tripPatternActions.updatePatternStops,
56+
value: string
5757
}
5858

5959
type State = {
@@ -83,7 +83,7 @@ const pickupDropoffOptions = [
8383

8484
// renders the form control drop downs for dropOff/Pick up and also continuous
8585
const PickupDropoffSelect = (props: Props) => {
86-
const {activePattern, controlLabel, selectType, shouldHaveDisabledOption, title, onChange, selectValue} = props
86+
const {activePattern, controlLabel, selectType, shouldHaveDisabledOption, title, onChange, value} = props
8787
const hasShapeId = activePattern.shapeId === null
8888
return (
8989
<FormGroup
@@ -99,7 +99,7 @@ const PickupDropoffSelect = (props: Props) => {
9999
disabled={shouldHaveDisabledOption && hasShapeId}
100100
componentClass='select'
101101
onChange={onChange}
102-
value={selectValue}
102+
value={value}
103103
placeholder='select'>
104104
{pickupDropoffOptions.map(o => (
105105
<option key={o.value} value={o.value}>{o.text}</option>
@@ -307,14 +307,15 @@ class PatternStopContents extends Component<Props, State> {
307307
updatePatternStops(activePattern, patternStops)
308308
}
309309

310-
onChange = (evt: SyntheticInputEvent<HTMLInputElement>) => {
310+
_onPickupOrDropOffChange = (evt: SyntheticInputEvent<HTMLInputElement>) => {
311311
const selectedOptionValue: number = parseInt(evt.target.value, 10)
312312
const {activePattern, index, updatePatternStops} = this.props
313313
const patternStops = [...activePattern.patternStops]
314314

315315
patternStops[index][evt.target.id] = selectedOptionValue
316316
this.setState({update: true})
317317
updatePatternStops(activePattern, patternStops)
318+
console.log('made it to here')
318319
}
319320

320321
render () {
@@ -383,7 +384,7 @@ class PatternStopContents extends Component<Props, State> {
383384
title='Define the pickup method/availability at this stop.'
384385
controlLabel='Pickup'
385386
value={patternStop.pickupType || ''}
386-
onChange={this.onChange}
387+
onChange={this._onPickupOrDropOffChange}
387388
/>
388389
</Col>
389390
<Col xs={6}>
@@ -394,7 +395,7 @@ class PatternStopContents extends Component<Props, State> {
394395
title='Define the dropff method/availability at this stop.'
395396
controlLabel='Drop-off'
396397
value={patternStop.dropOffType || ''}
397-
onChange={this.onChange}
398+
onChange={this._onPickupOrDropOffChange}
398399
/>
399400
</Col>
400401
</Row>
@@ -407,7 +408,7 @@ class PatternStopContents extends Component<Props, State> {
407408
title='Indicates whether a rider can board the transit vehicle anywhere along the vehicle’s travel path.'
408409
controlLabel='Continuous pickup'
409410
value={patternStop.continuousPickup || ''}
410-
onChange={this.onChange}
411+
onChange={this._onPickupOrDropOffChange}
411412
/>
412413
</Col>
413414
<Col xs={6}>
@@ -418,7 +419,7 @@ class PatternStopContents extends Component<Props, State> {
418419
title='Indicates whether a rider can alight from the transit vehicle at any point along the vehicle’s travel path.'
419420
controlLabel='Continuous drop-off'
420421
value={patternStop.continuousDropOff || ''}
421-
onChange={this.onChange}
422+
onChange={this._onPickupOrDropOffChange}
422423
/>
423424
</Col>
424425
</Row>

0 commit comments

Comments
 (0)