'how to add asset files to a React Native iOS project

I am currently working on getting a react-native project that is running on Android to work on iOS. The following code uses react-native-blob-util to load files from the following folder android/app/src/main/assets/. So if the function is called with path "/app.js" it will read the file at android/app/src/main/assets/webview/app.js

async function buildLocalAssetResponse(path: string): Promise<Buffer> {
  let headers = 'HTTP/1.1 ';
  const bundlePath = `webview${path}`;
  let data = '';
  console.log(bundlePath)

  try {
    data = await ReactNativeBlobUtil.fs.readFile(
      ReactNativeBlobUtil.fs.asset(bundlePath),
      'base64',
    );

I am trying to figure out how to get this working on iOS exactly, I believe I have to copy the relevant files into an ios assets folder so ReactNativeBlobUtil.fs.asset can find them but I am not sure how to create that folder.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source