seanmturley / natureddit

A simple Reddit client, featuring a landing page dedicated to nature with posts pulled from a curated list of subreddits.
0 stars 1 forks source link

Investigate prop type error for ToggleSwitch in DropdownMenu #169

Closed seanmturley closed 5 months ago

seanmturley commented 5 months ago

Description

"Warning: Failed prop type: Invalid prop icon of type object supplied to ToggleSwitch, expected a single ReactElement type."

seanmturley commented 5 months ago

The problem here was that the prop types for icon React elements were expected to be PropTypes.elementType, when they needed to be PropTypes.element. It's not completely clear what the former is for, but that solved the problem.

The same issue that affected the icon prop also affected optionIcons, with the latter also failing to check for an object containing React elements. This is also fixed.