Skip to content

Instantly share code, notes, and snippets.

@Kudo
Last active July 30, 2022 16:21
Show Gist options
  • Save Kudo/01e87f23266db75253f233edc6973d5c to your computer and use it in GitHub Desktop.
Save Kudo/01e87f23266db75253f233edc6973d5c to your computer and use it in GitHub Desktop.
Fabric with UIViewPropertyAnimator issue
diff --git a/node_modules/react-native/React/Fabric/Mounting/ComponentViews/View/RCTViewComponentView.mm b/node_modules/react-native/React/Fabric/Mounting/ComponentViews/View/RCTViewComponentView.mm
index 172020a..d81354e 100644
--- a/node_modules/react-native/React/Fabric/Mounting/ComponentViews/View/RCTViewComponentView.mm
+++ b/node_modules/react-native/React/Fabric/Mounting/ComponentViews/View/RCTViewComponentView.mm
@@ -163,20 +163,25 @@ using namespace facebook::react;
// View is completely outside the clipRect, so unmount it
[view removeFromSuperview];
}
}
}
- (void)updateProps:(Props::Shared const &)props oldProps:(Props::Shared const &)oldProps
{
RCTAssert(props, @"`props` must not be `null`.");
+ UIViewPropertyAnimator *animator = [[UIViewPropertyAnimator alloc] initWithDuration:10 curve:UIViewAnimationCurveLinear animations:^{
+ self.alpha = 0.5;
+ }];
+ [animator startAnimationAfterDelay:1];
+
#ifndef NS_BLOCK_ASSERTIONS
auto propsRawPtr = _props.get();
RCTAssert(
propsRawPtr &&
([self class] == [RCTViewComponentView class] ||
typeid(*propsRawPtr).hash_code() != typeid(ViewProps const).hash_code()),
@"`RCTViewComponentView` subclasses (and `%@` particularly) must setup `_props`"
" instance variable with a default value in the constructor.",
NSStringFromClass([self class]));
#endif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment