Skip to content

Conversation

@jboteros
Copy link

@jboteros jboteros commented Oct 23, 2024

Related to #4528

Add stricter typing for onValueChange in SegmentedButtons component to support union types in TypeScript projects.

  • Modify src/components/SegmentedButtons/SegmentedButtons.tsx to accept a generic type parameter for the value and onValueChange props.
    • Update ConditionalValue type to use the generic type parameter.
    • Update Props type to use the generic type parameter.
  • Update example files to demonstrate the usage of the stricter typing:
    • example/src/Examples/SegmentedButtons/SegmentedButtonDefault.tsx
    • example/src/Examples/SegmentedButtons/SegmentedButtonWithSelectedCheck.tsx
    • example/src/Examples/SegmentedButtons/SegmentedButtonWithDensity.tsx
    • example/src/Examples/SegmentedButtons/SegmentedButtonMultiselect.tsx
    • example/src/Examples/SegmentedButtons/SegmentedButtonMultiselectIcons.tsx
    • example/src/Examples/SegmentedButtons/SegmentedButtonCustomColorCheck.tsx
    • example/src/Examples/SegmentedButtons/SegmentedButtonDisabled.tsx
    • example/src/Examples/SegmentedButtons/SegmentedButtonMultiselectRealCase.tsx
    • example/src/Examples/SegmentedButtons/SegmentedButtonOnlyIcons.tsx
    • example/src/Examples/SegmentedButtons/SegmentedButtonOnlyIconsWithCheck.tsx
    • example/src/Examples/SegmentedButtons/SegmentedButtonRealCase.tsx
    • example/src/Examples/SegmentedButtonsExample.tsx
    • example/src/Examples/ToggleButtonExample.tsx

For more details, open the Copilot Workspace session.

Related to callstack#4528

Add stricter typing for `onValueChange` in `SegmentedButtons` component to support union types in TypeScript projects.

* Modify `src/components/SegmentedButtons/SegmentedButtons.tsx` to accept a generic type parameter for the `value` and `onValueChange` props.
  * Update `ConditionalValue` type to use the generic type parameter.
  * Update `Props` type to use the generic type parameter.
* Update example files to demonstrate the usage of the stricter typing:
  * `example/src/Examples/SegmentedButtons/SegmentedButtonDefault.tsx`
  * `example/src/Examples/SegmentedButtons/SegmentedButtonWithSelectedCheck.tsx`
  * `example/src/Examples/SegmentedButtons/SegmentedButtonWithDensity.tsx`
  * `example/src/Examples/SegmentedButtons/SegmentedButtonMultiselect.tsx`
  * `example/src/Examples/SegmentedButtons/SegmentedButtonMultiselectIcons.tsx`
  * `example/src/Examples/SegmentedButtons/SegmentedButtonCustomColorCheck.tsx`
  * `example/src/Examples/SegmentedButtons/SegmentedButtonDisabled.tsx`
  * `example/src/Examples/SegmentedButtons/SegmentedButtonMultiselectRealCase.tsx`
  * `example/src/Examples/SegmentedButtons/SegmentedButtonOnlyIcons.tsx`
  * `example/src/Examples/SegmentedButtons/SegmentedButtonOnlyIconsWithCheck.tsx`
  * `example/src/Examples/SegmentedButtons/SegmentedButtonRealCase.tsx`
  * `example/src/Examples/SegmentedButtonsExample.tsx`
  * `example/src/Examples/ToggleButtonExample.tsx`

---

For more details, open the [Copilot Workspace session](https://copilot-workspace.githubnext.com/callstack/react-native-paper/issues/4528?shareId=XXXX-XXXX-XXXX-XXXX).
@callstack-bot
Copy link

callstack-bot commented Oct 23, 2024

Hey @jboteros, thank you for your pull request 🤗. The documentation from this branch can be viewed here.

…cter typing

* Remove unnecessary filter function in `filteredData` calculation
* Fix ESLint error by updating code formatting
@lukewalczak
Copy link
Member

Closing in favour of: #4686

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants