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
Stripe x ReactNative でフリマアプリを作った話 - React Nativ...
Search
fxwx23
October 08, 2022
Programming
1
1k
Stripe x ReactNative でフリマアプリを作った話 - React Native Matsuri 2022
fxwx23
October 08, 2022
Tweet
Share
More Decks by fxwx23
See All by fxwx23
マルチモジュールにおけるテスト最適化
fxwx23
0
380
Other Decks in Programming
See All in Programming
歴史と現在から考えるスケーラブルなソフトウェア開発のプラクティス
i10416
0
190
DevFest - Serverless 101 with Google Cloud Functions
tunmise
0
130
QA環境で誰でも自由自在に現在時刻を操って検証できるようにした話
kalibora
1
100
AppRouterを用いた大規模サービス開発におけるディレクトリ構成の変遷と問題点
eiganken
1
350
Jakarta EE meets AI
ivargrimstad
0
360
テストコード書いてみませんか?
onopon
2
270
情報漏洩させないための設計
kubotak
4
1.1k
Scalaから始めるOpenFeature入門 / Scalaわいわい勉強会 #4
arthur1
1
370
PHPUnitしか使ってこなかった 一般PHPerがPestに乗り換えた実録
mashirou1234
0
370
ある日突然あなたが管理しているサーバーにDDoSが来たらどうなるでしょう?知ってるようで何も知らなかったDDoS攻撃と対策 #phpcon.2024
akase244
2
7.5k
KubeCon NA 2024の全DB関連セッションを紹介
nnaka2992
0
100
Online-Dokumentation, die hilft: Strukturen, Prozesse, Tools
ahus1
0
110
Featured
See All Featured
How to Think Like a Performance Engineer
csswizardry
22
1.3k
Faster Mobile Websites
deanohume
305
30k
We Have a Design System, Now What?
morganepeng
51
7.3k
4 Signs Your Business is Dying
shpigford
182
21k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
44
6.9k
Facilitating Awesome Meetings
lara
50
6.2k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
330
21k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
33
2.7k
YesSQL, Process and Tooling at Scale
rocio
170
14k
StorybookのUI Testing Handbookを読んだ
zakiyama
28
5.4k
Making Projects Easy
brettharned
116
6k
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
6
470
Transcript
@fxwx23 Stripe x React Native Ͱ ϑϦϚΞϓϦΛ࡞ͬͨ React Native Matsuri
2022 / 2022.10.08
ࣗݾհ ɾᬒ ࢙و (Fumitaka Watanabe) ɾגࣜձࣾNewelse ڞಉۀऀ݉SWE (2014~) ɾGitHub: @fxwx23
ɾTwitter: @fxwx23 ɾࣗࣾϓϩμΫτͷ։ൃશൠΛ୲ (Go, TypeScript)
https://unstreet.jp
UNSTREET AIؑఆ͖ͭεχʔΧʔϑϦϚΞϓϦ ɾεχʔΧʔಛԽͷϑϦϚػೳΛఏڙ։࢝ (20228݄~) ɾAIը૾ؑఆαʔϏεͱఏܞِ͠Λରࡦ ɾ20186݄ εχʔΧʔൃചใΞϓϦͱͯ͠ ϦϦʔε
ຊͷ͓ ɾͳͥ React Native ʹҠߦ͔ͨ͠ ɾSwiftωΠςΟϒΞϓϦ͔ΒͲ͏Ҡߦ͢Δ͔ ɾReact Native ͜Μͳײ͡Ͱͬͯ·͢ ɾϑϦϚʹ͓͚Δ
stripe-react-native ͷ׆༻
Why React Native ?
ϑϦϚҎલ ɾεχʔΧʔͳͲͷൃചใͳͲΛνΣο ΫͰ͖ΔϝσΟΞΞϓϦͱͯ͠ӡ༻͍ͯ͠ ͨ ɾiOSΞϓϦͷΈఏڙɺશSwift ɾUIKit + Interface Builder (Storyboard)
C2C Support
େ෯ͳUIͷมߋ͕ൃੜ ɾUIKit + Interface Builder ർΕͨ😂 ɾ΄΅৽نViewͰɺ࣮࣭ϑϧϦϓϨΠε ▪ Hot reload
ͳ͍ͷͰมߋͷ֬ೝʹBuildɺԹ͔Έͷ͋ΔखಈͷIBOutlet etc ▪ એݴతUI͕ओྲྀʹͳ͖͍ͬͯͯΔ & Interface Builder σΟείϯʹͳΔͷා͍ ɾAndroidग़͍ͨ͠
࣮ࡍʹҠߦલʹߦΘΕͨ GitHub Discussions
ͨΒ͞Εͨબࢶ ɾSwiftUI + UIKit ɾUIKit + Interface Builder ɾReact Native
ɾFlutter
SwiftUI + UIKit ɾকདྷੑ͋Δ͠ɺSwiftࣗମਪͤΔ ɾ৽نViewͷΈSwiftUIΛར༻͢Δݱ࣮࿏ઢ ɾಈ࡞ʹएׯෆ҆ʁ iOS14 ΛΕͳΜͱ͔ͳΔ͔ ɾֶशίετ͋ΓͰɺՌʹAndroidΞϓϦͳ͍…
Flutter ɾຊͰRNΑΓਓޱଟ͍ʁ࠾༻໘Ͱ͍͍ͷ͔ʁ ɾશͯDartʹ͢Δ͘Β͍ͷؾ࣋ͪͳΒΞϦ ɾ৽نϓϩδΣΫτͳΒ࠾༻ͯ͠ྑ͔ͬͨ
React Native ɾࣾͷࣗಈԽπʔϧʹ Firebase Functions/Node.jsɺTypeScript ɾReact (Next.js) ͍ͬͯͨ ɾReact HooksɺLinter
ͳͲͷݟ
React Native Λ࠾༻ ɾࣾͷࣗಈԽπʔϧʹ Firebase Functions/Node.jsɺTypeScript ɾReact (Next.js) ͍ͬͯͨ ɾReact
HooksɺLinter ͳͲͷݟ ɾपғͰ૬ஊͰ͖Δਓ͕͍ͨͷޙԡ͠
Swift → React Native
Ҡߦʹ͋ͨΓ ɾӨڹൣғ͕ͳ͍Android൛ΛઌߦͰϦϦʔε ɾطଘver͔Βͷमਖ਼ϦϦʔεͱฒߦ͢Δඞཁੑ ɾطଘϢʔβʔ͕Ξοϓσʔτͯ͠ࣄނΒͳ͍ etc
Ҡߦʹ͋ͨΓ ɾӨڹൣғ͕ͳ͍Android൛ΛઌߦͰϦϦʔε ɾطଘver͔Βͷमਖ਼ϦϦʔεͱฒߦ͢Δඞཁੑ ɾطଘϢʔβʔ͕Ξοϓσʔτͯ͠ࣄނΒͳ͍ etc
Ҡߦʹ͋ͨΓ ɾӨڹൣғ͕ͳ͍Android൛ΛઌߦͰϦϦʔε ɾطଘver͔Βͷमਖ਼ϦϦʔεͱฒߦ͢Δඞཁੑ ɾطଘϢʔβʔ͕Ξοϓσʔτͯ͠ࣄނΒͳ͍ etc
։ൃΛฒߦ͢Δ্Ͱ ɾBundle ID ΛطଘωΠςΟϒΞϓϦͱ͚ͯ։ൃΛελʔτ ɾωΠςΟϒଆʹमਖ਼͕ൃੜͯ͠ετϨεͳ͘ಈ͚Δ ɾωΠςΟϒଆ͕ίʔυϑϦʔζ͔ͯ͠Β Bundle ID Λಉ͡ͷʹ
Bundle ID: com.newelse.kix Bundle ID: com.newelse.kix Path: /var/abcdef…/KIX.app/ Path: /var/012345…/KIX.app/
ver 4.8.6 ver 5.0.0
Ҡߦςετ ɾطଘωΠςΟϒΞϓϦΛXcodeͰϏϧυͯ͠Πϯετʔϧ ɾͦͷޙʹ React Native ͷΞϓϦΛΠϯετʔϧͯ֬͠ೝ ɾωΠςΟϒΞϓϦͰอଘ͞ΕͨϩʔΧϧσʔλΛਖ਼͘͠ಡΈग़͢ ▪ NSUserDefaultsɺRealmɺSQLite
NSUserDefaults ɾϢʔβʔͷઃఆใ (Preferences) ΛӬଓతʹอଘ͢Δ͜ͱ͕త ɾΞϓϦΛআ͢Δͱ NSUserDefaults ফ͑Δ ɾNSData, NSString, NSNumber,
NSDate, NSArray, or NSDictionary ▪ ࢀর: https://developer.apple.com/documentation/foundation/nsuserdefaults
Settings https://reactnative.dev/docs/settings
AsyncStorage
AsyncStorage ɾAndroidͰಉ͡Λอ࣋͢ΔͨΊɺSettingsಡΈग़͠ݶఆ ɾอଘͰ͖Δͷશͯ string → typeof Ͱௐͯదʹม ɾNSDate, NSData
͖͋ΒΊΔ
NSDate, NSData null ѻ͍ ɾRCTJSONClean Ͱॲཧ͞ΕΔσʔλΫϥεݶΒΕΔ ▪ NSString, NSMutableString,
NSNumber, NSNull ͷΈ ▪ ࢀর: https://github.com/facebook/react-native/blob/main/React/Base/RCTUtils.m#L165 ɾNSUserDefaultsͷσʔλඞͣ RCTJSONClean Λ௨Δ
Realm JS ɾSwift SDK Ͱ࡞ͨ͠σʔλ ಡΈࠐΊΔ ▪ [ ] Ͱ
Realm.List<T> Λදݱ ▪ ࢀর: https://www.mongodb.com/docs/realm/sdk/react- native/examples/de fi ne-a-realm-object-model/ #supported-property-types ɾSchemaͰఆٛ ɾHermes Support ݱ࣌ͰRC
React Native Ͱͷߏ ɾExpo Modules ɾExpo Bare Work fl ow
ɾRecoil, Sentry, Realm, React Navigation (v6) ɾBase Component
React Native Ͱͷߏ ɾExpo Modules ɾExpo Bare Work fl ow
ɾRecoil, Sentry, Realm, React Navigation (v6) ɾBase Component
Done SwiftΞϓϦͷRepositoryͷݴޠߏ React NativeΞϓϦͷRepositoryͷݴޠߏ
Stripe https://stripe.com/jp
Stripe Connect ϓϥοτϑΥʔϜͱϚʔέοτϓϨΠεͷͨΊͷܾࡁΠϯϑϥ ɾച্ͷೖۚΛAPIͰཧ ɾ135 Ҏ্ͷ௨՟ͱ֤ࠃͷ͞·͟·ͳࢧ͍ํ๏ʹରԠ ɾސ٬֬ೝ (KYC) ʹରԠ https://stripe.com/jp/connect
@stripe/stripe-react-native ɾReactNative͚ͷStripe༻ܾࡁϥΠϒϥϦ ɾओʹܾࡁใͷऩूͱܾࡁͷ֬ఆΛ୲͍ɺͦͷͨΊͷUIͱը໘ཁૉΛఏڙ ɾstripe-android, stripe-ios Λར༻͢ΔͨΊͷϒϦοδ
Getting Started ɾinitStripe ͔ StripeProvider ͰॳظԽॲཧ ɾuseStripe ͢ΔલʹॳظԽ͓ͯ͘͠ඞཁ͕͋Δ ɾॳظԽ࣌ʹͤΔ Params
ಉ͡
None
ܾࡁใͷऩू ɾCardField Component ͔ Payment Element Λར༻
ܾࡁใͷऩू ɾCardField Component ͔ Payment Element Λར༻
Payment Element ҆શͰຒΊࠐΈՄೳͳ 1 ͭͷ UI ίϯϙʔωϯτ ɾೖྗϑΟʔϧυΛࣗಈతʹௐ͠ɺࢧ͍ํ๏ͱࠃʹج͍ͮͯใΛऩू ɾೖྗݕূɺϚεΩϯάɺελΠϧॲཧɺΤϥʔॲཧ ɾސ٬ͷΧʔυใΛཧ
Payment Element ҆શͰຒΊࠐΈՄೳͳ 1 ͭͷ UI ίϯϙʔωϯτ ɾೖྗϑΟʔϧυΛࣗಈతʹௐ͠ɺࢧ͍ํ๏ͱࠃʹج͍ͮͯใΛऩू ɾೖྗݕূɺϚεΩϯάɺελΠϧॲཧɺΤϥʔॲཧ ɾސ٬ͷΧʔυใΛཧ
None
None
None
None
None
None
None
ܾࡁॲཧͱ ࢥ͑ͳ͍΄Ͳ ؆ܿ
@stripe/stripe-react-native ɾγϯϓϧͳΠϯλʔϑΣΠεͰωΠςΟϒରԠͷUIΛར༻Ͱ͖Δ ɾ3DηΩϡΞʹ༰қʹରԠՄೳ ɾޱ࠲ใͷొʹରԠ (createToken)
@stripe/stripe-react-native ɾγϯϓϧͳΠϯλʔϑΣΠεͰωΠςΟϒରԠͷUIΛར༻Ͱ͖Δ ɾ3DηΩϡΞʹ༰қʹରԠՄೳ ɾޱ࠲ใͷొʹରԠ (createToken) https://stripe.com/docs/payments/accept-a-payment?platform=react-native
React Native ʹҠߦͯ͠Έͯ ɾ։ൃ͕֨ஈʹ্͕ͬͨ ▪ ಉ࣌ʹAndroid (or iOS) ͕Ͱ͖͕͋ΔͷΫϩεϓϥοτϑΥʔϜͷޣຯ ɾTypeScript,
React ͷݟԠ༻ͷαΠΫϧ͕ճΔ ɾWebϑϩϯτΤϯυͱͷ༥߹ ▪ React GUI, Expo Router etc ɾΫϥΠΞϯταΠυͷ૯߹֨ಆٕ
We are hiring!
We are hiring!
ࣗݾհ ɾᬒ ࢙و (Fumitaka Watanabe) ɾגࣜձࣾNewelse ڞಉۀऀ݉SWE (2014~) ɾGitHub: @fxwx23
ɾTwitter: @fxwx23 ɾࣗࣾϓϩμΫτͷ։ൃશൠΛ୲ (Go, TypeScript)
Thanks