I make ios, android apps with react-native.
I'm looking for method that I can plant some file in project before I build the app, and access it after it would be run.
I know some modules like "RNFetchBlob" or "react-native-fs". so I can create, read and write some files
but I've no any idea with put it in app before it would be built.
How can I put a file in before the app would be run? Can I get some clues or sample code about this?
I got an answer myself. so I share it.
it's the solution for ios
run xcode >
open your project ([react-native project]/[ios]) >
right click on project that you can see at top of left side. >
select "Add Files to "[your project name]"
then choose files or directory that you wanna plant in app. >
check "Copy items if needed" >
click Add button
then you can see it included at left side window
you can access attached file path in your ios app via RNFetchBlob FileSystem
install that module to your react-native project like following command
$ yarn add rn-fetch-blob
then you can access the file like below code.
import RNFetchBlob from 'rn-fetch-blob';
const attachedFile = `${RNFetchBlob.fs.dirs.MainBundleDir}/androidVoiceRecord.m4a` ;