Skip to content

Commit 14b2b1c

Browse files
blakeffacebook-github-bot
authored andcommitted
investigating cause of ReactViewManager returning null
Summary: Throws and captures the overloading class as well as the component name to help us track. [Android][Changed] - Added an exception, which will be removed shortly. Reviewed By: cortinico Differential Revision: D45185598 fbshipit-source-id: 222a38be12c0a41774c83b657a4e4134ce9c197f
1 parent e133100 commit 14b2b1c

File tree

1 file changed

+18
-3
lines changed

1 file changed

+18
-3
lines changed

packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/view/ReactViewManagerWrapper.kt

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ import com.facebook.react.uimanager.StateWrapper
1616
import com.facebook.react.uimanager.ThemedReactContext
1717
import com.facebook.react.uimanager.ViewManager
1818

19+
/** Temporary to help trace the cause of T151032868 */
20+
class ReactViewReturnTypeException(message: String) : Exception(message)
21+
1922
interface ReactViewManagerWrapper {
2023
fun createView(
2124
reactTag: Int,
@@ -51,9 +54,21 @@ interface ReactViewManagerWrapper {
5154
props: Any?,
5255
stateWrapper: StateWrapper?,
5356
jsResponderHandler: JSResponderHandler
54-
): View =
55-
viewManager.createView(
56-
reactTag, reactContext, props as? ReactStylesDiffMap, stateWrapper, jsResponderHandler)
57+
): View {
58+
val manager =
59+
viewManager.createView(
60+
reactTag,
61+
reactContext,
62+
props as? ReactStylesDiffMap,
63+
stateWrapper,
64+
jsResponderHandler)
65+
// Throwing to try capture information about the cause of T151032868, remove after.
66+
if (manager == null) {
67+
throw ReactViewReturnTypeException(
68+
"DefaultViewManagerWrapper::createView(${viewManager.getName()}, ${viewManager::class.java}) can't return null")
69+
}
70+
return manager
71+
}
5772

5873
override fun updateProperties(viewToUpdate: View, props: Any?) {
5974
viewManager.updateProperties(viewToUpdate, props as? ReactStylesDiffMap)

0 commit comments

Comments
 (0)