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
350
Other Decks in Programming
See All in Programming
第5回日本眼科AI学会総会_AIコンテスト_3位解法
neilsaw
0
170
Zoneless Testing
rainerhahnekamp
0
120
Symfony Mapper Component
soyuka
2
730
わたしの星のままで一番星になる ~ 出産を機にSIerからEC事業会社に転職した話 ~
kimura_m_29
0
180
useSyncExternalStoreを使いまくる
ssssota
6
1k
数十万行のプロジェクトを Scala 2から3に完全移行した
xuwei_k
0
260
Security_for_introducing_eBPF
kentatada
0
110
103 Early Hints
sugi_0000
1
220
なまけものオバケたち -PHP 8.4 に入った新機能の紹介-
tanakahisateru
1
120
The Efficiency Paradox and How to Save Yourself and the World
hollycummins
1
440
似たもの同士のPerlとPHP
uzulla
1
130
あれやってみてー駆動から成長を加速させる / areyattemite-driven
nashiusagi
1
200
Featured
See All Featured
Fashionably flexible responsive web design (full day workshop)
malarkey
405
65k
Stop Working from a Prison Cell
hatefulcrawdad
267
20k
Agile that works and the tools we love
rasmusluckow
328
21k
A Tale of Four Properties
chriscoyier
157
23k
Designing for humans not robots
tammielis
250
25k
Reflections from 52 weeks, 52 projects
jeffersonlam
347
20k
Large-scale JavaScript Application Architecture
addyosmani
510
110k
Facilitating Awesome Meetings
lara
50
6.1k
Build The Right Thing And Hit Your Dates
maggiecrowley
33
2.4k
The Straight Up "How To Draw Better" Workshop
denniskardys
232
140k
Designing Experiences People Love
moore
138
23k
Building Flexible Design Systems
yeseniaperezcruz
327
38k
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