Skip to content

Commit

Permalink
Revert color casting
Browse files Browse the repository at this point in the history
  • Loading branch information
axinvd committed Oct 6, 2023
1 parent c8db188 commit 97743ce
Show file tree
Hide file tree
Showing 12 changed files with 34 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1276,8 +1276,8 @@ public void setBorderWidth(int position, float width) {
mReactBackgroundManager.setBorderWidth(position, width);
}

public void setBorderColor(int position, Integer color) {
mReactBackgroundManager.setBorderColor(position, color);
public void setBorderColor(int position, float color, float alpha) {
mReactBackgroundManager.setBorderColor(position, color, alpha);
}

public void setBorderRadius(float borderRadius) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,10 @@ public void setBorderWidth(ReactHorizontalScrollView view, int index, float widt
},
customType = "Color")
public void setBorderColor(ReactHorizontalScrollView view, int index, Integer color) {
view.setBorderColor(SPACING_TYPES[index], color);
float rgbComponent =
color == null ? YogaConstants.UNDEFINED : (float) ((int) color & 0x00FFFFFF);
float alphaComponent = color == null ? YogaConstants.UNDEFINED : (float) ((int) color >>> 24);
view.setBorderColor(SPACING_TYPES[index], rgbComponent, alphaComponent);
}

@ReactProp(name = "overflow")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1155,8 +1155,8 @@ public void setBorderWidth(int position, float width) {
mReactBackgroundManager.setBorderWidth(position, width);
}

public void setBorderColor(int position, Integer color) {
mReactBackgroundManager.setBorderColor(position, color);
public void setBorderColor(int position, float color, float alpha) {
mReactBackgroundManager.setBorderColor(position, color, alpha);
}

public void setBorderRadius(float borderRadius) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,9 @@ public void setBorderWidth(ReactScrollView view, int index, float width) {
},
customType = "Color")
public void setBorderColor(ReactScrollView view, int index, Integer color) {
view.setBorderColor(SPACING_TYPES[index], color);
float rgbComponent = color == null ? YogaConstants.UNDEFINED : (float) (color & 0x00FFFFFF);
float alphaComponent = color == null ? YogaConstants.UNDEFINED : (float) (color >>> 24);
view.setBorderColor(SPACING_TYPES[index], rgbComponent, alphaComponent);
}

@ReactProp(name = "overflow")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,10 @@ public void setBorderWidth(ReactTextView view, int index, float width) {
},
customType = "Color")
public void setBorderColor(ReactTextView view, int index, Integer color) {
view.setBorderColor(SPACING_TYPES[index], color);
float rgbComponent =
color == null ? YogaConstants.UNDEFINED : (float) ((int) color & 0x00FFFFFF);
float alphaComponent = color == null ? YogaConstants.UNDEFINED : (float) ((int) color >>> 24);
view.setBorderColor(SPACING_TYPES[index], rgbComponent, alphaComponent);
}

@ReactProp(name = ViewProps.INCLUDE_FONT_PADDING, defaultBoolean = true)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -629,8 +629,8 @@ public void setBorderWidth(int position, float width) {
mReactBackgroundManager.setBorderWidth(position, width);
}

public void setBorderColor(int position, Integer color) {
mReactBackgroundManager.setBorderColor(position, color);
public void setBorderColor(int position, float color, float alpha) {
mReactBackgroundManager.setBorderColor(position, color, alpha);
}

public void setBorderRadius(float borderRadius) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1066,8 +1066,8 @@ public void setBorderWidth(int position, float width) {
mReactBackgroundManager.setBorderWidth(position, width);
}

public void setBorderColor(int position, Integer color) {
mReactBackgroundManager.setBorderColor(position, color);
public void setBorderColor(int position, float color, float alpha) {
mReactBackgroundManager.setBorderColor(position, color, alpha);
}

public int getBorderColor(int position) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -979,7 +979,10 @@ public void setBorderWidth(ReactEditText view, int index, float width) {
},
customType = "Color")
public void setBorderColor(ReactEditText view, int index, Integer color) {
view.setBorderColor(SPACING_TYPES[index], color);
float rgbComponent =
color == null ? YogaConstants.UNDEFINED : (float) ((int) color & 0x00FFFFFF);
float alphaComponent = color == null ? YogaConstants.UNDEFINED : (float) ((int) color >>> 24);
view.setBorderColor(SPACING_TYPES[index], rgbComponent, alphaComponent);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -224,12 +224,9 @@ public void setBorderWidth(int position, float width) {
}
}

public void setBorderColor(int position, Integer color) {
float rgbComponent =
color == null ? YogaConstants.UNDEFINED : (float) ((int) color & 0x00FFFFFF);
float alphaComponent = color == null ? YogaConstants.UNDEFINED : (float) ((int) color >>> 24);
this.setBorderRGB(position, rgbComponent);
this.setBorderAlpha(position, alphaComponent);
public void setBorderColor(int position, float rgb, float alpha) {
this.setBorderRGB(position, rgb);
this.setBorderAlpha(position, alpha);
mNeedUpdatePathForBorderRadius = true;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ public void setBorderWidth(int position, float width) {
getOrCreateReactViewBackground().setBorderWidth(position, width);
}

public void setBorderColor(int position, Integer color) {
getOrCreateReactViewBackground().setBorderColor(position, color);
public void setBorderColor(int position, float color, float alpha) {
getOrCreateReactViewBackground().setBorderColor(position, color, alpha);
}

public int getBorderColor(int position) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -310,8 +310,8 @@ public void setBorderWidth(int position, float width) {
getOrCreateReactViewBackground().setBorderWidth(position, width);
}

public void setBorderColor(int position, Integer color) {
getOrCreateReactViewBackground().setBorderColor(position, color);
public void setBorderColor(int position, float rgb, float alpha) {
getOrCreateReactViewBackground().setBorderColor(position, rgb, alpha);
}

public void setBorderRadius(float borderRadius) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,10 @@ public void setBorderWidth(ReactViewGroup view, int index, float width) {
},
customType = "Color")
public void setBorderColor(ReactViewGroup view, int index, Integer color) {
view.setBorderColor(SPACING_TYPES[index], color);
float rgbComponent =
color == null ? YogaConstants.UNDEFINED : (float) ((int) color & 0x00FFFFFF);
float alphaComponent = color == null ? YogaConstants.UNDEFINED : (float) ((int) color >>> 24);
view.setBorderColor(SPACING_TYPES[index], rgbComponent, alphaComponent);
}

@ReactProp(name = ViewProps.COLLAPSABLE)
Expand Down

0 comments on commit 97743ce

Please sign in to comment.