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
Native Moduleの作り方 / Creating Native Module in R...
Search
Tatsuya Kitagawa
February 26, 2020
Programming
780
2
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Native Moduleの作り方 / Creating Native Module in React Native
https://ducklings.connpass.com/event/164844/
の発表資料です。
Tatsuya Kitagawa
February 26, 2020
More Decks by Tatsuya Kitagawa
See All by Tatsuya Kitagawa
LiveData with RxJava2
yatatsu
0
800
Other Decks in Programming
See All in Programming
「AIで開発し、AIを届ける」をEvalでつなぐ 〜AIネイティブに始めるプロダクト開発の実践〜 / Connecting "Develop with AI, deliver AI" with Eval
rkaga
4
5.6k
LaravelLive Japan の裏方のすべて — 第188回 PHP勉強会@東京 (2026-06-24)
suguruooki
2
150
Developing with AI Agents — Codex, Claude Code & Cowork Practical Guide
x5gtrn
PRO
0
1.3k
AIエージェントで 変わるAndroid開発環境
takahirom
1
380
act1-costs.pdf
sumedhbala
0
160
関数型プログラミングのメリットって何だろう?
wanko_it
0
130
Contextとはなにか
chiroruxx
1
390
The NotImplementedError Problem in Ruby
koic
1
1.1k
Mujeres en SEO Summit 2026 - Greatest Disaster Hits en Web Performance
guaca
0
230
LLM本来の能力を解き放つサンドボックス技術とAI民主化への適用
yukukotani
3
4.8k
symfony/aiとlaravel/boost
77web
0
120
Generative UI & AI-Assistants for Your Angular Solutions
manfredsteyer
PRO
0
120
Featured
See All Featured
HTML-Aware ERB: The Path to Reactive Rendering @ RubyCon 2026, Rimini, Italy
marcoroth
2
300
The Hidden Cost of Media on the Web [PixelPalooza 2025]
tammyeverts
2
340
Ecommerce SEO: The Keys for Success Now & Beyond - #SERPConf2024
aleyda
1
2k
The Illustrated Guide to Node.js - THAT Conference 2024
reverentgeek
1
410
Building a Scalable Design System with Sketch
lauravandoore
463
34k
JAMstack: Web Apps at Ludicrous Speed - All Things Open 2022
reverentgeek
1
490
How to Build an AI Search Optimization Roadmap - Criteria and Steps to Take #SEOIRL
aleyda
1
2.1k
世界の人気アプリ100個を分析して見えたペイウォール設計の心得
akihiro_kokubo
PRO
72
40k
Leading Effective Engineering Teams in the AI Era
addyosmani
9
2.1k
Measuring & Analyzing Core Web Vitals
bluesmoon
9
880
HU Berlin: Industrial-Strength Natural Language Processing with spaCy and Prodigy
inesmontani
PRO
0
440
Improving Core Web Vitals using Speculation Rules API
sergeychernyshev
21
1.5k
Transcript
Native Module ͷ࡞Γํ React Native Tech Blog meetup#1 2020-02-26
About me? • ୡʢTatsuya KITAGAWAʣ • PAY.JP • https:#//github.com/yatatsu
• https:#//twitter.com/tatsuyakit
About PAY.JP • https:#//pay.jp/ • γϯϓϧͰΘ͔Γ͍͢APIΛఏڙ͢ΔܾࡁαʔϏε • ڝ߹ͷαʔϏεͱͯ͠StripeͳͲ͕͋Γ·͢ • React
Native͚ͷSDKϓϥάΠϯΛެ։͠·ͨ͠ http:#//payjp-announce.hatenablog.com/entry/2020/02/14/113211
Native Modules? (1/2) • ඪ४Ͱଟ͘ͷωΠςΟϒͷػೳ͕ར༻Ͱ͖Δ • Alert.alert(…)ͰΞϥʔτ͕දࣔ͞ΕΔͱ͔ • ඪ४Ͱ༻ҙ͞Ε͍ͯͳ͍ωΠςΟϒͷػೳΛར༻͍ͨ͠ •
ಉ͡Α͏ʹJS͔Βར༻Ͱ͖ΔΑ͏ʹ͢ΔΈ
Native Modules? (2/2) • react-native-community/react-native-webview • react-native-community/react-native-maps • ϥΠϒϥϦͱͯ͠ఏڙ͞Ε͍ͯΔͷ͕ଟ •
͜ΕΒΛ࡞ΔଆͷΛ͠·͢
CLI tools (1/3) • brodybits/create-react-native-module • react-native-community/bob • frostney/react-native-create-library •
peggyrayzis/react-native-create-bridge
CLI tools (2/3) • ެࣜυΩϡϝϯτͰcreate-react-native-module • “To get set up
with the basic project structure for a native module we will use a third party tool create-react-native-module” • ͓͢͢Ί࠷খݶͷߏ͕΄͍͠ͳΒ "-> create-react-native-module • LinterFormatterͳͲͷॳظઃఆ·Ͱ͓·͔ͤ "-> react-native-community/bob
CLI tools (3/3) • `npx create-react-native-module MyLibrary` • ϓϩδΣΫτͷܗ͕࡞͞ΕΔ
react-native-my-library/ "## README.md "## android $ "## README.md $ "##
build.gradle $ &## src $ &## main $ "## AndroidManifest.xml $ &## java $ &## com $ &## reactlibrary $ "## MyLibraryModule.java $ &## MyLibraryPackage.java "## index.js "## ios $ "## MyLibrary.h $ "## MyLibrary.m $ "## MyLibrary.xcodeproj $ $ &## project.pbxproj $ &## MyLibrary.xcworkspace $ &## contents.xcworkspacedata "## package.json &## react-native-my-library.podspec
Auto Linking (1/2) • RN 0.60ΑΓಋೖ͞ΕͨAutoLinking • `react-native config`ͰಘΒΕΔ ϓϩδΣΫτͷϝλใΛར༻ͯ͠Link͢Δ
• https:#//github.com/react-native-community/ cli/blob/master/docs/autolinking.md
Auto Linking (2/2) • σΟϨΫτϦߏσϑΥϧτͷconfigʹҰக • *.podspec͕ϓϩδΣΫτԼʹ͋Δ etc. • มߋ͢Δ߹
react-native.config.js ΛՃ
react-native.config.js const path = require('path'); module.exports = { dependency: {
platforms: { ios: { podspecPath: path.join(#__dirname, 'ios', 'my.podspec') } } } };
tips:1 Xcode (1/4) • iOSωΠςΟϒͷ։ൃ͢Δͱ͖Xcode͕ศར • ͔͠͠ϥΠϒϥϦͷϓϩδΣΫτΛͦͷ··ಡΈࠐΉͱ…
tips:1 Xcode (2/4) • iOSωΠςΟϒͷ։ൃ͢Δͱ͖Xcode͕ศར • ͔͠͠ϥΠϒϥϦͷϓϩδΣΫτΛͦͷ··ಡΈࠐΉͱ…
tips:1 Xcode (3/4) • example/ios/example.xcworkspace Λ։͘ ʢpod install͔ͯ͠Βʣ
tips:1 Android Studio (4/4) • example/android/build.gradle Λ։͘
tips:2 Sync modules (1/2) • ios/ android/ Λมߋͯ͠ • ಈ࡞֬ೝexampleҎԼͰ͓͜ͳ͏
• ຖճ yarn install ͢͠ͷ͕͔͔࣌ؒΔ
tips:2 Sync modules (2/2) "scripts": { "dev-sync": "cp -r *podspec
android ios example/ node_modules/react-native-my-library/“ }, • ରͷίʔυ͚ͩࠩ͠ସ͑Δ • react-native-community/react-native-share
·ͱΊ • Native ModuleΛ։ൃ͢ΔࡍCLIπʔϧ͕ศར • XcodeAndroid StudioͰ։ൃ͢Δ • ࡉ͔͍։ൃͷTipsଞͷOSS͕ࢀߟʹͳΔ •
ಛʹ react-native-community ͕๛
Blog • Native Moduleͷ࡞Γํ - React Native Tech Blog https:#//tech.maricuru.com/entry/2020/02/20/052054