Complete solution (100% reference)
index.html- Main HTML pagescript.js- JavaScript logicstyles.css- Styling and layoutpackage.json- Dependenciessetup.sh- Setup scriptREADME.md- Instructions (below)๐ก Download the ZIP, extract it, and follow the instructions below to get started!
Learn to add tactile feedback to your apps with haptics and vibration patterns.
# 1. Install dependencies
npm install --legacy-peer-deps
# 2. Start Expo
npx expo start
# 3. Scan QR code with Expo Go app
This is a complete demo app with no TODOs. Explore the code to understand:
Try each haptic type:
activity-17-haptic-helper/
โโโ App.js # Complete haptic demo (100%)
โโโ package.json # Dependencies with expo-haptics
โโโ README.md # This file
After exploring this app, you'll understand:
Three Haptic Types:
When to Use Haptics:
UX Design Principles:
Try these experiments:
Test One: Intensity Comparison
Test 2: Contextual Feedback
Test 3: Rapid Selection
Want to experiment? Try these modifications:
Create a vibration strength slider:
const [intensity, setIntensity] = useState(50);
const triggerCustom = () => {
if (intensity < 33) {
Haptics.impactAsync(Haptics.ImpactFeedbackStyle.Light);
} else if (intensity < 66) {
Haptics.impactAsync(Haptics.ImpactFeedbackStyle.Medium);
} else {
Haptics.impactAsync(Haptics.ImpactFeedbackStyle.Heavy);
}
};
Build a simple reaction game:
Create a Morse code vibration app:
Haptics not working on iOS Simulator:
No vibration on Android:
App crashes on launch:
npx expo start --clear
Add haptics when:
Add haptics when:
Consider haptics for:
When complete:
Tech Stack: React 18.3.1 | React Native 0.76.1 | Expo SDK ~53.0.0 | expo-haptics ~14.0.0