Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(theme): add ListItemSwipable to ComponentTheme interface #3691

Conversation

muffix
Copy link
Contributor

@muffix muffix commented Nov 26, 2022

Motivation

A ThemeProvider allows users to specify default props per type of component. Components are identified by a theme key. For swipeable ListItems, the key is ListItemSwipeable.

The props are correctly applied, but ListItemSwipeable is missing from the ComponentTheme interface, which makes TypeScript complain.

Example theme:

import {createTheme} from '@rneui/themed';

export const theme = createTheme({
  components: {
    ListItemSwipeable: {
      containerStyle: {
        backgroundColor: 'transparent',
      },
    },
  },
});

Error:

TS2322: Type '{ ListItemSwipeable: { containerStyle: { backgroundColor: string; }; }; }' is not assignable to type 'ComponentFunctionProps<ComponentTheme>'.

This adds the missing theme key.

Fixes #3690

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

  • Jest Unit Test
  • Checked with example app

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation using yarn docs-build-api
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

Additional context

A [ThemeProvider][1] allows users to specify default props per type of
component. Components are identified by a theme key. For swipeable
`ListItems`, [the key is `ListItemSwipeable`][2].

The props are correctly applied, but `ListItemSwipeable` is missing from
the `ComponentTheme` interface, which makes TypeScript complain.

This adds the missing theme key.

Resolves: react-native-elements#3690

[1]: https://reactnativeelements.com/docs/customizing#using-themeprovider
[2]: https://reactnativeelements.com/docs/components/listitem_swipeable
@codecov
Copy link

codecov bot commented Nov 26, 2022

Codecov Report

Merging #3691 (b54e1e6) into next (5e97c1c) will not change coverage.
The diff coverage is n/a.

@@           Coverage Diff           @@
##             next    #3691   +/-   ##
=======================================
  Coverage   79.40%   79.40%           
=======================================
  Files          87       87           
  Lines        1821     1821           
  Branches      811      811           
=======================================
  Hits         1446     1446           
  Misses        370      370           
  Partials        5        5           

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@arpitBhalla arpitBhalla changed the title Add ListItemSwipable to ComponentTheme interface fix(theme): add ListItemSwipable to ComponentTheme interface Nov 26, 2022
@arpitBhalla arpitBhalla merged commit f9a565c into react-native-elements:next Nov 26, 2022
github-actions bot pushed a commit that referenced this pull request Nov 26, 2022
A [ThemeProvider][1] allows users to specify default props per type of
component. Components are identified by a theme key. For swipeable
`ListItems`, [the key is `ListItemSwipeable`][2].

The props are correctly applied, but `ListItemSwipeable` is missing from
the `ComponentTheme` interface, which makes TypeScript complain.

This adds the missing theme key.

Resolves: #3690

[1]: https://reactnativeelements.com/docs/customizing#using-themeprovider
[2]: https://reactnativeelements.com/docs/components/listitem_swipeable
github-actions bot pushed a commit that referenced this pull request Nov 26, 2022
A [ThemeProvider][1] allows users to specify default props per type of
component. Components are identified by a theme key. For swipeable
`ListItems`, [the key is `ListItemSwipeable`][2].

The props are correctly applied, but `ListItemSwipeable` is missing from
the `ComponentTheme` interface, which makes TypeScript complain.

This adds the missing theme key.

Resolves: #3690

[1]: https://reactnativeelements.com/docs/customizing#using-themeprovider
[2]: https://reactnativeelements.com/docs/components/listitem_swipeable
@muffix muffix deleted the add-swipeable-list-item-to-interface branch November 26, 2022 17:12
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.

ListItemSwipeable missing from ComponentTheme interface
2 participants