Skip to content

Commit

Permalink
InputRowRadioButtons types: Relax TItemKey to accept number
Browse files Browse the repository at this point in the history
And also for SelectableOptionsScreen, which this uses.

These now match SelectableOptionRow, which has already been
accepting `number`.
  • Loading branch information
chrisbobbe committed Sep 2, 2022
1 parent 7ee4bd4 commit 63f46eb
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/common/InputRowRadioButtons.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,9 @@ type Props<TItemKey> = $ReadOnly<{|
// represented by IconRight. NestedNavRow would probably be the wrong
// abstraction, though, because it isn't an imput component; it doesn't have
// a value to display.
export default function InputRowRadioButtons<TItemKey: string>(props: Props<TItemKey>): Node {
export default function InputRowRadioButtons<TItemKey: string | number>(
props: Props<TItemKey>,
): Node {
const { navigation, label, description, valueKey, items, onValueChange } = props;

const screenKey: string = useRef(`selectable-options-${randString()}`).current;
Expand Down
4 changes: 3 additions & 1 deletion src/common/SelectableOptionsScreen.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,9 @@ LogBox.ignoreLogs([/selectable-options > params\.onRequestSelectionChange \(Func
// If we need separate components dedicated to checkboxes and radio buttons,
// we can split this. Currently it's up to the caller to enforce the
// radio-button invariant (exactly one item selected) if they want to.
export default function SelectableOptionsScreen<TItemKey: string>(props: Props<TItemKey>): Node {
export default function SelectableOptionsScreen<TItemKey: string | number>(
props: Props<TItemKey>,
): Node {
const { route } = props;
const { title, description, items, onRequestSelectionChange } = route.params;

Expand Down

0 comments on commit 63f46eb

Please sign in to comment.