Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
React Native JSI ソースコードリーディング / React Native JS...
Search
Shoken Fujisaki
October 02, 2021
0
1.3k
React Native JSI ソースコードリーディング / React Native JSI source code reading
React Native Matsuri 2021で発表したスライドです。
https://reactnative-matsuri.com/ja
Shoken Fujisaki
October 02, 2021
Tweet
Share
More Decks by Shoken Fujisaki
See All by Shoken Fujisaki
KitchHike式 React Native 設計チェックポイント / React Native App Design in KitchHike
shoken
0
2k
React Nativeコンポーネントを 公開してわかった3つのこと / React Native Component Library npm published
shoken
0
1.5k
React Native for macOS
shoken
1
1.7k
React Native の E2E テストフレームワーク Detoxの紹介 / React Native E2E Test Detox
shoken
0
2.9k
広告計測してと言われた時にReact Nativeエンジニアが詠む資料 / React Native with AppsFlyer and Firebase Analytics
shoken
3
1.9k
デザイナーからのラブレター デザイナーが本音で話すエンジニアとの新しいカンケイ
shoken
0
1.1k
MongoDB CTO パネルディスカッション / MongoDB CTO panel discussion 2014
shoken
0
760
Featured
See All Featured
Measuring & Analyzing Core Web Vitals
bluesmoon
4
130
BBQ
matthewcrist
85
9.3k
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
6
430
Navigating Team Friction
lara
183
14k
Fashionably flexible responsive web design (full day workshop)
malarkey
405
65k
Keith and Marios Guide to Fast Websites
keithpitt
409
22k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
27
4.3k
Embracing the Ebb and Flow
colly
84
4.5k
Adopting Sorbet at Scale
ufuk
73
9.1k
Stop Working from a Prison Cell
hatefulcrawdad
267
20k
Build your cross-platform service in a week with App Engine
jlugia
229
18k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
31
2.7k
Transcript
3FBDU/BUJWF.BUTVSJ-5 3FBDU/BUJWF +4*ιʔείʔυϦʔσ Οϯά 4IPLFO'VKJTBLJ
ࣗݾհ w 4IPLFO'VKJTBLJ !TIPLFOY w גࣜձࣾΩονϋΠΫ ڞಉۀऀ$50 w
ڞஶ3FBDU/BUJWFʹࢧ͑Β͑Δاۀ w ΩονϋΠΫΤϯδχΞνʔϜͰ ݄ץ3/'FBUVSFT࿈ࡌத IUUQTUFDILJUDIIJLFDPN
ࠓճ+4*ʹͨ͠ ίʔυϦʔσ ΟϯάͰ͢
ΞδΣϯμ 3FBSDIJUFDUVSFͱ+4* +4*ͷιʔείʔυΛಡΉ +4*.PEVMFͷιʔείʔυΛಡΉ
ΞδΣϯμ 3FBSDIJUFDUVSFͱ+4* +4*ؔ࿈ͷιʔείʔυΛಡΉ +4*ΛͬͨϥΠϒϥϦΛಡΉ
#SJEHF $ 4IBEPX5ISFBE :PHB /BUJWF.PEVMFT +BWB0CK$ +4#VOEMF +BWB4DSJQU
+4$ +40/ +40/ ඇಉظΩϡʔ 6*5ISFBE +45ISFBE /BUJWF6* +BWB0CK$ 3FBSDIJUFDUVSFҎલ #SJEHF
#SJEHF $ 4IBEPX5ISFBE :PHB /BUJWF.PEVMFT +BWB0CK$ +4#VOEMF +BWB4DSJQU
+4$ +40/ +40/ ඇಉظΩϡʔ 6*5ISFBE +45ISFBE #SJEHFҰͭͳͷͰϘτϧ ωοΫʹͳΓ͍͢ ඇಉظͰॲཧ͢ΔͨΊɺىಈ࣌ ʹશͯಡΈࠐΉඞཁ͕͋Δ ૄ݁߹ͳඇಉظॲཧͰྑͦ͞͏͕ͩ τϨʔυΦϑ ඇಉظͷͨΊɺύϑΥʔϚϯε ʹͳΔՄೳੑ /BUJWF6* +BWB0CK$ ϨϯμϦϯάߋ৽ʹ#SJEHFɾ +45ISFBEͷ௨՟͕ඞཁ
+4#VOEMF +BWB4DSJQU +45ISFBE 3FBSDIJUFDUVSFҎ߱ /FX"SDIJUFDUVSFͱ+4* +4* +47. 0CKFDUJWF$ +BWB+/*
$
+4#VOEMF +BWB4DSJQU +45ISFBE 3FBSDIJUFDUVSFҎ߱ /FX"SDIJUFDUVSFͱ+4* +4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·ͰಡΜͩίʔυ KTJ3VOUJNFΦϒδΣΫτ +4*&YFDVUPS +4*/BUJWF.PEVMFT )FSNFT +4$ )FSNFT&YFDVUPS'BDUPSZ +4$&YFDVUPS'BDUPSZ 3$5+4*&YFDVUPS3VOUJNF*OTUBMMFS KTJDQQ +4*%ZOBNJDDQQ SVOUJNFHMPCBM TFU1SPQFSUZ SVOUJNFHMPCBM HFU1SPQFSUZ
ίϥϜTFU5JNFPVUͷ࣮
SFBDUOBUJWF-JCSBSJFT$PSF5JNFST +45JNFSTKT /BUJWF5JNJOHͱ
SFBDUOBUJWF-JCSBSJFT$PSF5JNFST /BUJWF5JNJOHKT 5SVCP.PEVMFʂ
SFBDUOBUJWF3FBDU$PSF.PEVMFT 3$55JNJOHNN TFU5JNFPVUͰΘΕΔDSFBUF5JNFSͷ J04ωΠςΟϒ࣮
TFU5JNFPVU5VSCP.PEVMFԽࡁΈ
ΞδΣϯμ 3FBSDIJUFDUVSFͱ+4* +4*ͷιʔείʔυΛಡΉ +4*.PEVMFͷιʔείʔυΛಡΉ
DSBGU[EPH͞ΜͷSFBDUOBUJWFRVJDLCBTF ͷίʔυΛಡΉ IUUQTHJUIVCDPNDSBGU[EPHSFBDUOBUJWFRVJDLCBTF
IUUQTUFDILJUDIIJLFDPNFOUSZSFBDUOBUJWFGFBUVSFT •React NativeͷύϑΥʔϚϯεͱɺNULLจࣈΛؚΉόΠφϦจࣈྻΛॲཧͰ͖ͳ͍՝ •base64 ͰΤϯίʔυ͞Εͨը૾σʔλΛJS ͔ΒReact Native ϒϦοδΛհͯ͠WebView ʹ͢ͷ Ͱ͕͔͔࣌ؒΔ
•C++ ͰJSI ωΠςΟϒϞδϡʔϧΛ࡞ͨ͠ •JSI Λ༻͢Δ͜ͱʹΑΓɺJavaScript C++ ϗετΦϒδΣΫτͷࢀরΛอ࣋͠ɺϝιουΛݺ ͼग़͢͜ͱ͕Ͱ͖Δɻ͜ΕʹΑΓɺઌʹड़ͨNULLจࣈͷΛ࠷ऴతʹճආͰ͖ͨɻ
͜ͷลΓͷίʔυΛಡΉ
DQQCBTFI CBTF@FODPEFCBTF@EFDPEFͳͲͷ ͕ؔએݴ͞Ε͍ͯΔɻ࣮CBTFDQQ
DQQSFBDUOBUJWFRVJDLCBTFDQQ ࣮ࡍͷ+4*όΠϯσΟϯάॲཧɻ +BWB4DSJQU͢ΛKTJ7BMVFͱͯ͠࡞ JOTUBMM#BTFؔͷ࣮ +BWB4DSJQUͷάϩʔόϧ +BWB4DSJQUͰ͑ΔϓϩύςΟʢؔʣ
JPT2VJDL#BTFNN +4*όΠϯσΟϯάެ։༻ʹ 3FBDU3$5#SJEHF 1SJWBUFϔομʔϑΝΠϧΛΠϯϙʔτ DYY#SJEHFSVOUJNFͷࢀরΛऔಘɻ $ ίʔυͰૢ࡞༻ͷ+BWB4DSJQU7BMVFTΛ ࡞͢ΔͨΊʹඞཁͳSVOUJNFΦϒδΣΫτ SVOUJNFΛJOTUBMM#BTFؔʹ͠
ͯɺ+4*όΠϯσΟϯάΛ࡞
JOEFYUTͰؔόΠϯσΟϯάΛએݴ DQQͰKTJ3VOUJNFHMPCBM TFU1SPQFSUZ ͨؔ͠ FYQPSUGVODUJPO
"QQUTYͰJNQPSU FYQPSUͨ͠GVODUJPO
+4#VOEMF +BWB4DSJQU +45ISFBE +4* +47. /BUJWF.PEVMFT +BWB0CK$ 6*5ISFBE
/BUJWF6* +BWB0CK$ $ CBTFI DQQ SFBDUOBUJWFRVJDLCBTFI DQQ 2VJDL#BTFI NN ·ͱΊ KTJ3VOUJNFΦϒδΣΫτ +4*&YFDVUPS +4*/BUJWF.PEVMFT )FSNFT +4$ )FSNFT&YFDVUPS'BDUPSZ +4$&YFDVUPS'BDUPSZ 3$5+4*&YFDVUPS3VOUJNF*OTUBMMFS KTJDQQ +4*%ZOBNJDDQQ
͝੩ௌ ͋Γ͕ͱ͏͍͟͝·ͨ͠ ΩονϋΠΫςοΫϒϩάͰ 3FBDU/BUJWF࠷৽ใΛ࿈ࡌத IUUQTUFDILJUDIIJLFDPN