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

The following examples show how to use com.facebook.react.ReactRootView#getParent() . 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 File: PreReactRootViewLoader.java    From vinci with 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
Source File: ReactPreLoader.java    From react-native-preloader with Apache License 2.0 5 votes vote down vote up
/**
 * 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());
    }
}