Skip to content

Commit 8d50bf1

Browse files
jonathanmosfacebook-github-bot
authored andcommitted
Fix Switch causing RetryableMountingLayerException (#32602)
Summary: Added a null check to native.value in Switch to fix regression from RN 66 -> stuck operation in mViewCommandOperations list in Android Release on initial layout of a screen with Switch component. If approved, please incorporate this fix into an RN 66 release. ## Changelog [Android][Fixed] - Added a null check to native.value in Switch to fix #32594 Pull Request resolved: #32602 Test Plan: To reproduce, put a log in UIViewOperationQueue in dispatchViewUpdates you can see that the RetryableMountingException is no longer thrown for a screen with the Switch component on Android Release. As a result, mViewCommandOperations no longer has a stuck operation on initial layout. Reviewed By: charlesbdudley Differential Revision: D34397788 Pulled By: lunaleaps fbshipit-source-id: 1cee3516fb987942dfa50ad1f2d11c965a947f05
1 parent 3c958a8 commit 8d50bf1

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

Libraries/Components/Switch/Switch.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,8 @@ const SwitchWithForwardedRef: React.AbstractComponent<
170170
// that the update should be ignored and we should stick with the value
171171
// that we have in JS.
172172
const jsValue = value === true;
173-
const shouldUpdateNativeSwitch = native.value !== jsValue;
173+
const shouldUpdateNativeSwitch =
174+
native.value != null && native.value !== jsValue;
174175
if (
175176
shouldUpdateNativeSwitch &&
176177
nativeSwitchRef.current?.setNativeProps != null

0 commit comments

Comments
 (0)