From 7b1915e74daa82d0a94e90ff266e9271bc43f4d8 Mon Sep 17 00:00:00 2001 From: 4ndroidev <4ndroidev@gmail.com> Date: Thu, 25 Jan 2018 17:53:19 -0800 Subject: [PATCH] Fix NPE in Android Switch during measure Summary: Fixes #16000 see [Issue #16000](https://github.com/facebook/react-native/issues/16000) fix a null pointer exception while using higher version 'com.android.support:appcompat-v7' N/A [ANDROID][BUGFIX][Switch] - Fix NPE in Android Switch during measure Closes https://github.com/facebook/react-native/pull/16064 Differential Revision: D6816122 Pulled By: hramos fbshipit-source-id: ba9a6febad4884b8ab142d8c7142085367006904 --- .../com/facebook/react/views/switchview/ReactSwitchManager.java | 1 + 1 file changed, 1 insertion(+) diff --git a/ReactAndroid/src/main/java/com/facebook/react/views/switchview/ReactSwitchManager.java b/ReactAndroid/src/main/java/com/facebook/react/views/switchview/ReactSwitchManager.java index 73f687345f..1f98b13aa6 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/views/switchview/ReactSwitchManager.java +++ b/ReactAndroid/src/main/java/com/facebook/react/views/switchview/ReactSwitchManager.java @@ -57,6 +57,7 @@ public class ReactSwitchManager extends SimpleViewManager { // support setting custom switch text, this is fine, as all switches will measure the same // on a specific device/theme/locale combination. ReactSwitch reactSwitch = new ReactSwitch(getThemedContext()); + reactSwitch.setShowText(false); final int spec = View.MeasureSpec.makeMeasureSpec( ViewGroup.LayoutParams.WRAP_CONTENT, View.MeasureSpec.UNSPECIFIED);