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
990
Stripe x ReactNative でフリマアプリを作った話 - React Native Matsuri 2022
fxwx23
October 08, 2022
Tweet
Share
More Decks by fxwx23
See All by fxwx23
マルチモジュールにおけるテスト最適化
fxwx23
0
230
Other Decks in Programming
See All in Programming
RemixとCloudflare Stack におけるFile Upload
ossamoon
1
120
学生の時に開催したPerl入学式をきっかけにエンジニアが組織に馴染むために勉強会を主催や仲間と参加して職能間の境界を越えていく
ohmori_yusuke
1
110
CDKを活用した 大規模コンテナ移行 プロジェクトの紹介
yoyoyopg
0
240
NANIMACHI
naokiito
0
930
What is TDD?
urakawa_jinsei
1
200
データサイエンスのフルサイクル開発を実現する機械学習パイプライン
xcnkx
2
470
5年分のツケを一気に払った話
soogie
3
1.2k
複数プロダクトの技術改善・クラウド移行に向き合うチームのフレキシブルなペア・モブプログラミングの実践 / Flexible Pair Programming And Mob Programming
honyanya
0
160
上手に付き合うコンポーネントテスト
quramy
3
1.2k
Vue :: Better Testing 2024
up1
1
380
.NET Aspireのクラウド対応検証: Azureと他環境での実践
ymd65536
1
270
Pythonによるイベントソーシングへの挑戦と現状に対する考察 / Challenging Event Sourcing with Python and Reflections on the Current State
nrslib
3
900
Featured
See All Featured
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
355
29k
KATA
mclloyd
27
13k
StorybookのUI Testing Handbookを読んだ
zakiyama
26
5.1k
In The Pink: A Labor of Love
frogandcode
139
22k
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
92
16k
Faster Mobile Websites
deanohume
304
30k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
28
9k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
42
6.5k
The MySQL Ecosystem @ GitHub 2015
samlambert
250
12k
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
29
1.7k
A Tale of Four Properties
chriscoyier
155
22k
Fontdeck: Realign not Redesign
paulrobertlloyd
81
5.2k
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