How to read text file from assets folder?

I’m trying to read a .txt file from assets folder, and first what I’m trying to do is get the URI of the file by doing this:
const [{ localUri }] = await Asset.loadAsync(require('../../../assets/text/sample.txt'));

When I try that, I get the error:
Unable to resolve module ../../../assets/text/sample.txt ... None of these file exist:

To make sure, I’m at the correct path, I added an image or font file inside the folder, and when I changed it to that, I don’t get the error and return the correct URI. What am I doing wrong?

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.