66 */
77package com .facebook .react .views .checkbox ;
88
9+ import android .content .Context ;
10+ import android .support .v7 .widget .TintContextWrapper ;
911import android .widget .CompoundButton ;
1012import com .facebook .react .bridge .ReactContext ;
1113import com .facebook .react .uimanager .SimpleViewManager ;
1214import com .facebook .react .uimanager .ThemedReactContext ;
1315import com .facebook .react .uimanager .UIManagerModule ;
1416import com .facebook .react .uimanager .ViewProps ;
1517import com .facebook .react .uimanager .annotations .ReactProp ;
16- import com .facebook .react .uimanager .events .EventDispatcher ;
1718
1819/** View manager for {@link ReactCheckBox} components. */
1920public class ReactCheckBoxManager extends SimpleViewManager <ReactCheckBox > {
@@ -24,11 +25,22 @@ public class ReactCheckBoxManager extends SimpleViewManager<ReactCheckBox> {
2425 new CompoundButton .OnCheckedChangeListener () {
2526 @ Override
2627 public void onCheckedChanged (CompoundButton buttonView , boolean isChecked ) {
27- ReactContext reactContext = ( ReactContext ) buttonView . getContext ( );
28+ ReactContext reactContext = getReactContext ( buttonView );
2829 reactContext
2930 .getNativeModule (UIManagerModule .class ).getEventDispatcher ()
3031 .dispatchEvent (new ReactCheckBoxEvent (buttonView .getId (), isChecked ));
3132 }
33+
34+ private ReactContext getReactContext (CompoundButton buttonView ) {
35+ ReactContext reactContext ;
36+ Context ctx = buttonView .getContext ();
37+ if (ctx instanceof TintContextWrapper ) {
38+ reactContext = (ReactContext ) ((TintContextWrapper ) ctx ).getBaseContext ();
39+ } else {
40+ reactContext = (ReactContext ) buttonView .getContext ();
41+ }
42+ return reactContext ;
43+ }
3244 };
3345
3446 @ Override
0 commit comments