A fully functional number guessing game built with React Native and Expo, designed to demonstrate core React Native concepts including state management, component-based architecture, conditional rendering, and dynamic list handling with FlatList.
- Number guessing game: Player picks a number, the device guesses it.
- Round tracking: Logs all guesses with round numbers.
- Game reset: Start a new game anytime.
- Custom components: Reusable UI elements like buttons, cards, and log items.
- Responsive UI: Scrollable list for guesses, works across devices.
- Styling & layout: Flexbox, shadows, and themed colors.
- React Native – Core mobile framework
- Expo – Simplified React Native workflow
- JavaScript / JSX – Logic and UI structure
- React Hooks –
useState,useEffectfor state and side effects - FlatList – Efficient list rendering
- Clone the repository:
git clone https://github.com/khalil-js/react-native-guess-game.git
cd react-native-guess-game- Install dependencies:
npm install
# or
yarn install- Start the app with Expo:
expo start- Open on your device or simulator:
- Android: Expo Go app or emulator
- iOS: Expo Go app or simulator
-
Game Flow:
- Player selects a number
- Device guesses numbers until correct
- Each guess is logged and displayed
- Game Over screen shows the number of rounds
-
Components:
StartGameScreen– Select the number to startGameScreen– Device guesses and logs roundsGameOverScreen– Displays results and restart buttonGuessLogItem– Styled log entries for each guess
-
State Management:
useState→ Track current guess, rounds, user numberuseEffect→ Reset min/max boundaries when a new game starts- Data flows from child → parent via callback props
- Building custom components from core React Native components
- Conditional rendering for screen navigation
- Using
FlatListfor optimized list rendering - Styling with Flexbox, shadows, and theme colors
- Managing state and side effects with React Hooks
- Passing data between components (parent ↔ child)
/TargetApp
├─ /components # Reusable UI and game-specific components
├─ /constants # Colors, styles, constants
├─ App.js # Main app entry
├─ package.json
├─ README.md
- Add animations for guesses
- Make app fully responsive for landscape mode
- Extract more reusable components and style merging
- Add sound effects or haptics for interaction
- Save high scores locally or with AsyncStorage
Khalil – GitHub Profile
Do you want me to do that next?