Open n8sabes opened 8 years ago
Indeed this boilerplate is a great start for a cordova app!
It makes now 7 months since this issue was opened, anyone news on it (doc link, PR, etc.) ?
@n8sabes thank you for sharing this!
Just a question about nested routes (eg. /user/profile/preferences), do they work with browserHistory?
With react-router v3 I had to put hash history in order to prevent few problems with nested routes (like a not found using window.reload()
) on cordova.
React Static Boilerplate is ideal for use with Cordova / PhoneGap. However, a few changes to the code must be made to support the platforms. It would be great to add cordova support by default, or a build option.
Here is how I got it to work:
1) Create RSB project
git clone -o react-static-boilerplate -b master --single-branch https://github.com/kriasoft/react-static-boilerplate.git MyRSBApp
npm install
2) Create Cordova project
cordova create MyCordovaApp com.domain.myrsbapp MyCordovaApp --link-to ./MyRSBApp/public
cordova platform add ios
3) Update RSB main.js to run RSB after receiving deviceready event.
4) Update RSB index.ejs
NOTE: Make sure add relevant cordova meta tags.
5) Run
From RSB project:
npm run build
From Cordova Project
cordova run ios
6) DEBUGGING: To debug iOS, add an alert() immediately after the html tag in the index.ejs file. When cordova launches and loads RSB, it will halt on the alert() providing time to attach the Safari debugger to the emulator or iOS device before continuing.
<script>alert("Attach Safari Debugger Now");</script>
7) TODO: All MDL, fonts, and other external files must be included within the project itself.
8) TODO: RSB receives an (file) path, not a url path. It needs to be further investigated, but as a temporary workaround (hack):