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

fix: don't overwrite propKeysManagedByAnimated with nil #6115

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
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
Expand Up @@ -509,6 +509,24 @@ bool NativeReanimatedModule::isThereAnyLayoutProp(
return false;
}

jsi::Object NativeReanimatedModule::getUIProps(
jsi::Runtime &rt,
const jsi::Object &props) {
jsi::Object res = jsi::Object(rt);
const jsi::Array propNames = props.getPropertyNames(rt);
for (size_t i = 0; i < propNames.size(rt); ++i) {
const std::string propName =
propNames.getValueAtIndex(rt, i).asString(rt).utf8(rt);
bool isLayoutProp =
nativePropNames_.find(propName) != nativePropNames_.end();
if (!isLayoutProp) {
const jsi::Value &propValue = props.getProperty(rt, propName.c_str());
res.setProperty(rt, propName.c_str(), propValue);
}
}
return res;
}

jsi::Value NativeReanimatedModule::filterNonAnimatableProps(
jsi::Runtime &rt,
const jsi::Value &props) {
Expand Down Expand Up @@ -657,13 +675,15 @@ void NativeReanimatedModule::performOperations() {
}
}

// If there's no layout props to be updated, we can apply the updates
// directly onto the components and skip the commit.
for (const auto &[shadowNode, props] : copiedOperationsQueue) {
Tag tag = shadowNode->getTag();
jsi::Object uiProps = getUIProps(rt, props->asObject(rt));
synchronouslyUpdateUIPropsFunction_(rt, tag, uiProps);
}

if (!hasLayoutUpdates) {
// If there's no layout props to be updated, we can apply the updates
// directly onto the components and skip the commit.
for (const auto &[shadowNode, props] : copiedOperationsQueue) {
Tag tag = shadowNode->getTag();
synchronouslyUpdateUIPropsFunction_(rt, tag, props->asObject(rt));
}
return;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ class NativeReanimatedModule : public NativeReanimatedModuleSpec {

#ifdef RCT_NEW_ARCH_ENABLED
bool isThereAnyLayoutProp(jsi::Runtime &rt, const jsi::Object &props);
jsi::Object getUIProps(jsi::Runtime &rt, const jsi::Object &props);
jsi::Value filterNonAnimatableProps(
jsi::Runtime &rt,
const jsi::Value &props);
Expand Down
2 changes: 0 additions & 2 deletions packages/react-native-reanimated/apple/REANodesManager.mm
Original file line number Diff line number Diff line change
Expand Up @@ -432,9 +432,7 @@ - (void)synchronouslyUpdateViewOnUIThread:(nonnull NSNumber *)viewTag props:(non
REAUIView<RCTComponentViewProtocol> *componentView =
[componentViewRegistry findComponentViewWithTag:[viewTag integerValue]];

NSSet<NSString *> *propKeysManagedByAnimated = [componentView propKeysManagedByAnimated_DO_NOT_USE_THIS_IS_BROKEN];
[surfacePresenter synchronouslyUpdateViewOnUIThread:viewTag props:uiProps];
[componentView setPropKeysManagedByAnimated_DO_NOT_USE_THIS_IS_BROKEN:propKeysManagedByAnimated];

// `synchronouslyUpdateViewOnUIThread` does not flush props like `backgroundColor` etc.
// so that's why we need to call `finalizeUpdates` here.
Expand Down
Loading