Installation
Step 1: Download the SDK
The SDK is distributed as a downloaded package. It is not published on npm.
Step 2: Install the SDK
2.1 Add the SDK package
Place the downloaded SDK file in your project's root directory.
2.2 Install the package
npm install ./govotr-vote-react-native-1.0.0.tgz --legacy-peer-deps
2.3 Import the component
import { VoteNowButton } from "@govotr/vote-react-native";
2.4 Test the installation
Create a test component to verify the install:
import React from "react";
import { VoteNowButton } from "@govotr/vote-react-native";
import { StyleSheet } from "react-native";
export default function TestComponent() {
const styles = StyleSheet.create({
button: {
backgroundColor: "#5263FF",
borderRadius: 12,
alignItems: "center",
},
buttonText: {
color: "white",
fontSize: 18,
fontWeight: "bold",
},
});
return (
<VoteNowButton
URL=""
label="Test Button"
buttonStyle={styles.button}
textStyle={styles.buttonText}
isLoading={false}
/>
);
}
This only confirms the package installs and compiles. With an empty URL the button renders but does nothing. The voting flow runs once you pass a real voting URL from the Voting endpoint.
Troubleshooting Installation
"Module not found" error after SDK installation
# Clear npm cache and reinstall
npm cache clean --force
rm -rf node_modules package-lock.json
npm install
# Reinstall the React Native SDK:
npm install ./govotr-vote-react-native-1.0.0.tgz --legacy-peer-deps
Peer dependency warnings
The --legacy-peer-deps flag is required for this package. This is normal and expected.
TypeScript errors
The SDK ships its own type definitions, which reference types from react and react-native. React Native 0.71 and later bundles its own types, so do not install @types/react-native. The only type package you need is @types/react, which every TypeScript React Native project already has.
Next Steps
Once the SDK is installed:
- Set up OAuth authentication
- Generate voting URLs
- Use the
VoteNowButtoncomponent (props reference: SDK Props)
Next: API Integration Overview