Permalink
Browse files

Fix NPE in Android Switch during measure

Summary:
<!--
Thank you for sending the PR! We appreciate you spending the time to work on these changes.

Help us understand your motivation by explaining why you decided to make this change.

You can learn more about contributing to React Native here: http://facebook.github.io/react-native/docs/contributing.html

Happy contributing!

-->

Fixes #16000

see [Issue #16000](#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 #16064

Differential Revision: D6816122

Pulled By: hramos

fbshipit-source-id: ba9a6febad4884b8ab142d8c7142085367006904
  • Loading branch information...
4ndroidev authored and facebook-github-bot committed Jan 26, 2018
1 parent 40a8434 commit 7b1915e74daa82d0a94e90ff266e9271bc43f4d8
@@ -57,6 +57,7 @@ public long measure(
// 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);

0 comments on commit 7b1915e

Please sign in to comment.