dev-resources.site
for different kinds of informations.
Read Text Asset File in Expo
Published at
1/14/2025
Categories
expo
reactnative
Author
somidad
Author
7 person written this
somidad
open
§ Install expo-asset
and expo-file-system
:
npx expo install expo-asset expo-file-system
§ Add expo-asset
plugin in app.config.js
(or in app.json
), if it has not been added by the previous step:
plugins: [
+ "expo-asset"
]
§ Install @expo/metro-config
:
npm install --save-dev @expo/metro-config
§ Create metro.config.js
:
const { getDefaultConfig } = require("expo/metro-config");
const config = getDefaultConfig(__dirname);
+config.resolver.assetExts.push("txt");
module.exports = config;
§ Create or put a text file under /assets
folder
§ Code:
async function readTextAsset() {
try {
const nodeRequire = require("@/assets/filename.txt");
const asset = Asset.fromModule(nodeRequire);
await asset.downloadAsync();
if (asset.localUri) {
const fileContents = await readAsStringAsync(asset.localUri);
// Do something with `fileContents`
}
} catch (error) {
console.error(error);
}
}
expo Article's
30 articles in total
Read Text Asset File in Expo
currently reading
Run Storybook with NX Expo and React Native Paper
read article
Explorando Notificações Push no React Native com Expo e OneSignal!
read article
Starting React Native Project in 2025
read article
Guia Completo: Como Integrar WatermelonDB no React Native 0.76 com Expo 52 e TypeScript
read article
How to create authenticated routes with the new Expo SDK 51 using Expo Router
read article
React Native Expo with NativeWind v4 and Typescript
read article
Translate & Guess: Build a Flag Quiz with Expo and Tolgee
read article
How i implemented my server login screen for Mastodon
read article
How to Change iOS Push Notifications Permission Dialog with Expo
read article
Exploring React Native Navigation with Expo: A Complete Guide
read article
How to Render OpenStreetMap in an Expo React Native Web App Using React Leaflet
read article
EAS build reads your .gitignore file
read article
#2 - Expo apk keeps on crashing after build
read article
Dear expo, who are you?
read article
npm i openai-react-native
read article
Expo51 Jotai Template + flashlist + tamagui
read article
Scroll-Responsive Animated Header Bar with Expo Router
read article
Expo vs. React Native: Pros, Cons, and Key Differences
read article
To Obfuscate or Not Obfuscate (React Native)
read article
How to disable keyboard suggestions for Android in React Native
read article
Expo51 Jotai Template, ready to use
read article
Let's get started with React Native + Expo
read article
Generar APK con EAS ⚛️ React Native
read article
How to publish your React Native app to Expo Store 2024
read article
Creating a WebView app in React Native using Expo
read article
Embracing Expo: The New Standard for Creating React Native Apps
read article
Automate Your Expo Builds with EAS Using GitHub Actions: A Step-by-Step Guide (Android)
read article
How to Generate APK Using React Native Expo
read article
Creating Chat Bubbles with curls in React Native (svg)
read article
Featured ones: