-
- All Implemented Interfaces:
-
android.graphics.drawable.Drawable.Callback
,android.view.KeyEvent.Callback
,android.view.ViewManager
,android.view.ViewParent
,android.view.accessibility.AccessibilityEventSource
,com.facebook.react.uimanager.ReactRoot
,com.facebook.react.uimanager.RootView
public class ReactRootView extends FrameLayout implements RootView, ReactRoot
Default root view for catalyst apps. Provides the ability to listen for size changes so that a UI manager can re-layout its elements. It delegates handling touch events for itself and child views and sending those events to JS by using JSTouchDispatcher. This view is overriding method in order to be notified about the events for all of its children and it's also overriding requestDisallowInterceptTouchEvent to make sure that onInterceptTouchEvent will get events even when some child view start intercepting it. In case when no child view is interested in handling some particular touch event, this view's onTouchEvent will still return true in order to be notified about all subsequent touch events related to that gesture (in case when JS code wants to handle that gesture).
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public interface
ReactRootView.ReactRootViewEventListener
Listener interface for react root view events
-
Constructor Summary
Constructors Constructor Description ReactRootView(Context context)
ReactRootView(Context context, AttributeSet attrs)
ReactRootView(Context context, AttributeSet attrs, int defStyle)
-
Method Summary
Modifier and Type Method Description void
onChildStartedNativeGesture(MotionEvent ev)
void
onChildStartedNativeGesture(View childView, MotionEvent ev)
Called when a child starts a native gesture (e.g. void
onChildEndedNativeGesture(View childView, MotionEvent ev)
Called when a child ends a native gesture. boolean
shouldDispatchJSTouchEvent(MotionEvent ev)
boolean
onInterceptTouchEvent(MotionEvent ev)
boolean
onInterceptHoverEvent(MotionEvent ev)
boolean
onTouchEvent(MotionEvent ev)
boolean
onHoverEvent(MotionEvent ev)
boolean
dispatchKeyEvent(KeyEvent ev)
void
requestChildFocus(View child, View focused)
void
requestDisallowInterceptTouchEvent(boolean disallowIntercept)
void
onViewAdded(View child)
ViewGroup
getRootViewGroup()
Return native view for root void
startReactApplication(ReactInstanceManager reactInstanceManager, String moduleName)
{@see #startReactApplication(ReactInstanceManager, String, android.os. void
startReactApplication(ReactInstanceManager reactInstanceManager, String moduleName, @Nullable() Bundle initialProperties)
{@see #startReactApplication(ReactInstanceManager, String, android.os. void
startReactApplication(ReactInstanceManager reactInstanceManager, String moduleName, @Nullable() Bundle initialProperties, @Nullable() String initialUITemplate)
Schedule rendering of the react component rendered by the JS application from the given JSmodule (@{param moduleName}) using provided {@param reactInstanceManager} to attach to the JScontext of that manager. int
getWidthMeasureSpec()
int
getHeightMeasureSpec()
void
setShouldLogContentAppeared(boolean shouldLogContentAppeared)
Sets a flag that determines whether to log that content appeared on next view added. String
getSurfaceID()
AtomicInteger
getState()
void
unmountReactApplication()
Unmount the react application at this root view, reclaiming any JS memory associated with thatapplication. void
onStage(int stage)
Handler for stages com.facebook.react.surface.ReactStage void
onAttachedToReactInstance()
void
setEventListener(@Nullable() ReactRootView.ReactRootViewEventListener eventListener)
String
getJSModuleName()
Bundle
getAppProperties()
Return cached launch properties for app String
getInitialUITemplate()
void
setAppProperties(@Nullable() Bundle appProperties)
void
runApplication()
Calls into JS to start the React application. int
getRootViewTag()
void
setRootViewTag(int rootViewTag)
void
handleException(Throwable t)
void
setIsFabric(boolean isFabric)
int
getUIManagerType()
Fabric or Default UI Manager, see UIManagerType ReactInstanceManager
getReactInstanceManager()
-
Methods inherited from class android.widget.FrameLayout
generateLayoutParams, getAccessibilityClassName, getConsiderGoneChildrenWhenMeasuring, getMeasureAllChildren, setForegroundGravity, setMeasureAllChildren, shouldDelayChildPressedState
-
Methods inherited from class android.view.ViewGroup
addChildrenForAccessibility, addExtraDataToAccessibilityNodeInfo, addFocusables, addKeyboardNavigationClusters, addStatesFromChildren, addTouchables, addView, bringChildToFront, childDrawableStateChanged, childHasTransientStateChanged, clearChildFocus, clearDisappearingChildren, clearFocus, dispatchApplyWindowInsets, dispatchCapturedPointerEvent, dispatchConfigurationChanged, dispatchCreateViewTranslationRequest, dispatchDisplayHint, dispatchDragEvent, dispatchDrawableHotspotChanged, dispatchFinishTemporaryDetach, dispatchKeyEvent, dispatchKeyEventPreIme, dispatchKeyShortcutEvent, dispatchPointerCaptureChanged, dispatchProvideAutofillStructure, dispatchProvideStructure, dispatchScrollCaptureSearch, dispatchSetActivated, dispatchSetSelected, dispatchStartTemporaryDetach, dispatchSystemUiVisibilityChanged, dispatchTouchEvent, dispatchTrackballEvent, dispatchUnhandledMove, dispatchWindowFocusChanged, dispatchWindowInsetsAnimationEnd, dispatchWindowInsetsAnimationPrepare, dispatchWindowInsetsAnimationProgress, dispatchWindowInsetsAnimationStart, dispatchWindowSystemUiVisiblityChanged, dispatchWindowVisibilityChanged, endViewTransition, findFocus, findViewsWithText, focusSearch, focusableViewAvailable, gatherTransparentRegion, getChildAt, getChildCount, getChildMeasureSpec, getChildVisibleRect, getClipChildren, getClipToPadding, getDescendantFocusability, getFocusedChild, getLayoutAnimation, getLayoutAnimationListener, getLayoutMode, getLayoutTransition, getNestedScrollAxes, getOverlay, getPersistentDrawingCache, getTouchscreenBlocksFocus, hasFocus, hasTransientState, indexOfChild, invalidateChild, invalidateChildInParent, isAlwaysDrawnWithCacheEnabled, isAnimationCacheEnabled, isLayoutSuppressed, isMotionEventSplittingEnabled, isTransitionGroup, jumpDrawablesToCurrentState, layout, notifySubtreeAccessibilityStateChanged, offsetDescendantRectToMyCoords, offsetRectIntoDescendantCoords, onDescendantInvalidated, onInterceptHoverEvent, onInterceptTouchEvent, onNestedFling, onNestedPreFling, onNestedPrePerformAccessibilityAction, onNestedPreScroll, onNestedScroll, onNestedScrollAccepted, onRequestSendAccessibilityEvent, onResolvePointerIcon, onStartNestedScroll, onStopNestedScroll, onViewAdded, onViewRemoved, recomputeViewAttributes, removeAllViews, removeAllViewsInLayout, removeView, removeViewAt, removeViewInLayout, removeViews, removeViewsInLayout, requestChildFocus, requestChildRectangleOnScreen, requestDisallowInterceptTouchEvent, requestFocus, requestSendAccessibilityEvent, requestTransparentRegion, restoreDefaultFocus, scheduleLayoutAnimation, setAddStatesFromChildren, setAlwaysDrawnWithCacheEnabled, setAnimationCacheEnabled, setClipChildren, setClipToPadding, setDescendantFocusability, setLayoutAnimation, setLayoutAnimationListener, setLayoutMode, setLayoutTransition, setMotionEventSplittingEnabled, setOnHierarchyChangeListener, setPersistentDrawingCache, setTouchscreenBlocksFocus, setTransitionGroup, setWindowInsetsAnimationCallback, showContextMenuForChild, startActionModeForChild, startLayoutAnimation, startViewTransition, suppressLayout, updateViewLayout
-
Methods inherited from class android.view.View
addOnAttachStateChangeListener, addOnLayoutChangeListener, addOnUnhandledKeyEventListener, animate, announceForAccessibility, autofill, bringToFront, buildDrawingCache, buildLayer, callOnClick, canResolveLayoutDirection, canResolveTextAlignment, canResolveTextDirection, canScrollHorizontally, canScrollVertically, cancelDragAndDrop, cancelLongPress, cancelPendingInputEvents, checkInputConnectionProxy, clearAnimation, clearViewTranslationCallback, combineMeasuredStates, computeScroll, computeSystemWindowInsets, createAccessibilityNodeInfo, createContextMenu, destroyDrawingCache, dispatchGenericMotionEvent, dispatchNestedFling, dispatchNestedPreFling, dispatchNestedPrePerformAccessibilityAction, dispatchNestedPreScroll, dispatchNestedScroll, dispatchPopulateAccessibilityEvent, draw, drawableHotspotChanged, findViewById, findViewWithTag, forceHasOverlappingRendering, forceLayout, generateDisplayHash, generateViewId, getAccessibilityDelegate, getAccessibilityLiveRegion, getAccessibilityNodeProvider, getAccessibilityPaneTitle, getAccessibilityTraversalAfter, getAccessibilityTraversalBefore, getAlpha, getAnimation, getAnimationMatrix, getApplicationWindowToken, getAttributeResolutionStack, getAttributeSourceResourceMap, getAutofillHints, getAutofillId, getAutofillType, getAutofillValue, getBackground, getBackgroundTintBlendMode, getBackgroundTintList, getBackgroundTintMode, getBaseline, getBottom, getCameraDistance, getClipBounds, getClipBounds, getClipToOutline, getContentCaptureSession, getContentDescription, getContext, getDefaultFocusHighlightEnabled, getDefaultSize, getDisplay, getDrawableState, getDrawingCache, getDrawingCacheBackgroundColor, getDrawingCacheQuality, getDrawingRect, getDrawingTime, getElevation, getExplicitStyle, getFilterTouchesWhenObscured, getFitsSystemWindows, getFocusable, getFocusables, getFocusedRect, getForeground, getForegroundGravity, getForegroundTintBlendMode, getForegroundTintList, getForegroundTintMode, getGlobalVisibleRect, getHandler, getHasOverlappingRendering, getHeight, getHitRect, getHorizontalFadingEdgeLength, getHorizontalScrollbarThumbDrawable, getHorizontalScrollbarTrackDrawable, getId, getImportantForAccessibility, getImportantForAutofill, getImportantForContentCapture, getKeepScreenOn, getKeyDispatcherState, getLabelFor, getLayerType, getLayoutDirection, getLayoutParams, getLeft, getLocalVisibleRect, getLocationInSurface, getLocationInWindow, getLocationOnScreen, getMatrix, getMeasuredHeight, getMeasuredHeightAndState, getMeasuredState, getMeasuredWidth, getMeasuredWidthAndState, getMinimumHeight, getMinimumWidth, getNextClusterForwardId, getNextFocusDownId, getNextFocusForwardId, getNextFocusLeftId, getNextFocusRightId, getNextFocusUpId, getOnFocusChangeListener, getOutlineAmbientShadowColor, getOutlineProvider, getOutlineSpotShadowColor, getOverScrollMode, getOverlay, getPaddingBottom, getPaddingEnd, getPaddingLeft, getPaddingRight, getPaddingStart, getPaddingTop, getParent, getParentForAccessibility, getPivotX, getPivotY, getPointerIcon, getReceiveContentMimeTypes, getResources, getRevealOnFocusHint, getRight, getRootSurfaceControl, getRootView, getRootWindowInsets, getRotation, getRotationX, getRotationY, getScaleX, getScaleY, getScrollBarDefaultDelayBeforeFade, getScrollBarFadeDuration, getScrollBarSize, getScrollBarStyle, getScrollCaptureHint, getScrollIndicators, getScrollX, getScrollY, getSolidColor, getSourceLayoutResId, getStateDescription, getStateListAnimator, getSystemGestureExclusionRects, getSystemUiVisibility, getTag, getTextAlignment, getTextDirection, getTooltipText, getTop, getTouchDelegate, getTouchables, getTransitionAlpha, getTransitionName, getTranslationX, getTranslationY, getTranslationZ, getUniqueDrawingId, getVerticalFadingEdgeLength, getVerticalScrollbarPosition, getVerticalScrollbarThumbDrawable, getVerticalScrollbarTrackDrawable, getVerticalScrollbarWidth, getViewTranslationResponse, getViewTreeObserver, getVisibility, getWidth, getWindowId, getWindowInsetsController, getWindowSystemUiVisibility, getWindowToken, getWindowVisibility, getWindowVisibleDisplayFrame, getX, getY, getZ, hasExplicitFocusable, hasFocusable, hasNestedScrollingParent, hasOnClickListeners, hasOnLongClickListeners, hasOverlappingRendering, hasPointerCapture, hasWindowFocus, inflate, invalidate, invalidateDrawable, invalidateOutline, isAccessibilityFocused, isAccessibilityHeading, isActivated, isAttachedToWindow, isClickable, isContextClickable, isDirty, isDrawingCacheEnabled, isDuplicateParentStateEnabled, isEnabled, isFocusable, isFocusableInTouchMode, isFocused, isFocusedByDefault, isForceDarkAllowed, isHapticFeedbackEnabled, isHardwareAccelerated, isHorizontalFadingEdgeEnabled, isHorizontalScrollBarEnabled, isHovered, isImportantForAccessibility, isImportantForAutofill, isImportantForContentCapture, isInEditMode, isInLayout, isInTouchMode, isKeyboardNavigationCluster, isLaidOut, isLayoutDirectionResolved, isLayoutRequested, isLongClickable, isNestedScrollingEnabled, isOpaque, isPaddingRelative, isPivotSet, isPressed, isSaveEnabled, isSaveFromParentEnabled, isScreenReaderFocusable, isScrollContainer, isScrollbarFadingEnabled, isSelected, isShowingLayoutBounds, isShown, isSoundEffectsEnabled, isTemporarilyDetached, isTextAlignmentResolved, isTextDirectionResolved, isVerticalFadingEdgeEnabled, isVerticalScrollBarEnabled, isVisibleToUserForAutofill, keyboardNavigationClusterSearch, measure, offsetLeftAndRight, offsetTopAndBottom, onApplyWindowInsets, onCancelPendingInputEvents, onCapturedPointerEvent, onCheckIsTextEditor, onCreateInputConnection, onCreateViewTranslationRequest, onCreateVirtualViewTranslationRequests, onDragEvent, onDrawForeground, onFilterTouchEventForSecurity, onFinishTemporaryDetach, onGenericMotionEvent, onHoverChanged, onHoverEvent, onInitializeAccessibilityEvent, onInitializeAccessibilityNodeInfo, onKeyDown, onKeyLongPress, onKeyMultiple, onKeyPreIme, onKeyShortcut, onKeyUp, onPointerCaptureChange, onPopulateAccessibilityEvent, onProvideAutofillStructure, onProvideAutofillVirtualStructure, onProvideContentCaptureStructure, onProvideStructure, onProvideVirtualStructure, onReceiveContent, onRtlPropertiesChanged, onScreenStateChanged, onScrollCaptureSearch, onStartTemporaryDetach, onTouchEvent, onTrackballEvent, onViewTranslationResponse, onVirtualViewTranslationResponses, onVisibilityAggregated, onWindowFocusChanged, onWindowSystemUiVisibilityChanged, performAccessibilityAction, performClick, performContextClick, performHapticFeedback, performLongClick, performReceiveContent, playSoundEffect, post, postDelayed, postInvalidate, postInvalidateDelayed, postInvalidateOnAnimation, postOnAnimation, postOnAnimationDelayed, refreshDrawableState, releasePointerCapture, removeCallbacks, removeOnAttachStateChangeListener, removeOnLayoutChangeListener, removeOnUnhandledKeyEventListener, requestApplyInsets, requestFitSystemWindows, requestFocusFromTouch, requestLayout, requestPointerCapture, requestRectangleOnScreen, requestUnbufferedDispatch, requireViewById, resetPivot, resolveSize, resolveSizeAndState, restoreHierarchyState, saveAttributeDataForStyleable, saveHierarchyState, scheduleDrawable, scrollBy, scrollTo, sendAccessibilityEvent, sendAccessibilityEventUnchecked, setAccessibilityDelegate, setAccessibilityHeading, setAccessibilityLiveRegion, setAccessibilityPaneTitle, setAccessibilityTraversalAfter, setAccessibilityTraversalBefore, setActivated, setAllowClickWhenDisabled, setAlpha, setAnimation, setAnimationMatrix, setAutofillHints, setAutofillId, setBackground, setBackgroundColor, setBackgroundDrawable, setBackgroundResource, setBackgroundTintBlendMode, setBackgroundTintList, setBackgroundTintMode, setBottom, setCameraDistance, setClickable, setClipBounds, setClipToOutline, setContentCaptureSession, setContentDescription, setContextClickable, setDefaultFocusHighlightEnabled, setDrawingCacheBackgroundColor, setDrawingCacheEnabled, setDrawingCacheQuality, setDuplicateParentStateEnabled, setElevation, setEnabled, setFadingEdgeLength, setFilterTouchesWhenObscured, setFitsSystemWindows, setFocusable, setFocusableInTouchMode, setFocusedByDefault, setForceDarkAllowed, setForeground, setForegroundTintBlendMode, setForegroundTintList, setForegroundTintMode, setHapticFeedbackEnabled, setHasTransientState, setHorizontalFadingEdgeEnabled, setHorizontalScrollBarEnabled, setHorizontalScrollbarThumbDrawable, setHorizontalScrollbarTrackDrawable, setHovered, setId, setImportantForAccessibility, setImportantForAutofill, setImportantForContentCapture, setKeepScreenOn, setKeyboardNavigationCluster, setLabelFor, setLayerPaint, setLayerType, setLayoutDirection, setLayoutParams, setLeft, setLeftTopRightBottom, setLongClickable, setMinimumHeight, setMinimumWidth, setNestedScrollingEnabled, setNextClusterForwardId, setNextFocusDownId, setNextFocusForwardId, setNextFocusLeftId, setNextFocusRightId, setNextFocusUpId, setOnApplyWindowInsetsListener, setOnCapturedPointerListener, setOnClickListener, setOnContextClickListener, setOnCreateContextMenuListener, setOnDragListener, setOnFocusChangeListener, setOnGenericMotionListener, setOnHoverListener, setOnKeyListener, setOnLongClickListener, setOnReceiveContentListener, setOnScrollChangeListener, setOnSystemUiVisibilityChangeListener, setOnTouchListener, setOutlineAmbientShadowColor, setOutlineProvider, setOutlineSpotShadowColor, setOverScrollMode, setPadding, setPaddingRelative, setPivotX, setPivotY, setPointerIcon, setPressed, setRenderEffect, setRevealOnFocusHint, setRight, setRotation, setRotationX, setRotationY, setSaveEnabled, setSaveFromParentEnabled, setScaleX, setScaleY, setScreenReaderFocusable, setScrollBarDefaultDelayBeforeFade, setScrollBarFadeDuration, setScrollBarSize, setScrollBarStyle, setScrollCaptureCallback, setScrollCaptureHint, setScrollContainer, setScrollIndicators, setScrollX, setScrollY, setScrollbarFadingEnabled, setSelected, setSoundEffectsEnabled, setStateDescription, setStateListAnimator, setSystemGestureExclusionRects, setSystemUiVisibility, setTag, setTextAlignment, setTextDirection, setTooltipText, setTop, setTouchDelegate, setTransitionAlpha, setTransitionName, setTransitionVisibility, setTranslationX, setTranslationY, setTranslationZ, setVerticalFadingEdgeEnabled, setVerticalScrollBarEnabled, setVerticalScrollbarPosition, setVerticalScrollbarThumbDrawable, setVerticalScrollbarTrackDrawable, setViewTranslationCallback, setVisibility, setWillNotCacheDrawing, setWillNotDraw, setX, setY, setZ, showContextMenu, startActionMode, startAnimation, startDrag, startDragAndDrop, startNestedScroll, stopNestedScroll, toString, transformMatrixToGlobal, transformMatrixToLocal, unscheduleDrawable, updateDragShadow, willNotCacheDrawing, willNotDraw
-
Methods inherited from class com.facebook.react.uimanager.RootView
handleException
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Constructor Detail
-
ReactRootView
ReactRootView(Context context)
-
ReactRootView
ReactRootView(Context context, AttributeSet attrs)
-
ReactRootView
ReactRootView(Context context, AttributeSet attrs, int defStyle)
-
-
Method Detail
-
onChildStartedNativeGesture
void onChildStartedNativeGesture(MotionEvent ev)
-
onChildStartedNativeGesture
void onChildStartedNativeGesture(View childView, MotionEvent ev)
Called when a child starts a native gesture (e.g. a scroll in a ScrollView). Should be calledfrom the child's onTouchIntercepted implementation.
-
onChildEndedNativeGesture
void onChildEndedNativeGesture(View childView, MotionEvent ev)
Called when a child ends a native gesture. Should be called from the child's onTouchInterceptedimplementation.
-
shouldDispatchJSTouchEvent
boolean shouldDispatchJSTouchEvent(MotionEvent ev)
-
onInterceptTouchEvent
boolean onInterceptTouchEvent(MotionEvent ev)
-
onInterceptHoverEvent
boolean onInterceptHoverEvent(MotionEvent ev)
-
onTouchEvent
boolean onTouchEvent(MotionEvent ev)
-
onHoverEvent
boolean onHoverEvent(MotionEvent ev)
-
dispatchKeyEvent
boolean dispatchKeyEvent(KeyEvent ev)
-
requestChildFocus
void requestChildFocus(View child, View focused)
-
requestDisallowInterceptTouchEvent
void requestDisallowInterceptTouchEvent(boolean disallowIntercept)
-
onViewAdded
void onViewAdded(View child)
-
getRootViewGroup
ViewGroup getRootViewGroup()
Return native view for root
-
startReactApplication
void startReactApplication(ReactInstanceManager reactInstanceManager, String moduleName)
{@see #startReactApplication(ReactInstanceManager, String, android.os.Bundle)}
-
startReactApplication
void startReactApplication(ReactInstanceManager reactInstanceManager, String moduleName, @Nullable() Bundle initialProperties)
{@see #startReactApplication(ReactInstanceManager, String, android.os.Bundle, String)}
-
startReactApplication
void startReactApplication(ReactInstanceManager reactInstanceManager, String moduleName, @Nullable() Bundle initialProperties, @Nullable() String initialUITemplate)
Schedule rendering of the react component rendered by the JS application from the given JSmodule (@{param moduleName}) using provided {@param reactInstanceManager} to attach to the JScontext of that manager. Extra parameter {@param launchOptions} can be used to pass initialproperties for the react component.
-
getWidthMeasureSpec
int getWidthMeasureSpec()
-
getHeightMeasureSpec
int getHeightMeasureSpec()
-
setShouldLogContentAppeared
void setShouldLogContentAppeared(boolean shouldLogContentAppeared)
Sets a flag that determines whether to log that content appeared on next view added.
-
getSurfaceID
@Nullable() String getSurfaceID()
-
getState
AtomicInteger getState()
-
unmountReactApplication
void unmountReactApplication()
Unmount the react application at this root view, reclaiming any JS memory associated with thatapplication. If startReactApplication is called, this method must be called before theReactRootView is garbage collected (typically in your Activity's onDestroy, or in yourFragment's onDestroyView).
-
onStage
void onStage(int stage)
Handler for stages com.facebook.react.surface.ReactStage
-
onAttachedToReactInstance
void onAttachedToReactInstance()
-
setEventListener
void setEventListener(@Nullable() ReactRootView.ReactRootViewEventListener eventListener)
-
getJSModuleName
String getJSModuleName()
-
getAppProperties
@Nullable() Bundle getAppProperties()
Return cached launch properties for app
-
getInitialUITemplate
@Nullable() String getInitialUITemplate()
-
setAppProperties
void setAppProperties(@Nullable() Bundle appProperties)
-
runApplication
void runApplication()
Calls into JS to start the React application. Can be called multiple times with the samerootTag, which will re-render the application from the root.
-
getRootViewTag
int getRootViewTag()
-
setRootViewTag
void setRootViewTag(int rootViewTag)
-
handleException
void handleException(Throwable t)
-
setIsFabric
void setIsFabric(boolean isFabric)
-
getUIManagerType
int getUIManagerType()
Fabric or Default UI Manager, see UIManagerType
-
getReactInstanceManager
@Nullable() ReactInstanceManager getReactInstanceManager()
-
-
-
-