react-native init SpecApp
cd SpecApp
react-native run-ios
react-native run-android
react-native log-ios
react-native log-android
iOS Log When not working with log-ios option
log stream --predicate '(processImagePath contains "yourAppName") and senderImageUUID == processImageUUID'
or Use script node.js, needs
npm install moment
iOS
- Cmd + R to reload
- Cmd + D to Dev Menu
Android
- Double Tab R to reload
- Cmd + M to Dev Menu
- Use Chrome http://localhost:8081/debugger-ui/
https://github.com/facebook/react-devtools/tree/master/packages/react-devtools
npm install -g react-devtools
react-devtools
By default DevTools listen to port 8097 on localhost.
If not running on Simulator, you may do this, not tested
adb reverse tcp:8097 tcp:8097
Resize Use Emulator Edge to increase size
Add Extension 'React Native Tools'
The files related to vscode stored in .vscode/.react, ignore in .gitignore
https://github.com/oblador/react-native-vector-icons
npm install react-native-vector-icons
react-native link
import Icon from 'react-native-vector-icons/FontAwesome';
const myButton = (
<Icon.Button name="facebook" backgroundColor="#3b5998" onPress={this.loginWithFacebook}>
Login with Facebook
</Icon.Button>
);
const customTextButton = (
<Icon.Button name="facebook" backgroundColor="#3b5998">
<Text style={{fontFamily: 'Arial', fontSize: 15}}>Login with Facebook</Text>
</Icon.Button>
);
No Specific Permission Needed
npm install react-native-fs
react-native link react-native-fs
Android, Just use it
iOS, Need to Link RCTCameraRoll to Project https://facebook.github.io/react-native/docs/linking-libraries-ios
Ensure adding libRCTCameraRoll.a to Main PRoject, 'Build Phases' => 'Link Libraries' section
iOS need permissions
<key>NSPhotoLibraryUsageDescription</key>
<string>Camera Roll Preview </string>
for iOS 11.0, add also
<key>NSPhotoLibraryAddUsageDescription</key>
<string>Demo purpose</string>
A faster fetch library, for downloading images and large files https://github.com/joltup/rn-fetch-blob
npm install rn-fetch-blob
react-native link
Needs Android Permission for sd card write and read Add to AndroidManifest.xml
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.DOWNLOAD_WITHOUT_NOTIFICATION" />
npm install react-native-camera
react-native link react-native-camera
Android.manifest file permission
<uses-permission android:name="android.permission.RECORD_AUDIO"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
ios pInfo
<key>NSCameraUsageDescription</key>
<string>Your message to user when the camera is accessed for the first time</string>
<!-- Include this only if you are planning to use the camera roll -->
<key>NSPhotoLibraryUsageDescription</key>
<string>Your message to user when the photo library is accessed for the first time</string>
<!-- Include this only if you are planning to use the microphone for video recording -->
<key>NSMicrophoneUsageDescription</key>
<string>Your message to user when the microphone is accessed for the first time</string>
iOS 11
<!-- Include this only if you are planning to use the camera roll -->
<key>NSPhotoLibraryAddUsageDescription</key>
<string>Your message to user when the photo library is accessed for the first time</string>