This is an example React Native application that demonstrates the usage of the @dittolive/ditto-react-native-tools library. This example app showcases all the diagnostic and debugging tools available for Ditto in React Native applications.
The @dittolive/ditto-react-native-tools library provides comprehensive diagnostic and debugging tools for Ditto in React Native applications, including:
- PeersList - Display and monitor Ditto peer connections in real-time
- DiskUsage - Monitor and display Ditto's disk usage breakdown with export functionality
- SystemSettings - Display all Ditto system settings using the
SHOW ALLDQL statement - QueryEditor - Execute DQL (Document Query Language) queries against your Ditto store
For more detailed information about the library, components, and features, see the main README.
This example app demonstrates all the tools available in the library:
- Home Screen - Navigation hub with access to all tools
- Peers List - Real-time monitoring of Ditto peer connections
- Disk Usage - Monitor Ditto's disk usage with export capabilities
- System Settings - View and search all Ditto system settings
- Query Editor - Execute DQL queries and view results
- Sync Status - Monitor Ditto synchronization status
- Permissions - Manage app permissions for Ditto functionality
Before running this example app, ensure you have:
- Ditto Setup - Follow the Ditto React Native Setup Guide
- Required Dependencies - The example app includes all necessary peer dependencies:
@dittolive/ditto(>=4.11.6)@dr.pogodin/react-native-fsreact-native-zip-archive
Note: Make sure you have completed the Set Up Your Environment guide before proceeding.
First, you will need to run Metro, the JavaScript build tool for React Native.
To start the Metro dev server, run the following command from the root of your React Native project:
./start.shOR
# Using npm
npm start
# OR using Yarn
yarn startWith Metro running, open a new terminal window/pane from the root of your React Native project, and use one of the following commands to build and run your Android or iOS app:
# Using npm
npm run android
# OR using Yarn
yarn androidFor iOS, remember to install CocoaPods dependencies (this only needs to be run on first clone or after updating native deps).
The first time you create a new project, run the Ruby bundler to install CocoaPods itself:
bundle installThen, and every time you update your native dependencies, run:
bundle exec pod installFor more information, please visit CocoaPods Getting Started guide.
# Using npm
npm run ios
# OR using Yarn
yarn iosIf everything is set up correctly, you should see your new app running in the Android Emulator, iOS Simulator, or your connected device.
This is one way to run your app — you can also build it directly from Android Studio or Xcode.
Now that you have successfully run the app, let's make changes!
Open App.tsx in your text editor of choice and make some changes. When you save, your app will automatically update and reflect these changes — this is powered by Fast Refresh.
When you want to forcefully reload, for example to reset the state of your app, you can perform a full reload:
- Android: Press the R key twice or select "Reload" from the Dev Menu, accessed via Ctrl + M (Windows/Linux) or Cmd ⌘ + M (macOS).
- iOS: Press R in iOS Simulator.
You've successfully run and modified your React Native App. 🥳
- If you want to add this new React Native code to an existing application, check out the Integration guide.
- If you're curious to learn more about React Native, check out the docs.
If you're having issues getting the above steps to work, see the Troubleshooting page.
To learn more about the tools and how to integrate them into your own app:
- Main Library README - Complete documentation of all components and features
- Ditto React Native Setup - Official Ditto setup guide for React Native
- Ditto Documentation - Complete Ditto SDK documentation
- React Native Website - Learn more about React Native development
To use these tools in your own React Native app:
- Install the library:
npm install @dittolive/ditto-react-native-tools - Import the components you need:
import { PeersList, DiskUsage } from '@dittolive/ditto-react-native-tools' - Pass your Ditto instance as a prop:
<PeersList ditto={yourDittoInstance} />
See the main README for detailed usage examples and component documentation.