Skip to content
Draft
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 @@ -192,7 +192,13 @@ void TransitionProgressProvider::setPropertySettings(const PropertiesSettingsMap
}

CSSTransitionPropertySettings TransitionProgressProvider::getPropertySettings(const std::string &propertyName) const {
return propertySettings_.at(propertyName);
const auto it = propertySettings_.find(propertyName);
if (it == propertySettings_.end()) {
// A pseudo toggle can run a property whose settings never parsed (e.g. a discrete
// property without allowDiscrete); fall back to instant settings instead of throwing.
return CSSTransitionPropertySettings{};
}
return it->second;
}

} // namespace reanimated::css
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,28 @@ void PseudoStylesRegistry::remove(Tag tag) {
if (it == registry_.end()) {
return;
}
auto selectorsToDetach = std::move(it->second.selectors);
TagEntry entry = std::move(it->second);
registry_.erase(it);

for (const auto &[selector, data] : selectorsToDetach) {
// The gesture listeners are going away, so an active selector would stay applied forever
// (and its lock would keep filtering render transitions); run the deactivation transition
// and drop the lock before detaching.
if (entry.activeMask != 0) {
cssTransitionsRegistry_->setPseudoLockedProperties(tag, {});
if (entry.shadowNode) {
const auto &fromStyle = entry.precomputedStyles[entry.activeMask];
const auto &toStyle = entry.precomputedStyles[0];
css::PropertyValueDynamicDiffsMap valueChanges;
for (const auto &[propKey, toVal] : toStyle.items()) {
const auto propName = propKey.asString();
const folly::dynamic &fromVal = fromStyle.count(propName) ? fromStyle[propName] : toVal;
valueChanges.emplace(propName, std::make_pair(fromVal, toVal));
}
cssTransitionsRegistry_->run(entry.shadowNode, valueChanges);
}
}

for (const auto &[selector, data] : entry.selectors) {
detachFn_(tag, selector);
}
}
Expand Down
Loading