0

我正在尝试安装react-native-fabric-digits。文档是这样说的:

在 MainActivity.java

导入 com.proxima.RCTDigits.DigitsPackage;<--- 添加这个

@Override
protected List<ReactPackage> getPackages() {
  return Arrays.<ReactPackage>asList(
    new MainReactPackage(),
    new DigitsPackage()                         <--- ADD THIS
  );
}

但我的 MainActivity.java(使用 react native v0.40)看起来像这样:

package com.my101;

import com.facebook.react.ReactActivity;
import com.proxima.RCTDigits.DigitsPackage;

public class MainActivity extends ReactActivity {

    /**
     * Returns the name of the main component registered from JavaScript.
     * This is used to schedule rendering of the component.
     */
    @Override
    protected String getMainComponentName() {
        return "My101";
    }
}

那么......我到底在哪里添加了什么?

谢谢。

4

1 回答 1

1

新方法是将其添加到MainApplication.java

@Override
protected List<ReactPackage> getPackages() {
   return Arrays.<ReactPackage>asList(
      new MainReactPackage(),
      new DigitsPackage() 
    );
}
于 2017-03-03T21:56:39.433 回答