Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Native Moduleの作り方 / Creating Native Module in R...
Search
Tatsuya Kitagawa
February 26, 2020
Programming
790
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
810
Other Decks in Programming
See All in Programming
RAG の “R” を Swift で覗いてみる 〜「意味から探す」検索の仕組み〜
nao_randd
0
160
Atomic Design, Enforced: Scaling Mobile Design Systems (next.app devCon / droidCon Berlin 2026)
steliosf
PRO
0
170
Findy - エンジニア向け会社紹介/Findy Company Deck
findyinc
6
400k
現場と育てるRailsモデリング 〜Spreadsheetから始めたモデル設計〜
siroemk
2
600
カツオ、ご期待ください
suneo3476
0
190
Starting & Sustaining Code-Based E2E Testing for Non-Coding QA Teams( #jasstniigata )
teyamagu
PRO
1
1k
個人開発者よ、Honoを使え(おじさんver)
tanahiro2010
2
260
半永久的に提供し続けられるプライベートクラウドを目指して ― 利用者の認知負荷を抑えるAPI抽象化とハードウェア世代交代の基盤設計
tomokon
0
500
AI時代のコードレビューは人に向けるな、仕組みに向けろ
texmeijin
5
3.7k
Everything will be SERVERLESS — 信じて運用した10年の経験値 / Everything Will be Serverless — Lessons Learned from 10 Years of Operational Experience
seike460
PRO
1
1.1k
コーディング自動化の次へ。人の介入をゼロにするファクトリーとサポートAIによる実践
timakin
5
3.7k
C#の現在地 進化の歴史と、AI時代の.NET Everywhere
neuecc
5
5.2k
Featured
See All Featured
From Legacy to Launchpad: Building Startup-Ready Communities
dugsong
0
360
Principles of Awesome APIs and How to Build Them.
keavy
128
18k
The Straight Up "How To Draw Better" Workshop
denniskardys
239
140k
BBQ
matthewcrist
90
10k
Heart Work Chapter 1 - Part 1
lfama
PRO
10
37k
The Illustrated Children's Guide to Kubernetes
chrisshort
51
53k
Unsuck your backbone
ammeep
672
58k
Skip the Path - Find Your Career Trail
mkilby
1
260
Building Better People: How to give real-time feedback that sticks.
wjessup
370
20k
Imperfection Machines: The Place of Print at Facebook
scottboms
270
14k
Rails Girls Zürich Keynote
gr2m
96
14k
How to optimise 3,500 product descriptions for ecommerce in one day using ChatGPT
katarinadahlin
PRO
3
3.9k
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