Use this library to detect React Native App is running within the context of Maestro. (based on: https://maestro.mobile.dev/advanced/detect-maestro-in-your-app)
- supports React Native's New Architecture only (use
1.xfor the Old Architecture)
yarn add react-native-detect-maestro
# or
npm install react-native-detect-maestro
# and then
npx pod-installNote
Swift Package Manager — React Native 0.87+ can build the iOS side with SPM. Once your app uses React Native's SPM integration, this library's Package.swift is picked up by the autolinker automatically. Apps using CocoaPods keep working through DetectMaestro.podspec, which compiles the same ios/ sources.
⚠️ Note: if you are using React Native0.72.xyou need to adduse_modular_headers!in yourios/Podfile.
import {DetectMaestro} from 'react-native-detect-maestro';
DetectMaestro.isMaestro() // true or falseMaestro 2.x picks a random driver port, so pass the isMaestro launch argument in your flows:
- launchApp:
arguments:
isMaestro: trueMaestro 1.x is still detected without the argument (by checking the driver port: 7001 on Android, 22087 on iOS).
| Version | React Native | Architecture |
|---|---|---|
2.x |
0.71+ |
New only |
1.x |
0.65+ |
New & Old |
MIT