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](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
This commit is contained in:
4ndroidev 2018-01-25 17:53:19 -08:00 коммит произвёл Facebook Github Bot
Родитель 40a8434bde
Коммит 7b1915e74d
1 изменённых файлов: 1 добавлений и 0 удалений

Просмотреть файл

@ -57,6 +57,7 @@ public class ReactSwitchManager extends SimpleViewManager<ReactSwitch> {
// 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);