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

refactor: Image component #39

Merged
merged 6 commits into from
Dec 19, 2024
Merged

refactor: Image component #39

merged 6 commits into from
Dec 19, 2024

Conversation

mthahzan
Copy link
Owner

Description

A minor refactor of the fallback logic has been made to improve the performance by eliminating a call to create an array on every render. This has been replaced with a logical operation during the onError event.

Additionally, this refactors the exported component to be more flexible in their usage. This deprecates the named import of the component and introduces a default import in place of that.

// This is deprecated
import {ImageLoader} from 'react-native-image-fallback';

// This is the preferred way
import Image from 'react-native-image-fallback';

The deprecated named export will be removed on the next major version.

Some of the exported typings have also changed, but I do not consider them to be "breaking changes" per se. But this is a potential gotcha moment for consumers.

Fixes #38

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

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
  • 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

- Eliminate the creation of source arrays on every render
- Export the `Image` component by default
- Minor changes to exported typings
- Deprecate named `ImageLoader` import
- Update prettier/eslint configs
- Update example app
@mthahzan mthahzan self-assigned this Dec 19, 2024
@mthahzan mthahzan merged commit c09d188 into development Dec 19, 2024
7 checks passed
@mthahzan mthahzan deleted the refactor/image-component branch December 19, 2024 02:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Make the image a default export
1 participant