react native in instagram - stanford university · javascriptcore (the vm used by react native both...

11
REACT NATIVE IN INSTAGRAM Yixin Wan — Feb 6, 2018

Upload: others

Post on 30-May-2020

7 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: REACT NATIVE IN INSTAGRAM - Stanford University · JavaScriptCore (the VM used by React Native both on iOS and Android) and instantiate native modules and view managers. • Ended

REACT NATIVE IN INSTAGRAMYixin Wan — Feb 6, 2018

Page 2: REACT NATIVE IN INSTAGRAM - Stanford University · JavaScriptCore (the VM used by React Native both on iOS and Android) and instantiate native modules and view managers. • Ended

WHY REACT NATIVE?Developer velocity

• Developer velocity is a defining value of Instagram’s mobile engineering.

• React Native allowed product teams to ship features faster to both iOS and Android apps through code sharing and higher iteration speeds.

2https://engineering.instagram.com/react-native-at-instagram-dd828a9a90c7

Page 3: REACT NATIVE IN INSTAGRAM - Stanford University · JavaScriptCore (the VM used by React Native both on iOS and Android) and instantiate native modules and view managers. • Ended

PAYMENTS CHECKOUT FLOW

Highlights • 2 JS engineers finished the development in 4 month on both iOS

and Android • 98% iOS and Android code sharing

Page 4: REACT NATIVE IN INSTAGRAM - Stanford University · JavaScriptCore (the VM used by React Native both on iOS and Android) and instantiate native modules and view managers. • Ended

SHOPPING

4

thumbnail-based navigationCTA and header update collapsible description

AT&T 1:20 PM

glossierAT&T 1:20 PM

glossierAT&T 1:20 PM

glossier

Page 5: REACT NATIVE IN INSTAGRAM - Stanford University · JavaScriptCore (the VM used by React Native both on iOS and Android) and instantiate native modules and view managers. • Ended

NOTIFICATION SETTINGS

Highlights • Metrics neutral in # of notifications sent and crash rate • Looks much better than the old WebView • 92% iOS and Android code sharing

Page 6: REACT NATIVE IN INSTAGRAM - Stanford University · JavaScriptCore (the VM used by React Native both on iOS and Android) and instantiate native modules and view managers. • Ended

COMMENT MODERATION

Highlights • 85% iOS and Android Code sharing • Developed by a non-mobile developer with JS experience • Implemented in the span of one release cycle

Page 7: REACT NATIVE IN INSTAGRAM - Stanford University · JavaScriptCore (the VM used by React Native both on iOS and Android) and instantiate native modules and view managers. • Ended

LEAD GEN ADS

7

Highlights • 87% iOS and Android Code sharing • Same React Native code is used for both Facebook and Instagram

Page 8: REACT NATIVE IN INSTAGRAM - Stanford University · JavaScriptCore (the VM used by React Native both on iOS and Android) and instantiate native modules and view managers. • Ended

POST PROMOTE

Highlights • 99% Code sharing • Improved Time to Interact from ~7 seconds in original web view to

~3 seconds for React Native version • Positive +3.9% increase in ads creation

Page 9: REACT NATIVE IN INSTAGRAM - Stanford University · JavaScriptCore (the VM used by React Native both on iOS and Android) and instantiate native modules and view managers. • Ended

CHECKPOINTS

Highlights • 97% Code sharing

Page 10: REACT NATIVE IN INSTAGRAM - Stanford University · JavaScriptCore (the VM used by React Native both on iOS and Android) and instantiate native modules and view managers. • Ended

CHALLENGESAnd how to address them

• App Size and Android Methods Count

• Ended up selectively pulling in the parts needed and re-write other implementations, adding ~3500 methods and 1~2 MB size increase

• Start up overhead mostly caused by having to inject the JavaScript bundle into JavaScriptCore (the VM used by React Native both on iOS and Android) and instantiate native modules and view managers.

• Ended up leveraging ideas and infra already built by the React Native team, namely Random Access Module Bundling, Inline Requires, Native Parallel Fetching, and plenty more already integrated into the framework.

10https://engineering.instagram.com/react-native-at-instagram-dd828a9a90c7

Page 11: REACT NATIVE IN INSTAGRAM - Stanford University · JavaScriptCore (the VM used by React Native both on iOS and Android) and instantiate native modules and view managers. • Ended