Skip to main content

Building an AI-Powered React Native Quiz App: Meet Imo Quiz

๐ŸŽ“ Building an AI-Powered Quiz App with React Native: Introducing Imo Quiz

๐Ÿš€ Introduction

Education is changing, and our methods of learning and testing should too. As a passionate developer in the UK, I wanted to merge my passion for clean user experiences with meaningful functionality to create something exciting: Imo Quiz. This AI-powered React Native quiz app not only tests your knowledge but also adapts to your learning style.

In Yoruba, "Imo" means "knowledge," reflecting the app's focus on enhancing learning through personalized quizzes.

In this post, Iโ€™ll walk you through how I built Imo Quiz: a smart educational app that adjusts question difficulty based on your performance, offers real-time AI-style feedback, and stores your scores using Firebase.


๐Ÿช„ Tech Stack

  • React Native (TypeScript) โ€” for building cross-platform UI

  • Expo Go โ€” for seamless testing on iOS and Android

  • Firebase (Firestore) โ€” to store user scores and usernames

  • Open Trivia DB API โ€” for real quiz questions with difficulty levels

  • AsyncStorage โ€” for temporary session management (future use)


๐Ÿ”ง Features

  • โœจ Adaptive difficulty logic: Easy โ†’ Medium โ†’ Hard, based on correct streaks

  • ๐Ÿค– AI assistant gives tips and contextual guidance

  • ๐ŸŽ‰ Smooth UI with gradient backgrounds and animations

  • ๐Ÿ“Š Real-time score storage with Firebase

  • โœ‰๏ธ No sign-up required; just enter your username and go!


๐Ÿ“ Project Structure

imo-quiz-app/
  โ”œโ”€โ”€ assets/
  โ”œโ”€โ”€ src/
  โ”‚   โ”œโ”€โ”€ api/
  โ”‚   โ”œโ”€โ”€ components/
  โ”‚   โ”œโ”€โ”€ constants/
  โ”‚   โ”‚   โ””โ”€โ”€ tips.ts
  โ”‚   โ”œโ”€โ”€ screens/
  โ”‚   โ”œโ”€โ”€ types/
  โ””โ”€โ”€ App.tsx, app.json, etc.

๐Ÿชก Adaptive Difficulty Logic

We track the user's correct streak and update difficulty accordingly:

if (correctStreak >= 3) setDifficulty('hard');
else if (correctStreak === 0) setDifficulty('easy');
else setDifficulty('medium');

Then we fetch new questions with:

https://opentdb.com/api.php?amount=10&difficulty=${difficulty}&type=multiple

This ensures that the app is neither too easy nor too hard for any user.


๐Ÿง‘โ€๐Ÿ’ป Firebase Integration

Each user's best score is stored by username. We check if theyโ€™ve played before:

const docSnap = await getDoc(scoreRef);
if (docSnap.exists() && score > docSnap.data().score) {
  await setDoc(scoreRef, { score });
}

This makes it easy to display personal bests and leaderboard logic (coming soon).


๐Ÿš€ AI Assistant Tips

All assistant text is stored in a reusable tips.ts file:

export const tips = {
  welcome: "Welcome, [username]! Ready to test your brain?",
  start: "Click an option to begin. Let's go!",
  correct: "Nice one! You're on a roll.",
  wrong: "Oops! That was tough. Try the next one.",
  result: "Well done! Want to try again?",
};

Then we inject them throughout the UI:

<Text>{tips.welcome.replace('[username]', username)}</Text>

๐ŸŽจ Home Screen Design

  • Animated AI assistant icon (in assets/assistant.png)

  • ImageBackground with a semi-transparent overlay

  • Clean input and big, bold call-to-action button

<ImageBackground source={require('../../assets/assistant.png')}>
  <Text>Welcome to Imo Quiz</Text>
  <Text>{tips.welcome.replace('[username]', username)}</Text>
</ImageBackground>

๐Ÿšฎ Challenges Faced

  • TypeScript prop typing with React Navigation

  • Firebase async logic and preventing score overwrite

  • Adaptive difficulty UI flow

  • Making the app look polished but still fast


๐Ÿ“† What's Next?

  • Add leaderboard view

  • Add Firebase Auth for secure sign-in

  • Add voice-over or text-to-speech assistant

  • Track question-level performance

  • Add category filters