Skip to content
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 numberDiff line numberDiff line change
Expand Up@@ -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
Expand DownExpand Up@@ -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) {
Expand All@@ -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);
Expand Down