Undefined is not an object (evaluating 'Sn[e]')

你。 提交于 2020-03-21 18:06:33

问题


I'm getting this error on Android:

I have found that line of code 'Sn[e]' in 'index.android.bundle' which I have pasted below (ctrl/command + F):

for (var An in Sn) xn[An] = Sn[An];
 for (var Dn in wn) Pt(!Sn[Dn], "Event cannot be both direct and bubbling: %s", Dn), xn[Dn] = wn[Dn];
 var kn = {
   eventTypes: En({}, Sn, wn),
   extractEvents: function(e, t, n, o) {
    var r = Sn[e],
     i = wn[e],
     a = Pn.getPooled(r || i, t, n, o);
    if (r) fn.accumulateTwoPhaseDispatches(a);
    else {
     if (!i) return null;
     fn.accumulateDirectDispatches(a)
    }
    return a
   }
  },
  jn = kn,
  On = {
   handleTopLevel: function(e, t, n, o) {
    G(sn.extractEvents(e, t, n, o))
   }
  },
  Mn = On,
  Hn = 1,
  Un = {
   tagsStartAt: Hn,
   tagCount: Hn,
   allocateTag: function() {
    for (; this.reactTagIsNativeTopRootID(Un.tagCount);) Un.tagCount++;
    var e = Un.tagCount;
    return Un.tagCount++, e
   },
   assertRootTag: function(e) {
    It(this.reactTagIsNativeTopRootID(e), "Expect a native root tag, instead got %s", e)
   },
   reactTagIsNativeTopRootID: function(e) {
    return e % 10 == 1
   }
  },
  Fn = Un,
  Wn = null,
  Ln = {
   injectFiberControlledHostComponent: function(e) {
    Wn = e
   }
  },
  Bn = null,
  Yn = null,
  Vn = {
   injection: Ln,
   enqueueStateRestore: function(e) {
    Bn ? Yn ? Yn.push(e) : Yn = [e] : Bn = e
   },

Looks like a React piece of code because it has injectFiberControlledHostComponent which seems like React Native Fiber. Any idea how I can fix this?

I started the app in android studio and no errors because the app builds and installs fine. I did see this in the android studio gradle console but it's probably not the issue:

Note: /Users/Ben/Development/Projects/vepo/frontend/android/app/src/main/java/com/vepo/MainApplication.java uses or overrides a deprecated API. Note: Recompile with -Xlint:deprecation for details.


回答1:


I faced the same problem and fixed by changing app/build.gradle as:

compile "com.facebook.react:react-native:+"

to

compile ("com.facebook.react:react-native:+") { force = true; }

See also this: https://github.com/facebook/react-native/issues/17840



来源:https://stackoverflow.com/questions/48910717/undefined-is-not-an-object-evaluating-sne

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!