Registry / messaging / react-native-grpc-service

react-native-grpc-service

JSON →
library0.1.17jsnpmunverified

React Native bridge for gRPC services, enabling communication with gRPC servers via Protobuf definitions. Current version 0.1.17 targets React Native 0.62.2+. It requires manual native configuration (iOS/Android) and uses a JSON config file to specify proto files. Supports unary requests; streaming features are in roadmap. Differentiates as a pure RN-native solution without JavaScript fallback.

npm install react-native-grpc-service
INSTALL
IMPORT
SIG · REACT-NATIVE-GRPC-
R
react-native-grpc-service
messagingjavascriptv0.1.17
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default
✓ import RNGrpcService from 'react-native-grpc-service';
✗ const RNGrpcService = require('react-native-grpc-service');
ESM default import is recommended; CJS require may not trigger native module linking correctly.
TodoService with dot notation
✓ GrpcService.TodoService.Create({ name: 'test' }).then(...)
✗ new GrpcService().TodoService.Create(...)
GrpcService is a class instantiated with server address; service methods are accessed directly on the instance.
Configuration via JSON file
✓ Place react-native-grpc-service.json in project root with protoDirectory and protoFile.
✗ Pass config directly to constructor
Configuration is read from the JSON file at app startup, not passed programmatically.

Shows full setup: install, config file, class instantiation, and unary request call.

// 1. Install: npm install react-native-grpc-service // 2. Create react-native-grpc-service.json at project root: { "protoDirectory": "../server/proto", "protoFile": "app.proto" } // 3. Native linking (assuming react-native >= 0.60): // iOS: pod install, then add RNGrpcService.xcodeproj to Libraries // Android: Manual steps as per README // 4. GrpcService.ts: import RNGrpcService from 'react-native-grpc-service'; const grpcService = new RNGrpcService('localhost:8080'); export default grpcService; // 5. App.tsx: import React, { useEffect } from 'react'; import grpcService from './GrpcService'; function App() { useEffect(() => { grpcService.TodoService.Create({ name: 'test' }).then(response => { console.log(response.data); }).catch(error => console.error(error)); }, []); return <View />; }
Debug
Known issues
gotchaRequires manual native setup; autolinking may not work for all RN versions.
fix
Follow manual installation steps for iOS and Android if link fails.
affects: >=0.1.0
breakingMin supported React Native version is 0.62.2.
fix
Upgrade react-native to 0.62.2 or higher.
affects: >=0.1.0
gotchaConfiguration file must be named 'react-native-grpc-service.json' and placed at project root.
fix
Ensure correct filename and location.
affects: >=0.1.0
deprecatedreact-native link is deprecated for RN 0.60+; use autolinking or manual pod install.
fix
Use pod install for iOS and manual Android steps.
affects: >=0.1.0
Errors
Common errors & fixes
Error: Cannot find module 'react-native-grpc-service'
Package not installed correctly or node_modules missing.
fix
Run 'npm install react-native-grpc-service' and ensure it's in dependencies.
RNGrpcService is not a constructor
Using default import incorrectly in CommonJS environment.
fix
Use 'import RNGrpcService from 'react-native-grpc-service'' or 'const RNGrpcService = require('react-native-grpc-service').default'.
Native module cannot be null
Native linking not completed correctly.
fix
Re-run 'react-native link' or manually link libraries per README.
Upgrade
Version history
0.1.17latest on npm
Audit
Dependencies
react-nativerequiredPeer dependency required for native module
Agent activity
16 hits · last 30 days
node
14
Amazon
1
OpenAI (training)
1
Resources
react-native-grpc-service — npm install react-native-grpc-service · libregistry