From 9aa8aa7d5d5aad5592b40096f6ddb6e1d5c19138 Mon Sep 17 00:00:00 2001 From: Cameron Voell Date: Sun, 2 Feb 2020 22:39:28 -0800 Subject: [PATCH] Adjusted function name and lines for readability --- .../bottom-sheet/cycle-picker-cell.native.js | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/packages/components/src/mobile/bottom-sheet/cycle-picker-cell.native.js b/packages/components/src/mobile/bottom-sheet/cycle-picker-cell.native.js index 431b86cdc7eaa..489464807827a 100644 --- a/packages/components/src/mobile/bottom-sheet/cycle-picker-cell.native.js +++ b/packages/components/src/mobile/bottom-sheet/cycle-picker-cell.native.js @@ -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 ( onChangeValue( cycleOptionValue() ) } + onPress={ () => onChangeValue( nextOptionValue() ) } editable={ false } value={ options[ findIndex( options, [ 'value', value ] ) ].label } { ...cellProps }