react-native: Error: undefined is not a function (evaluating 'UIManager.setChildren(containerTag,createdTags)')

Environment:

  • react-native 0.26.0-rc
  • react 15.0.2
  • Android 5.1.1 API 22
  • Mac OSX 10.11.14

Issue: When running my app (in dev mode), I am getting the following error:

E/ReactNativeJS: undefined is not a function (evaluating ‘UIManager.setChildren(containerTag,createdTags)’)

All attempts at debugging have failed on my part. The Android app contains both native and react-native code, but I currently have no NativeModules or Views - just an Activity whose onCreate is:

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        Fabric.with(this, new Crashlytics(), new CrashlyticsNdk());
        mReactRootView = new ReactRootView(this);
        mReactInstanceManager = ReactInstanceManager.builder()
                .setApplication(getApplication())
                .setBundleAssetName("index.android.bundle")
                .setJSMainModuleName("index.android")
                .addPackage(new MainReactPackage())
                .setUseDeveloperSupport(BuildConfig.DEBUG)
                .setInitialLifecycleState(LifecycleState.RESUMED)
                .build();
        mReactRootView.startReactApplication(mReactInstanceManager, "Insights");
        setContentView(mReactRootView);
    }

I’ve attached a screenshot of the emulator:

screen shot 2016-05-05 at 12 01 10 pm

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Reactions: 3
  • Comments: 18 (5 by maintainers)

Most upvoted comments

Yeah getting this too after upgrading to 0.26.2. I got a temporary workaround by re-adding the deleted code from UIManager.js

if (!UIManager.setChildren) {

  /**
   * Index cache (used by setChildren())
   */
  UIManager._cachedIndexArray = function(size) {
    var cachedResult = this._cachedIndexArray._cache[size];
    if (!cachedResult) {
      var arr = [];
      for (var i = 0; i < size; i++) {
        arr[i] = i;
      }
      this._cachedIndexArray._cache[size] = arr;
      return arr;
    } else {
      return cachedResult;
    }
  };
  UIManager._cachedIndexArray._cache = {};

  /**
   * Fallback setChildren() implementation for Android
   */
  UIManager.setChildren = function(containerTag, createdTags) {
    var indexes = this._cachedIndexArray(createdTags.length);
    UIManager.manageChildren(containerTag, null, null, createdTags, indexes, null);
  };
}

I think react-native version is not stable. When I want to develop with android ,there are many problem.

I have the same problem too, when I use “npm init” that default react-native version was “^0.26.1”, the react version was “15.0.2”,I have this problem. I resolved the problem by degradation react-native version to “^0.25.1” ,the react version to “0.14.8”