Search code examples
androidreact-nativetwitter-digits

Installing React Native Fabric Digits on Android


I'm trying to install react-native-fabric-digits. The documentation says this:

In MainActivity.java

import com.proxima.RCTDigits.DigitsPackage; <--- ADD THIS

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

but my MainActivity.java (using react native v0.40) looks like this:

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";
    }
}

So... what exactly do I add where?

Thanks.


Solution

  • the new way is to add it to MainApplication.java

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