React Native is the new kid in town. So what is it, what problems does it solve and “do I need to know native to work with it” are a some of the questions to be answered.
5. #RNISAWESOME
NATIVE APPS ? REALLY ??
▸ Faster
▸ Responsive
▸ Complex gestures
▸ Mobile functionalities usage
▸ Different market for users
but how to stay up with the scale etc?
7. #RNISAWESOME
REACT AND REACT NATIVE
ReactJS is a JavaScript library where you can use it to build user
interfaces for the web either standalone or being served from a
server.
What you will need?
‣ A bundler - Webpack setup
‣ Testing environment
‣ jest maybe
‣ enzyme maybe
‣ …etc
8. #RNISAWESOME
REACT AND REACT NATIVE
React Native is a mobile framework that uses ReactJS and compiles
to native app components.
This way it allowing you to build native mobile applications for
different platforms (iOS, Android, and Windows Mobile) in
JavaScript. In order to do so you will may need Xcode or Android
Studio
It comes out of the box with:
‣ packager (bundler) called metro
‣ jest environment for testing
‣ flow for typing
19. #RNISAWESOME
DAILY TOOLS
This is the regular hot reload of react, on every change you can
see the changes on your simulator
HOT RELOADING
Reloads the app on every change
LIVE RELOAD
DEBUGGING - PERFORMANCE
Enables the debugging inspector
REMOTE JS DEBUGGING
Shows the frames per screen in order to see which screens
underperform
SHOW PERF MONITOR
20. #RNISAWESOME
DAILY TOOLS
RN debugging tools
‣ react-devtools (npm)
‣ react-native debugger (redux)
de-
‣ Inspect network requests like in web
‣ Redux inspect for state
‣ React profiling
21. #RNISAWESOME
REACT NATIVE CHALLENGES
Not very stable modules, event official ones (react-navigation)
iOS / android behave differently in some cases
Although is react doesn’t behave like a web app
Need to understand native renders differently
Keep in mind of performance when dealing with lists
Dealing with emulators vs physical devices
Error logging for production is often difficult to debug
22. #RNISAWESOME
REACT NATIVE PROS & CONS
✓ Hot reloading
✓ Multiple platforms
✓ Faster build for smaller apps
✓ On the fly JS Bundle
✓ Bigger pool of devs
- Lack of modules
- Native developers still needed
- Immaturity on tools
27. #RNISAWESOME
public class MainApplication extends Application implements ReactApplication {
private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {
@Override
public boolean getUseDeveloperSupport() {
return BuildConfig.DEBUG;
}
@Override
protected List<ReactPackage> getPackages() {
return Arrays.<ReactPackage>asList(
new MainReactPackage(),
new MeetupPackage()
);
}
};
@Override
public ReactNativeHost getReactNativeHost() {
return mReactNativeHost;
}
}
28. #RNISAWESOME
public class JSMeetupPackage implements ReactPackage {
@Override
public List<NativeModule> createNativeModules(ReactApplicationContext reactContext) {
List<NativeModule> modules = new ArrayList<>();
modules.add(new JSMeetupModule(reactContext));
return modules;
}
@Override
public List<ViewManager> createViewManagers(ReactApplicationContext reactContext) {
List<ViewManager> modules = new ArrayList<>();
modules.add(new JSMeetupViewManager(reactContext));
return modules; // if we have a view else return Collections.emptyList();
}
}
29. #RNISAWESOME
class JSMeetupModule extends ReactContextBaseJavaModule {
private static String mPremium = "";
public JSMeetupModule(ReactApplicationContext reactContext) {
super(reactContext);
...
}
@Override
public String getName() {
return "JSMeetup";
}
@ReactMethod
public void setPremium(String premium) {
mPremium = premium;
}
}
37. #RNISAWESOME
Expo is the easiest way to start building a new React Native
application. It allows to start a project without installing or
configuring any tools to build native code
39. #RNISAWESOME
▸ Will I need access to the Native portion of the codebase?
▸ Will I need any third party packages in my app that are not
supported by Expo?
▸ Will my app need to play audio while it is not in the foreground?
▸ Will my app need location services while it is not in the
foreground?
▸ Will I need push notification support?
▸ Am I comfortable working in Xcode and Android Studio?
41. #RNISAWESOME
▸ Ionic
▸ Run on a “webview” with cordova - performance issues
▸ Write once run everywhere
▸ Mimic the platform’s widgets to make your application look native
▸ Angular (lately you can write with VUE as well)
▸ Xamarin
▸ a complete set of tools (diagnostics, debugging)
▸ Just in time & Ahead of time compilation = faster application
startup
▸ You need to write on C#