Skip to content

Commit

Permalink
Adjusted function name and lines for readability
Browse files Browse the repository at this point in the history
  • Loading branch information
cameronvoell committed Feb 3, 2020
1 parent 9e71910 commit 9aa8aa7
Showing 1 changed file with 5 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,16 @@ import { findIndex } from 'lodash';
import Cell from './cell';

export default function BottomSheetCyclePickerCell( props ) {
const {
value,
options,
onChangeValue,
...cellProps
} = props;
const { value, options, onChangeValue, ...cellProps } = props;

const cycleOptionValue = () => {
return options[ ( findIndex( options, [ 'value', value ] ) + 1 ) % options.length ].value;
const nextOptionValue = () => {
const selectedOptionIndex = findIndex( options, [ 'value', value ] );
return options[ ( selectedOptionIndex + 1 ) % options.length ].value;
};

return (
<Cell
onPress={ () => onChangeValue( cycleOptionValue() ) }
onPress={ () => onChangeValue( nextOptionValue() ) }
editable={ false }
value={ options[ findIndex( options, [ 'value', value ] ) ].label }
{ ...cellProps }
Expand Down

0 comments on commit 9aa8aa7

Please sign in to comment.