Skip to content

Commit

Permalink
Rename variable after rebase
Browse files Browse the repository at this point in the history
  • Loading branch information
ciampo committed Mar 2, 2022
1 parent 2be3ac5 commit 49b645b
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ export default function LineHeightControl( { value: lineHeight, onChange } ) {
step={ STEP }
value={ value }
onChange={ onChange }
units={ [] }
// TODO: should be updated to avoid using `false`, in order to
// align with the web version of `UnitControl`
units={ false }
/>
);
}
6 changes: 4 additions & 2 deletions packages/components/src/unit-control/index.native.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,13 +116,15 @@ function UnitControl( {
};

const renderUnitPicker = useCallback( () => {
if ( hasUnits( units ) ) {
// Keeping for legacy reasons, although `false` should not be a valid
// value for the `units` prop anymore.
if ( units === false ) {
return null;
}
return (
<View style={ styles.unitMenu } ref={ anchorNodeRef }>
{ renderUnitButton }
{ units?.length > 1 ? (
{ hasUnits( units ) && units?.length > 1 ? (
<Picker
ref={ pickerRef }
options={ units }
Expand Down
4 changes: 2 additions & 2 deletions packages/components/src/unit-control/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@ function UnitControl(
);

useEffect( () => {
setUnit( initialUnit );
}, [ initialUnit ] );
setUnit( parsedUnit );
}, [ parsedUnit ] );

// Stores parsed value for hand-off in state reducer.
const refParsedQuantity = useRef< number | undefined >( undefined );
Expand Down

0 comments on commit 49b645b

Please sign in to comment.