/**
* Picker.tsx
*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT license.
*
* Web-specific implementation of the cross-platform Select abstraction.
*/
import * as React from 'react';
import * as RX from '../common/Interfaces';
import * as _ from './utils/lodashMini';
import Styles from './Styles';
export class Picker extends RX.Picker {
render() {
return (
);
}
private _getStyles(): RX.Types.PickerStyleRuleSet {
return Styles.combine(this.props.style) as any;
}
private _onValueChange = (e: React.SyntheticEvent) => {
const selectEl = e.target as HTMLSelectElement;
const selectedValue = selectEl.value;
const selectedItemPosition = _.findIndex(this.props.items, i => i.value === selectedValue);
this.props.onValueChange(selectedValue, selectedItemPosition);
}
}
export default Picker;