After generating the initial app (using ‘react-native init’) and trying to run it.
- “Missing Iconions” icon error. It turns out I was missing a ‘linking’ step. Although I had added the icons using npm, they still needed to be linked to the native project, in this case the Xcode project file. ‘react-native link’ does the trick.
- “Could not load app due to a missing require()”. Weird error! A quick search suggested that there is a name mismatch. Once you generate the app, you cannot change the name that gets registered with the AppRegistry.
- Changing the name back did not fix the issue. I got another strange error but this time React gave me three suggestions to fix it. Apparently there is some caching of app content going on that needs to be cleaned up, either by deleting the npm_modules folder and clearing npm cache or simply by killing the packager process and restarting it. This error occurred a few times since then and every time killing the packager solved it.
- The ‘List’ component skipped the first item. No matter how many items are included in the model, it always skipped the first one when rendering. It turns out that the List component has to be wrapped in a ScrollView.
- I was not able to mix usage of Native Base ‘ListItem’ with React Native TouchableHighlight to produce a selectable list item that shows a visual queue when tapped. It turns out that there is already a ‘button’ property that can be set on the ‘List Item’ to produce such a visual effect. It is not perfect, but it is OK for a toy app.
- I attempted to add some navigation using NavigatorIOS. At first, it did not show any content I added to it. As I found out, some styles must be set on the navigator in order for it to work. Most notably, you have to use the {{flex:1}} style.
- Specifying property types using PropTypes is neat. Just avoid the pitfall: PropTypes.something.isRequired is correct, whereas PropTypes.something.required produces mysterious error messages!
- Also be careful when passing functions as properties. I mistakenly passed one of the properties as {someFunc(someParams)} instead of just {someFunc} which, of course, lead to invoking the function rather than passing a callback.