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

[iOS][New Architecture]: Fix applying of tintColor and progressViewOffset props for RefreshControl component #46628

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -49,6 +49,11 @@ - (void)_initializeUIRefreshControl
[_refreshControl addTarget:self
action:@selector(handleUIControlEventValueChanged)
forControlEvents:UIControlEventValueChanged];

const auto &concreteProps = static_cast<const PullToRefreshViewProps &>(*_props);

_refreshControl.tintColor = RCTUIColorFromSharedColor(concreteProps.tintColor);
[self _updateProgressViewOffset: concreteProps.progressViewOffset];
}

#pragma mark - RCTComponentViewProtocol
@@ -78,6 +83,14 @@ - (void)updateProps:(const Props::Shared &)props oldProps:(const Props::Shared &
}
}

if (newConcreteProps.tintColor != oldConcreteProps.tintColor) {
_refreshControl.tintColor = RCTUIColorFromSharedColor(newConcreteProps.tintColor);
}

if (newConcreteProps.progressViewOffset != oldConcreteProps.progressViewOffset) {
[self _updateProgressViewOffset: newConcreteProps.progressViewOffset];
}

BOOL needsUpdateTitle = NO;

if (newConcreteProps.title != oldConcreteProps.title) {
@@ -102,6 +115,11 @@ - (void)handleUIControlEventValueChanged
static_cast<const PullToRefreshViewEventEmitter &>(*_eventEmitter).onRefresh({});
}

- (void)_updateProgressViewOffset:(Float)progressViewOffset
{
_refreshControl.bounds = CGRectMake(_refreshControl.bounds.origin.x, -progressViewOffset, _refreshControl.bounds.size.width, _refreshControl.bounds.size.height);
}

- (void)_updateTitle
{
const auto &concreteProps = static_cast<const PullToRefreshViewProps &>(*_props);
Loading