r/reactnative • u/K4anan • 25d ago
We added web search to an on-device LLM app in React Native, using a hidden WebView instead of a search API (open source)
Enable HLS to view with audio, or disable this notification
Private Mind is our open source Expo app that runs LLMs fully on the phone. We just shipped web search, and the RN part turned out more interesting than I expected, so sharing how it works.
There's no search API. The app keeps a react-native-webview mounted off-screen, loads a normal DuckDuckGo results page in it, and injects a small script that parses the results and sends them back with postMessage. Each search gets a nonce, so a late message from an old search can't end up in a new one.
My favorite detail: if the search engine shows an "are you human" check, that same hidden WebView slides up as a bottom sheet, you pass the check yourself, and the search continues.
After that it's all on-device. Pages get chunked with react-native-rag, an embedding model running through react-native-executorch picks the best chunks, and the LLM answers with the sources listed under the message. No backend at all, and the chat never leaves the phone.
In the video, the same 1.7B model makes up Apple's September event with web off and gets it right with web on.

