Skip to content

Commit

Permalink
Fix background color issue
Browse files Browse the repository at this point in the history
Differential Revision: D2489578

committer: Service User <svcscm@fb.com>
  • Loading branch information
andreicoman11 authored and facebook-github-bot-4 committed Sep 29, 2015
1 parent 3a664a0 commit 3b6d029
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 2 deletions.
9 changes: 9 additions & 0 deletions Examples/UIExplorer/TextExample.android.js
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,15 @@ var TextExample = React.createClass({
</Text>
</Text>
</Text>
<Text style={{backgroundColor: 'rgba(100, 100, 100, 0.3)'}}>
Same alpha as background,
<Text>
Inherited alpha from background,
<Text style={{backgroundColor: 'rgba(100, 100, 100, 0.3)'}}>
Reapply alpha
</Text>
</Text>
</Text>
</UIExplorerBlock>
<UIExplorerBlock title="containerBackgroundColor attribute">
<View style={{flexDirection: 'row', height: 85}}>
Expand Down
7 changes: 7 additions & 0 deletions Examples/UIExplorer/TextInputExample.android.js
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,13 @@ exports.examples = [
style={styles.singleLine}
underlineColorAndroid="blue"
/>
<TextInput
defaultValue="Same BackgroundColor as View "
style={[styles.singleLine, {backgroundColor: 'rgba(100, 100, 100, 0.3)'}]}>
<Text style={{backgroundColor: 'rgba(100, 100, 100, 0.3)'}}>
Darker backgroundColor
</Text>
</TextInput>
</View>
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ protected static final Spanned fromTextCSSNode(ReactTextShadowNode textCSSNode)
// a new spannable will be wiped out
List<SetSpanOperation> ops = new ArrayList<SetSpanOperation>();
buildSpannedFromTextCSSNode(textCSSNode, sb, ops);
if (textCSSNode.mFontSize == -1) {
if (textCSSNode.mFontSize == UNSET) {
sb.setSpan(
new AbsoluteSizeSpan((int) Math.ceil(PixelUtil.toPixelFromSP(ViewDefaults.FONT_SIZE_SP))),
0,
Expand Down Expand Up @@ -315,7 +315,8 @@ public void updateProperties(CatalystStylesDiffMap styles) {
}
markUpdated();
}
if (styles.hasKey(ViewProps.BACKGROUND_COLOR)) {
// Don't apply background color to anchor TextView since it will be applied on the View directly
if (styles.hasKey(ViewProps.BACKGROUND_COLOR) && this.isVirtualAnchor() == false) {
if (styles.isNull(ViewProps.BACKGROUND_COLOR)) {
mIsBackgroundColorSet = false;
} else {
Expand Down

0 comments on commit 3b6d029

Please sign in to comment.