You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+28-1Lines changed: 28 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -54,9 +54,12 @@ server.start().then((url) => {
54
54
server.stop();
55
55
```
56
56
57
-
`StaticServer` serves from the document directory or takes an optional absolute path to serve from.
57
+
`StaticServer` serves from the document directory (default) or takes an optional absolute path to serve from.
58
+
58
59
For instance, using [react-native-fs](https://github.com/johanneslumpe/react-native-fs) you can get the document directory and specify a directory from there.
@@ -67,6 +70,30 @@ let path = RNFS.DocumentDirectoryPath + '/www';
67
70
let server =newStaticServer(0, path);
68
71
```
69
72
73
+
#### Custom folder (iOS)
74
+
75
+
##### Create the folder for static files
76
+
77
+
Create a folder in your project's top-level directory (usually next to your node_modules and index.js file), and put the files you want to access over http in there.
78
+
79
+
##### Add folder (static files) to XCode
80
+
81
+
This folder **must be added to XCode** so it gets bundled with the app.
82
+
83
+
In XCode, `Project Navigator` right click in the folder project → `Add files to "<project>"` → Select the static folder **and clic options (Uncheck copy items if needed, Create folder references)** so don't duplicate files → Clic Add.
84
+
85
+
When the app gets bundled, this folder will be next to the compiled app, so using `MainBundlePath` property from `react-native-fs` you can access to the directory.
0 commit comments