Summary: We only added suffix-stripped prefixes of props but this causes FPS if a component declares props that actually contain suffixes since we strip them when we are adding builder calls. The fix is to add both normal and stripped versions. Reviewed By: skcho, Katalune Differential Revision: D23375405 fbshipit-source-id: e99cb4dd8master
parent
fdb1640e12
commit
7cb8145ef6
@ -0,0 +1,59 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||||
|
*
|
||||||
|
* This source code is licensed under the MIT license found in the
|
||||||
|
* LICENSE file in the root directory of this source tree.
|
||||||
|
*/
|
||||||
|
package codetoanalyze.java.litho;
|
||||||
|
|
||||||
|
import com.facebook.litho.Component;
|
||||||
|
import com.facebook.litho.annotations.Prop;
|
||||||
|
import com.facebook.litho.annotations.ResType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* using @Prop(resType = ..) allows you to set the Prop with any of .propname, .propnameRes, or
|
||||||
|
* .propnameAttr
|
||||||
|
*/
|
||||||
|
public class ResPropDoubleComponent extends Component {
|
||||||
|
|
||||||
|
@Prop(resType = ResType.SOME)
|
||||||
|
Object prop; // implicitly non-optional with resType
|
||||||
|
|
||||||
|
@Prop
|
||||||
|
Integer
|
||||||
|
propPx; // note that setter for propPx(Integer) is not same as propPx(Object) corresponding to
|
||||||
|
// prop
|
||||||
|
|
||||||
|
public Builder create() {
|
||||||
|
return new Builder();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class Builder extends Component.Builder<Builder> {
|
||||||
|
|
||||||
|
ResPropDoubleComponent mResPropDoubleComponent;
|
||||||
|
|
||||||
|
public Builder prop(Object o) {
|
||||||
|
this.mResPropDoubleComponent.prop = o;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Builder propPx(Integer o) {
|
||||||
|
this.mResPropDoubleComponent.propPx = o;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Builder propPx(Object o) {
|
||||||
|
this.mResPropDoubleComponent.prop = o;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ResPropDoubleComponent build() {
|
||||||
|
return mResPropDoubleComponent;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Builder getThis() {
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in new issue