未定义不是对象(评估' Sn [e]')

时间:2018-02-21 16:22:47

标签: android react-native react-native-android

我在Android上收到此错误:

enter image description here

我在" index.android.bundle'中找到了代码行'Sn[e]'。我在下面粘贴了(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
   },

看起来像React的一段代码,因为它有injectFiberControlledHostComponent,看起来像React Native Fibre。知道如何解决这个问题吗?

我在android studio中启动了应用程序并且没有错误,因为应用程序构建和安装很好。我确实在android studio gradle控制台中看到了这个,但它可能不是问题所在:

  

注意:   /Users/Ben/Development/Projects/vepo/frontend/android/app/src/main/java/com/vepo/MainApplication.java   使用或覆盖已弃用的API。注意:重新编译   -Xlint:弃用细节。

1 个答案:

答案 0 :(得分:0)

我遇到了同样的问题,并通过将compile "com.facebook.react:react-native:+" 更改为:

来解决

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

@Configuration @EnableWebSecurity public class SecurityConfig extends WebSecurityConfigurerAdapter { @Override protected void configure(HttpSecurity http) throws Exception { http.csrf().disable() .authorizeRequests() .antMatchers(HttpMethod.POST, "/user/login", "/user/sso/login") .permitAll() .anyRequest().authenticated() .and() .authorizeRequests() .antMatchers(HttpMethod.GET, "/pos/findAllList") .authenticated().and() .addFilterBefore(new JWTAuthenticationFilter(), FilterSecurityInterceptor.class) .sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS); } @Override public void configure(WebSecurity web) throws Exception { super.configure(web); web .ignoring() .antMatchers("/admin/swagger/**"); } }

另见:https://github.com/facebook/react-native/issues/17840