Installation
Step 1: Download the SDK
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}
/>
);
}
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 with its own TypeScript definitions. If you're using TypeScript and still get errors, you usually do not need to add @types/react-native separately.
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