-
-
Notifications
You must be signed in to change notification settings - Fork 492
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: check if activityState is nil #714
Changes from 3 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -58,9 +58,16 @@ - (void)updateBounds | |
[_bridge.uiManager setSize:self.bounds.size forView:self]; | ||
} | ||
|
||
- (void)setActivityState:(int)activityState | ||
{ | ||
if (activityState != _activityState) { | ||
// Nil will be provided when activityState is set as an animated value and we change | ||
// it from JS to be a plain value (non animated). | ||
// In this scenario we first trigger the code which resets it to the default, | ||
// which is nil, and which maps to 0 meaning Inactive. | ||
// In that case we want to ignore such update | ||
// because soon after we get the actual, valid state passed from JS. | ||
- (void)setActivityStateOrNil:(NSNumber *)activityStateOrNil | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Would be great to document it somewhere in the code the purpose of special handling nil value and also explain when nil can be provided. That is we should mention that |
||
{ | ||
int activityState = [activityStateOrNil intValue]; | ||
if (activityStateOrNil != nil && activityState != _activityState) { | ||
_activityState = activityState; | ||
[_reactSuperview markChildUpdated]; | ||
} | ||
|
@@ -476,7 +483,8 @@ @implementation RNSScreenManager | |
|
||
RCT_EXPORT_MODULE() | ||
|
||
RCT_EXPORT_VIEW_PROPERTY(activityState, int) | ||
// we want to handle the case when activityState is nil | ||
RCT_REMAP_VIEW_PROPERTY(activityState, activityStateOrNil, NSNumber) | ||
RCT_EXPORT_VIEW_PROPERTY(gestureEnabled, BOOL) | ||
RCT_EXPORT_VIEW_PROPERTY(replaceAnimation, RNSScreenReplaceAnimation) | ||
RCT_EXPORT_VIEW_PROPERTY(stackPresentation, RNSScreenStackPresentation) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.