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

Replace usages of YGConfigSetUseLegacyStretchBehaviour #37093

Closed
wants to merge 3 commits into from
Closed
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
2 changes: 1 addition & 1 deletion packages/react-native/React/Views/RCTShadowView.m
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ + (YGConfigRef)yogaConfig
dispatch_once(&onceToken, ^{
yogaConfig = YGConfigNew();
YGConfigSetPointScaleFactor(yogaConfig, RCTScreenScale());
YGConfigSetUseLegacyStretchBehaviour(yogaConfig, true);
YGConfigSetErrata(yogaConfig, YGErrataAll);
});
return yogaConfig;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

import com.facebook.yoga.YogaConfig;
import com.facebook.yoga.YogaConfigFactory;
import com.facebook.yoga.YogaErrata;

public class ReactYogaConfigProvider {

Expand All @@ -18,7 +19,7 @@ public static YogaConfig get() {
if (YOGA_CONFIG == null) {
YOGA_CONFIG = YogaConfigFactory.create();
YOGA_CONFIG.setPointScaleFactor(0f);
YOGA_CONFIG.setUseLegacyStretchBehaviour(true);
YOGA_CONFIG.setErrata(YogaErrata.ALL);
}
return YOGA_CONFIG;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,13 @@ public abstract class YogaConfig {
* Yoga previously had an error where containers would take the maximum space possible instead of the minimum
* like they are supposed to. In practice this resulted in implicit behaviour similar to align-self: stretch;
* Because this was such a long-standing bug we must allow legacy users to switch back to this behaviour.
*
* @deprecated "setUseLegacyStretchBehaviour" will be removed in the next release. Usage should be replaced with
* "setErrata(YogaErrata.ALL)" to opt out of all future breaking conformance fixes, or
* "setErrata(YogaErrata.STRETCH_FLEX_BASIS)" to opt out of the specific conformance fix previously disabled by
* "UseLegacyStretchBehaviour".
*/
@Deprecated
public abstract void setUseLegacyStretchBehaviour(boolean useLegacyStretchBehaviour);

public abstract void setErrata(YogaErrata errata);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -745,7 +745,7 @@ YogaLayoutableShadowNode &YogaLayoutableShadowNode::shadowNodeFromContext(
YGConfig &YogaLayoutableShadowNode::initializeYogaConfig(YGConfig &config) {
YGConfigSetCloneNodeFunc(
&config, YogaLayoutableShadowNode::yogaNodeCloneCallbackConnector);
YGConfigSetUseLegacyStretchBehaviour(&config, true);
YGConfigSetErrata(&config, YGErrataAll);
#ifdef RN_DEBUG_YOGA_LOGGER
YGConfigSetPrintTreeFlag(&config, true);
#endif
Expand Down