Skip to content

Commit

Permalink
fix(iOS): title and title color handling added for refresh control (#…
Browse files Browse the repository at this point in the history
…46655)

Summary:
Solve a part of this issue:  #46631

## Changelog:

<!-- Help reviewers and the release process by writing your own changelog entry.

Pick one each for the category and type tags:

For more details, see:
https://reactnative.dev/contributing/changelogs-in-pull-requests
-->

[IOS] [CHANGED] - Passed correct title and titleColor prop to updateTitle function

**What's the Issue:**
When updating the PullToRefreshViewProps in a React Native iOS app, changes to the title and titleColor were not being reflected properly in the RefreshControl. This happened because the function responsible for updating the title (_updateTitle) was not always receiving the correct or updated values for title and titleColor.

**Updated `_updateTitle` function:**

The _updateTitle method was modified to accept both title and titleColor as parameters. This ensures that the latest values are always used when updating the refresh control's attributedTitle.
If the title is empty, the attributedTitle is cleared by setting it to nil. Otherwise, both the title and titleColor (if present) are applied correctly.

Pull Request resolved: #46655

Test Plan:
**Without fix:**
https://github.com/user-attachments/assets/8a83c247-bf78-4080-bdc1-ac5a852481e8

**With Fix:**
https://github.com/user-attachments/assets/52e2495a-4419-41d1-b308-acb64600f9f7

Reviewed By: javache

Differential Revision: D63466516

Pulled By: cipolleschi

fbshipit-source-id: fef61a003b658b20a25b61b6d07ee9fe0750dae7
  • Loading branch information
shubhamguptadream11 authored and facebook-github-bot committed Sep 30, 2024
1 parent 18faf68 commit 5c7a166
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -101,11 +101,11 @@ - (void)updateProps:(const Props::Shared &)props oldProps:(const Props::Shared &
needsUpdateTitle = YES;
}

[super updateProps:props oldProps:oldProps];

if (needsUpdateTitle) {
[self _updateTitle];
}

[super updateProps:props oldProps:oldProps];
}

#pragma mark -
Expand Down

0 comments on commit 5c7a166

Please sign in to comment.