@truconsent/consent-notice-react-native
v0.1.2
Published
React Native SDK for TruConsent consent banner
Readme
@truconsent/consent-notice-react-native
React Native SDK for TruConsent consent banner. This package provides native mobile UI components for displaying and managing consent banners in React Native applications.
📚 Documentation
👉 Complete Integration Guide - Step-by-step guide with real-world examples from the Mars Money React Native app.
The integration guide includes:
- Detailed installation instructions
- Configuration setup (Expo & React Native CLI)
- Consent Modal integration with hook consistency patterns
- Rights Center implementation
- Complete code examples
- Troubleshooting guide (including React Native-specific issues)
- Best practices
Installation
npm install @truconsent/consent-notice-react-native
# or
yarn add @truconsent/consent-notice-react-nativePeer Dependencies
This package requires the following peer dependencies:
react>= 18.0.0react-native>= 0.70.0react-i18next>= 16.2.3i18next>= 25.6.0
Usage
import { TruConsentModal } from '@truconsent/consent-notice-react-native';
function App() {
return (
<TruConsentModal
apiKey="your-api-key"
organizationId="your-org-id"
bannerId="your-banner-id"
userId="user-id"
onClose={(action) => console.log('Consent action:', action)}
/>
);
}API
TruConsentModal
Main component for displaying the consent banner modal.
Props
apiKey(string, required): API key for authenticationorganizationId(string, required): Organization IDbannerId(string, required): Banner/Collection Point IDuserId(string, required): User ID for consent trackingapiUrl(string, optional): TruAPI root URL (e.g.https://api-dev.truconsent.io)logoUrl(string, optional): Company logo URLcompanyName(string, optional): Company nameonClose(function, optional): Callback when modal closes
License
MIT
