Skip to content

Commit

Permalink
Checkbox to inherit from AppCompatCheckBox (facebook#18318)
Browse files Browse the repository at this point in the history
Summary:
The checkbox components inherits from `android.widget.CheckBox`. `AppCompatCheckBox` offers better appearance and support for advanced features (eg. tinting) on older APIs.

~~However, the build fails for some reason; If somebody could shed some light on this, I'd appreciate it.~~ Thanks for the comment, I was being blind and somehow ignored the BUCK file.

I have created a simple app with a checkbox.

Screenshot from android 4.1 (current master):

<img src="https://user-images.githubusercontent.com/1566403/37357997-2d34bdb8-26ea-11e8-8c77-709a4f96c6bf.png" width="300" />

Screenshot after applying the change, also android 4.1:

<img src="https://user-images.githubusercontent.com/1566403/37358016-3c28fb86-26ea-11e8-8dca-3a92e41450c9.png" width="300" />

facebook#18300 (this PR is needed to support tinting on older android api levels)

[ANDROID]  [ENHANCEMENT]  [Checkbox] - Checkbox inherits from AppCompatCheckBox
Closes facebook#18318

Differential Revision: D7268393

Pulled By: hramos

fbshipit-source-id: 01cb2819f4d56c4e0f94cdd1fb5e1a90667a398a
  • Loading branch information
vonovak authored and facebook-github-bot committed Jun 15, 2018
1 parent 3bc62f3 commit 1723b6c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ rn_android_library(
srcs = glob(["*.java"]),
provided_deps = [
react_native_dep("third-party/android/support/v4:lib-support-v4"),
react_native_dep("third-party/android/support/v7/appcompat-orig:appcompat"),
],
visibility = [
"PUBLIC",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
package com.facebook.react.views.checkbox;

import android.content.Context;
import android.widget.CheckBox;
import android.support.v7.widget.AppCompatCheckBox;

/** CheckBox that has its value controlled by JS. */
/*package*/ class ReactCheckBox extends CheckBox {
/*package*/ class ReactCheckBox extends AppCompatCheckBox {

private boolean mAllowChange;

Expand Down

0 comments on commit 1723b6c

Please sign in to comment.