Andrei Calazans

React Native Weekly - W43 2021

☕️ 3 min read

Welcome to the 31th edition of React Native Weekly!

This is week 43 of 2021: October 18th and 24th.

Fix enableVmCleanup not working for apps with product flavors

Nicola Corti ncor@fb.com noticed the Gradle enableVmCleanup function wasn’t cleaning up the extra .so files for apps with variants like name-staging for instance. This commit fixes this.

Besides this work, Nicola Corti ncor@fb.com also contributed with a few other commits (1) (2) (3) (4) (5) where he organizes the Gradle tasks into isolated tasks.

Strict Static View Config Validator

In this commit, Tim Yung yungsters@fb.com created a new StaticViewConfigValidator module that validates the difference between the static and native view configs. I don’t fully understand how static and native view configs are different but it seems the view configs are used to establish the native component counterpart from the configs.

If you understand how this is tied in with the architecture shoot me a DM. I would guess the static configs are generated from TurboModules but I’m uncertain.

Fix onPress event for nested Text [Android]

Commit

When the user tapped the “Inner” text, Android is dispatching three events: topTouchStart, topTouchStart and topTouchEnd.

David Vacca dvacca@fb.com identified that the information stored on the first two JS events is correct, but the problem is that it is duplicated.

Disabled RTTI on Android by Default

Commit

Load JSC or Hermes lib in static method

Tuomas Jaakola tuomas.jaakola@iki.fi introduced a change to make it clearer when a error happens while loading JSC or Hermes, previously the stack-trace was pointing to the wrong place.

Deprecate Prop Types

With this commit, Tim Yung yungsters@fb.com added a warning to every React Native component PropType to let you know it has been deprecated.

More Android Permissions

This commit added a few more dangerous permissions to PermissionsAndroid.

+  | 'android.permission.ACCESS_MEDIA_LOCATION'
+  | 'android.permission.ACCEPT_HANDOVER'
+  | 'android.permission.ACTIVITY_RECOGNITION'
+  | 'android.permission.ANSWER_PHONE_CALLS'
+  | 'android.permission.READ_PHONE_NUMBERS'
+  | 'android.permission.UWB_RANGING';

Community

Updates from the community:

React Native Native Runtime

Jamie Birch implemented a module that gives you access the iOs’ runtime APIs in JavaScript. The initial implementation is only for iOS but the README points out they are planning for Android.

NativeScript essentially does the same thing, but it has never been ported to work with React Native. I see this possibly being very useful for implementing native modules.

ua-parser-js compromise

The library, called UAParser.js, was compromised with a cryptominer

Here is how you can verify your local machine doesn’t have the wrong UAParser.js installed

Flickering input bug

Someone pointed out a React Native bug on Shopify’s app which exposes a problem of the KeyboardAvoidingView. As you can see in the video the UI flickers when the keyboard suggest the email. If someone has time to work on this we could probably capture this issue and fix it.

React Native Deps Check

Eli White pointed out a tool by Microsoft that helped him upgrade an app from 0.63 to 0.66. It checks if your dependencies are compatible with a specific React Native version:

Run this to check your dependencies are compatible with 0.66 for example

yarn rnx-dep-check --vigilant 0.64

Upcoming Expo Module API AKA Sweet API

Blogpost by Tomasz Sapeta.

Expo in collaboration with Software Mansion is attempting to simplify how we write native modules in React Native. They identified how dificult and low level it is to write native modules in Objective-C and Java. Tomasz’s post goes over the “Sweet API” which allows you to use Swift to write native modules in a very declarative way.

In Expo SDK 43 there are already four modules using this API — expo-cellularexpo-hapticsexpo-tracking-transparency and expo-linear-gradient.

Their next goal is to have a similar API with Kotlin.

Done

That’s it for this week. If you want to see more checkout the previous week’s posts here. Subscribe to get notified when new posts are out = )