fix autolink for react-native-firebase v5

There are 2 warnings when trying to use autolink with react-native-firebase v5

[!] Package react-native-firebase is using deprecated "rnpm" config that will stop working from next release. Please notify its maintainers about it.
Package react-native-firebase has been ignored because it contains invalid configuration. Reason: Unknown option dependency.platforms.android.buildPatch with value "" implementation project(':react-native-firebase')"" was found. This is either a typing error or a user mistake. Fixing it will remove this message.

We can fix the first one, using this config react-native-community/cli#411 (comment):

react-native.config.js

module.exports = {
  dependency: {
    platforms: {
      ios: {
        podspec: './ios/RNFirebase.podspec'
      }
    }
  }
};

or move the podspec to root folder

I’m not sure about the second warning

6 thoughts on “fix autolink for react-native-firebase v5

  1. Until this is fixed, you will want to turn autolink off for react-native-firebase:

    You will want a react-native-.config.js file in root of your project directory, and it should contain at least this for android:

    module.exports = { 
      dependencies: { 
        ‘react-native-firebase’: { 
          platforms: { 
            android: undefined 
          } 
        } 
      } 
    };

    You may paste this into your shell in root of your project to do it:

    echo "module.exports = { dependencies: { 'react-native-firebase’: { platforms: { android: undefined } } } };" > react-native.config.js
  2. The suggested fix here fails on RN 0.60:

    ./node_modules/.bin/react-native config --verbose
    error Cannot convert undefined or null to object
    TypeError: Cannot convert undefined or null to object
        at Function.keys (<anonymous>)
        at isValidRNDependency (/Users/bram/source/applydigital/zo-react-native/node_modules/react-native/node_modules/@react-native-community/cli/build/commands/config/config.js:13:109)
        at Object.keys.forEach.item (/Users/bram/source/applydigital/zo-react-native/node_modules/react-native/node_modules/@react-native-community/cli/build/commands/config/config.js:20:10)
        at Array.forEach (<anonymous>)
        at filterConfig (/Users/bram/source/applydigital/zo-react-native/node_modules/react-native/node_modules/@react-native-community/cli/build/commands/config/config.js:19:38)
        at Object.func (/Users/bram/source/applydigital/zo-react-native/node_modules/react-native/node_modules/@react-native-community/cli/build/commands/config/config.js:31:32)
        at Command.handleAction (/Users/bram/source/applydigital/zo-react-native/node_modules/react-native/node_modules/@react-native-community/cli/build/cliEntry.js:166:21)
        at Command.listener (/Users/bram/source/applydigital/zo-react-native/node_modules/commander/index.js:315:8)
        at Command.emit (events.js:197:13)
        at Command.parseArgs (/Users/bram/source/applydigital/zo-react-native/node_modules/commander/index.js:651:12)
    
  3. After the PR we still need to include some packages manually

    import io.invertase.firebase.messaging.RNFirebaseMessagingPackage;
    import io.invertase.firebase.notifications.RNFirebaseNotificationsPackage;
    
    @Override
        protected List<ReactPackage> getPackages() {
        @SuppressWarnings("UnnecessaryLocalVariable")
          List<ReactPackage> packages = new PackageList(this).getPackages();
    
          packages.add(new RNFirebaseMessagingPackage());
          packages.add(new RNFirebaseNotificationsPackage());
    
          return packages;
        }

    Good enough for me, tks guys

Comments are closed.

fix autolink for react-native-firebase v5

There are 2 warnings when trying to use autolink with react-native-firebase v5

[!] Package react-native-firebase is using deprecated "rnpm" config that will stop working from next release. Please notify its maintainers about it.
Package react-native-firebase has been ignored because it contains invalid configuration. Reason: Unknown option dependency.platforms.android.buildPatch with value "" implementation project(':react-native-firebase')"" was found. This is either a typing error or a user mistake. Fixing it will remove this message.

We can fix the first one, using this config react-native-community/cli#411 (comment):

react-native.config.js

module.exports = {
  dependency: {
    platforms: {
      ios: {
        podspec: './ios/RNFirebase.podspec'
      }
    }
  }
};

