Java Code Examples for com.facebook.react.ReactRootView#getParent()

The following examples show how to use com.facebook.react.ReactRootView#getParent() . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: vinci   File: PreReactRootViewLoader.java    License: Apache License 2.0 5 votes vote down vote up
public static void removeView(String componentName){
    ReactRootView reactRootView = CACHE.get(componentName);
    ViewGroup parentView = (ViewGroup) reactRootView.getParent();
    if(parentView != null){
        parentView.removeView(reactRootView);
    }
}
 
Example 2
/**
 * Remove {@link ReactRootView} from parent.
 */
public static void onDestroy(ReactInfo reactInfo) {
    try {
        ReactRootView rootView = getRootView(reactInfo);
        ViewGroup parent = (ViewGroup) rootView.getParent();
        if (parent != null) {
            parent.removeView(rootView);
        }
    } catch (Throwable e) {
        Log.e(TAG, e.getMessage());
    }
}