Skip to content

Commit

Permalink
investigating cause of ReactViewManager returning null
Browse files Browse the repository at this point in the history
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
  • Loading branch information
blakef authored and jeongshin committed May 7, 2023
1 parent 50e12c9 commit 6e5f263
Showing 1 changed file with 18 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ import com.facebook.react.uimanager.StateWrapper
import com.facebook.react.uimanager.ThemedReactContext
import com.facebook.react.uimanager.ViewManager

/** Temporary to help trace the cause of T151032868 */
class ReactViewReturnTypeException(message: String) : Exception(message)

interface ReactViewManagerWrapper {
fun createView(
reactTag: Int,
Expand Down Expand Up @@ -51,9 +54,21 @@ interface ReactViewManagerWrapper {
props: Any?,
stateWrapper: StateWrapper?,
jsResponderHandler: JSResponderHandler
): View =
viewManager.createView(
reactTag, reactContext, props as? ReactStylesDiffMap, stateWrapper, jsResponderHandler)
): View {
val manager =
viewManager.createView(
reactTag,
reactContext,
props as? ReactStylesDiffMap,
stateWrapper,
jsResponderHandler)
// Throwing to try capture information about the cause of T151032868, remove after.
if (manager == null) {
throw ReactViewReturnTypeException(
"DefaultViewManagerWrapper::createView(${viewManager.getName()}, ${viewManager::class.java}) can't return null")
}
return manager
}

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

0 comments on commit 6e5f263

Please sign in to comment.