Skip to content

Commit

Permalink
fix(android): postInvalidateDelayed not working
Browse files Browse the repository at this point in the history
  • Loading branch information
iPel committed Aug 11, 2023
1 parent d448e18 commit 7d06730
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,9 @@ public class NodeProps {
public static final String IMAGE_CLASS_NAME = "Image";
public static final String TEXT_INPUT_CLASS_NAME = "TextInput";
public static final String IMAGE_SPAN_TEXT = "[img]";
@Deprecated
public static final String PROP_VERTICAL_ALIGNMENT = "verticalAlignment";
public static final String VERTICAL_ALIGN = "verticalAlign";

public static final String PROPS = "props";
public static final String ROOT_NODE = "RootNode";
Expand All @@ -162,5 +164,4 @@ public class NodeProps {
public static final String BACKGROUND_RIPPLE = "nativeBackgroundAndroid";
public static final String OVER_PULL = "bounces";
public static final String HAS_STABLE_IDS = "hasStableIds";
public static final String VERTICAL_ALIGN = "verticalAlign";
}
Original file line number Diff line number Diff line change
Expand Up @@ -422,13 +422,6 @@ public void replaceId(int rootId, @NonNull View view, int newId, boolean shouldR
mControllerRegistry.addView(view, rootId, newId);
}

public void postInvalidateDelayed(int rootId, int id, long delayMilliseconds) {
View view = mControllerRegistry.getView(rootId, id);
if (view != null) {
view.postInvalidateDelayed(delayMilliseconds);
}
}

@Nullable
public RenderNode createRenderNode(int rootId, int id, @Nullable Map<String, Object> props,
String className, boolean isLazy) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -416,6 +416,9 @@ public boolean checkRegisteredEvent(int rootId, int nodeId, @NonNull String even
}

public void postInvalidateDelayed(int rootId, int id, long delayMilliseconds) {
mControllerManager.postInvalidateDelayed(rootId, id, delayMilliseconds);
RenderNode node = getRenderNode(rootId, id);
if (node != null) {
node.postInvalidateDelayed(delayMilliseconds);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,6 @@

public class ImageVirtualNode extends VirtualNode {

@Deprecated
public static final String PROP_VERTICAL_ALIGNMENT = "verticalAlignment";
protected int mWidth;
protected int mHeight;
@Deprecated
Expand Down Expand Up @@ -276,7 +274,7 @@ public void setMarginBottom(float value) {
*/
@Deprecated
@SuppressWarnings("unused")
@HippyControllerProps(name = PROP_VERTICAL_ALIGNMENT, defaultType = HippyControllerProps.NUMBER,
@HippyControllerProps(name = NodeProps.PROP_VERTICAL_ALIGNMENT, defaultType = HippyControllerProps.NUMBER,
defaultNumber = ImageSpan.ALIGN_BASELINE)
public void setVerticalAlignment(int alignment) {
if (alignment != mVerticalAlignment) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,13 @@ public int getRootId() {
}

public int getAncestorId() {
VirtualNode node = this;
while (node.mParent != null) {
node = node.mParent;
VirtualNode parent = mParent;
int id = mId;
while (parent != null) {
id = parent.getId();
parent = parent.mParent;
}
return node.mPid;
return id;
}

protected abstract void createSpanOperation(List<SpanOperation> ops,
Expand Down

0 comments on commit 7d06730

Please sign in to comment.