Checkbox to inherit from AppCompatCheckBox (#18318)

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" />

https://github.com/facebook/react-native/pull/18300 (this PR is needed to support tinting on older android api levels)

[ANDROID]  [ENHANCEMENT]  [Checkbox] - Checkbox inherits from AppCompatCheckBox
Closes https://github.com/facebook/react-native/pull/18318

Differential Revision: D7268393

Pulled By: hramos

fbshipit-source-id: 01cb2819f4d56c4e0f94cdd1fb5e1a90667a398a
This commit is contained in:
Vojtech Novak 2018-06-15 00:24:51 -07:00 committed by Facebook Github Bot
parent 3bc62f3610
commit 1723b6cd9c
2 changed files with 3 additions and 2 deletions

View File

@ -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",

View File

@ -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;