Skip to main content
Learn how to configure React Native CLI behavior, platform settings, and project-specific options using react-native.config.js.

Overview

The react-native.config.js file (formerly react-native.config.js) allows you to configure:
  • Native dependencies (autolinking)
  • Platform-specific settings
  • Asset directories
  • CLI plugin behavior

Configuration File

Create react-native.config.js in your project root:
react-native.config.js

Project Configuration

iOS Settings

react-native.config.js

Android Settings

react-native.config.js

Asset Management

Custom Asset Directories

react-native.config.js
This tells React Native to link assets from these directories during builds.

Font Linking

react-native.config.js
Run to link fonts:

Dependency Configuration

Configure autolinking behavior for native dependencies.

Disable Autolinking for Specific Package

react-native.config.js

Custom Linking Configuration

react-native.config.js

Exclude Dependencies

react-native.config.js

Custom Commands

Add custom CLI commands:
react-native.config.js
Run:

Platform-Specific Configurations

iOS Pod Configuration

react-native.config.js

Android Gradle Configuration

react-native.config.js

Common Use Cases

Monorepo Setup

react-native.config.js

Custom Asset Paths

react-native.config.js

Multiple App Variants

react-native.config.js

Disable Flipper

react-native.config.js

Autolinking

How Autolinking Works

React Native CLI automatically links native dependencies based on:
  1. Package’s react-native.config.js
  2. Your project’s react-native.config.js
  3. Convention-based discovery

View Autolinking Config

Shows resolved configuration including all dependencies.

Debug Autolinking

Library Configuration

If you’re building a React Native library, configure it for autolinking:
react-native.config.js

Environment-Specific Config

react-native.config.js

Reactotron Configuration

Integrate Reactotron with custom config:
react-native.config.js

Troubleshooting

Dependency Not Linking

Solution:
  1. Check config:
  1. Verify dependency has proper config
  2. Try manual linking if needed

Assets Not Found

Solution:
react-native.config.js
Then run:

CocoaPods Issues

Solution:
react-native.config.js

Gradle Build Fails

Solution: Ensure Android config points to correct paths:

Migration from Old Config

If you have old rn-cli.config.js:

Old Format

rn-cli.config.js

New Format

react-native.config.js
Metro config moved to metro.config.js.

Best Practices

Only include necessary configuration. React Native’s defaults work for most cases.
Add comments explaining why custom configuration is needed:
Make config environment-aware:
Commit react-native.config.js to version control.

Metro Config

For bundler configuration, use metro.config.js:
metro.config.js

Babel Config

For JavaScript transformation, use babel.config.js:
babel.config.js

TypeScript Config

For TypeScript, use tsconfig.json:
tsconfig.json

CLI Commands Reference

View Config

Doctor (Check Setup)

Info (Environment Info)

Advanced Configuration

Custom Plugin

react-native.config.js

Hooks

react-native.config.js

Next Steps

Metro Config

Configure Metro bundler

CLI Overview

All available CLI commands

Native Modules

Build native modules

Autolinking

Understanding autolinking