Nutella Peanut-Butter Marshmallow

    This package has been deprecated

    Author message:

    Package no longer supported. Use at your own risk.


    0.5.0 • Public • Published


    Base UIViewController classes on iOS and base Fragment / Activity on Android. View Controllers on both platforms are providing a straight forward API to create a base controller via dependency injection of the module name as well as initial props for rendering the root component represented from the module name. This allows to not have to subclass a base controller for every component that will be rendered. If dependency injection is not possible, the base controller classes also providing hooks for subclassing to provide great flexibility.


    This project is currently in beta.

    Core APIs are subject to change. We encourage people to try this library out and provide us feedback as we get it to a stable state.

    Getting started

    $ npm install react-native-view-controller --save

    Mostly automatic installation

    $ react-native link react-native-view-controller

    Manual installation


    1. In XCode, in the project navigator, right click LibrariesAdd Files to [your project's name]
    2. Go to node_modulesreact-native-view-controller and add MSRReactNativeViewController.xcodeproj
    3. In XCode, in the project navigator, select your project. Add libMSRReactNativeViewController.a to your project's Build PhasesLink Binary With Libraries
    4. Run your project (Cmd+R)<


    1. Open up android/app/src/main/java/[...]/
    • Add import net.mischneider.MSRReactNativeViewControllerPackage; to the imports at the top of the file
    • Add new MSRReactNativeViewControllerPackage() to the list returned by the getPackages() method
    1. Append the following lines to android/settings.gradle:
      include ':react-native-view-controller'
      project(':react-native-view-controller').projectDir = new File(rootProject.projectDir, 	'../node_modules/react-native-view-controller/android')
    2. Insert the following lines inside the dependencies block in android/app/build.gradle:
        compile project(':react-native-view-controller')


    On iOS the base view controller is represented by the MSRReactNativeViewController:

    // Create a MSRReactNativeViewController and push or present it on the current stack. It uses a MSRReactNativeBridgeManager as view provider. 
    MSRReactNativeBridgeManager *bridgeManager = [MSRReactNativeBridgeManager sharedManager];
    NSString *moduleName = ...; // Name of the root component that should be rendered 
    NSDictionary *initialProperties = ...; // Some initial props that should be passed as initial props to the componentn 
    MSRReactNativeViewController *reactNativeViewController = [[MSRReactNativeViewController alloc] initWithModuleName:moduleName initialProperties:initialProperties viewProvider:bridgeManager];
    // Push or present the React Native view controller on the current navigation stack 
    [self.navigationController pushViewController:reactNativeViewController animated:YES];

    On Android the base view controller is represented by the ReactNativeActivity and the ReactNativeFragment classes:

    // Push a React Native Activity on the current stack. 
    // Create an intent to for the React Native activity that should be presented. `this` is the current activity. 
    Intent intent = new Intent(thisReactNativeActivity.class);
    // Add the module name you would like to launch within the activity 
    String moduleName = ...; // Module name of the root component that should be rendered 
    intent.putExtra(ReactNativeActivity.MainComponentNameIntentName, moduleName);
    // Add the launch options that will get passed down as initial props to the component represented by the module name 
    Bundle options = ...; // Bundle that is passed as initial props 
    intent.putExtra(ReactNativeActivity.LaunchOptionsIntentName, options);
    // Start the ReactNativeActivity 


    Copyright 2018 Michael Schneider

    Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

    Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.


    npm i react-native-view-controller

    DownloadsWeekly Downloads






    Unpacked Size

    184 kB

    Total Files


    Last publish


    • maicki