$ show radarlabs/react-native-radar
This repository is a React Native library that wraps Radar's native iOS and Android SDKs to provide geofencing, location tracking, trip tracking, geocoding, search, context, route/matrix, places, beacons, fraud verification, and in-app messaging capabilities. It exposes a JavaScript API (Radar.initialize, Radar.autocomplete, etc.) and optional UI components (Map, Autocomplete) for use in React Native applications. The architecture consists of a TypeScript/JavaScript layer that communicates with native code via React Native's bridge (old and new architectures), with vendored iOS xcframeworks and Android Java modules. The library handles native setup automation (AppDelegate injection, Podfile modification) through an Expo config plugin, and includes version sync scripts to keep SDK versions consistent across platforms. It supports both iOS and Android, with optional fraud and motion SDK extensions. The example app demonstrates usage with MapLibre for map display. The codebase is well-structured with CI workflows, tests for the Expo config plugin, and careful version management, though it carries binary xcframework artifacts and dual architecture support that increase maintenance surface.
The LLM identified 3 files worth highlighting for reuse:
This file implements an Expo config plugin that automates iOS native setup by injecting code into AppDelegate and Podfile using sentinel markers. It reads the AppDelegate source, finds the didFinishLaunchingWithOptions method, and inserts Radar nativeSetup calls. It also adds Radar pods to the Podfile. The pattern of using sentinel markers and regex-based injection is reusable for any React Native native module that needs to modify iOS build files, and the module is self-contained with clear inputs and outputs.
This script synchronizes version numbers across multiple files (package.json, android/build.gradle, ios/Radar.podspec, etc.) by reading a source version and applying regex replacements. It ensures consistency between npm, Android, and iOS SDK versions. The pattern of a centralized version update script is reusable for any multi-platform package that needs to keep version strings in sync across different build systems.
This is a stub Objective-C file that provides empty implementations for RadarSDKFraud methods, allowing the React Native module to be used without the fraud SDK linked. It demonstrates a clean pattern for optional native dependencies: provide a stub that satisfies the linker, and conditionally load the real implementation at runtime. This pattern can be extracted and reused for any native module that wants to make certain features optional without breaking the build.