or move the podspec to root folder

I’m not sure about the second warning

6 thoughts on “fix autolink for react-native-firebase v5

  1. Until this is fixed, you will want to turn autolink off for react-native-firebase:

    You will want a react-native-.config.js file in root of your project directory, and it should contain at least this for android:

    module.exports = { 
      dependencies: { 
        ‘react-native-firebase’: { 
          platforms: { 
            android: undefined 
          } 
        } 
      } 
    };

    You may paste this into your shell in root of your project to do it:

    echo "module.exports = { dependencies: { 'react-native-firebase’: { platforms: { android: undefined } } } };" > react-native.config.js
  2. The suggested fix here fails on RN 0.60:

    ./node_modules/.bin/react-native config --verbose
    error Cannot convert undefined or null to object
    TypeError: Cannot convert undefined or null to object
        at Function.keys (<anonymous>)
        at isValidRNDependency (/Users/bram/source/applydigital/zo-react-native/node_modules/react-native/node_modules/@react-native-community/cli/build/commands/config/config.js:13:109)
        at Object.keys.forEach.item (/Users/bram/source/applydigital/zo-react-native/node_modules/react-native/node_modules/@react-native-community/cli/build/commands/config/config.js:20:10)
        at Array.forEach (<anonymous>)
        at filterConfig (/Users/bram/source/applydigital/zo-react-native/node_modules/react-native/node_modules/@react-native-community/cli/build/commands/config/config.js:19:38)
        at Object.func (/Users/bram/source/applydigital/zo-react-native/node_modules/react-native/node_modules/@react-native-community/cli/build/commands/config/config.js:31:32)
        at Command.handleAction (/Users/bram/source/applydigital/zo-react-native/node_modules/react-native/node_modules/@react-native-community/cli/build/cliEntry.js:166:21)
        at Command.listener (/Users/bram/source/applydigital/zo-react-native/node_modules/commander/index.js:315:8)
        at Command.emit (events.js:197:13)
        at Command.parseArgs (/Users/bram/source/applydigital/zo-react-native/node_modules/commander/index.js:651:12)
    
  3. After the PR we still need to include some packages manually

    import io.invertase.firebase.messaging.RNFirebaseMessagingPackage;
    import io.invertase.firebase.notifications.RNFirebaseNotificationsPackage;
    
    @Override
        protected List<ReactPackage> getPackages() {
        @SuppressWarnings("UnnecessaryLocalVariable")
          List<ReactPackage> packages = new PackageList(this).getPackages();
    
          packages.add(new RNFirebaseMessagingPackage());
          packages.add(new RNFirebaseNotificationsPackage());
    
          return packages;
        }

    Good enough for me, tks guys

Comments are closed.

fix autolink for react-native-firebase v5

There are 2 warnings when trying to use autolink with react-native-firebase v5

[!] Package react-native-firebase is using deprecated "rnpm" config that will stop working from next release. Please notify its maintainers about it.
Package react-native-firebase has been ignored because it contains invalid configuration. Reason: Unknown option dependency.platforms.android.buildPatch with value "" implementation project(':react-native-firebase')"" was found. This is either a typing error or a user mistake. Fixing it will remove this message.

We can fix the first one, using this config react-native-community/cli#411 (comment):

react-native.config.js

module.exports = {
  dependency: {
    platforms: {
      ios: {
        podspec: './ios/RNFirebase.podspec'
      }
    }
  }
};

or move the podspec to root folder

I’m not sure about the second warning

3 thoughts on “fix autolink for react-native-firebase v5

  1. After the PR we still need to include some packages manually

    import io.invertase.firebase.messaging.RNFirebaseMessagingPackage;
    import io.invertase.firebase.notifications.RNFirebaseNotificationsPackage;
    
    @Override
        protected List<ReactPackage> getPackages() {
        @SuppressWarnings("UnnecessaryLocalVariable")
          List<ReactPackage> packages = new PackageList(this).getPackages();
    
          packages.add(new RNFirebaseMessagingPackage());
          packages.add(new RNFirebaseNotificationsPackage());
    
          return packages;
        }

    Good enough for me, tks guys

Comments are closed.