Skip to content

Commit 20bd1e3

Browse files
committed
Add primary colorfor iOS
1 parent 2ca44d3 commit 20bd1e3

File tree

3 files changed

+19
-13
lines changed

3 files changed

+19
-13
lines changed

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,9 @@ Onfido.startSDK(
5959
} else {
6060
console.log("Flow not finished")
6161
};
62-
});
62+
},
63+
// Optional iOS primary color
64+
primaryColor);
6365
```
6466

6567
<a name="community"></a>

ios/Onfido.swift

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,18 @@ class Onfido: NSObject {
88
applicantId: String,
99
countryId: String,
1010
resolver resolve: @escaping RCTResponseSenderBlock,
11-
rejecter reject: @escaping RCTResponseSenderBlock) -> Void {
11+
rejecter reject: @escaping RCTResponseSenderBlock) -> Void,
12+
primaryColor: String = "#FF9100"{
1213
DispatchQueue.main.async {
1314
switch flowType {
1415
case "full":
15-
self.run(withToken: token, andApplicantId: applicantId, andCountryCode: countryId, resolver: resolve, rejecter: reject)
16+
self.run(withToken: token, andApplicantId: applicantId, andCountryCode: countryId, resolver: resolve, rejecter: reject, andPrimaryColor: primaryColors)
1617
case "selfie":
17-
self.runSelfie(withToken: token, andApplicantId: applicantId, andCountryCode: countryId, resolver: resolve, rejecter: reject)
18+
self.runSelfie(withToken: token, andApplicantId: applicantId, andCountryCode: countryId, resolver: resolve, rejecter: reject, andPrimaryColor: primaryColor)
1819
case "document":
19-
self.runDocument(withToken: token, andApplicantId: applicantId, andCountryCode: countryId, resolver: resolve, rejecter: reject)
20+
self.runDocument(withToken: token, andApplicantId: applicantId, andCountryCode: countryId, resolver: resolve, rejecter: reject, andPrimaryColor: primaryColor)
2021
default:
21-
self.run(withToken: token, andApplicantId: applicantId, andCountryCode: countryId, resolver: resolve, rejecter: reject)
22+
self.run(withToken: token, andApplicantId: applicantId, andCountryCode: countryId, resolver: resolve, rejecter: reject, andPrimaryColor: primaryColor)
2223
}
2324
}
2425
}
@@ -32,10 +33,11 @@ class Onfido: NSObject {
3233
andApplicantId id: String,
3334
andCountryCode countryId: String,
3435
resolver resolve: @escaping RCTResponseSenderBlock,
35-
rejecter reject: @escaping RCTResponseSenderBlock) {
36+
rejecter reject: @escaping RCTResponseSenderBlock,
37+
andPrimaryColor primaryColor: String = "#FF9100") {
3638

3739
let appearance = Appearance(
38-
primaryColor: colorWithHexString(hexString: "#FF9100"),
40+
primaryColor: colorWithHexString(primaryColor),
3941
primaryTitleColor: colorWithHexString(hexString: "#FFFFFF"),
4042
primaryBackgroundPressedColor: colorWithHexString(hexString: "#111222"),
4143
secondaryBackgroundPressedColor:colorWithHexString(hexString: "#333444")
@@ -87,10 +89,11 @@ class Onfido: NSObject {
8789
andApplicantId id: String,
8890
andCountryCode countryId: String,
8991
resolver resolve: @escaping RCTResponseSenderBlock,
90-
rejecter reject: @escaping RCTResponseSenderBlock) {
92+
rejecter reject: @escaping RCTResponseSenderBlock,
93+
andPrimaryColor primaryColor: String = "#FF9100") {
9194

9295
let appearance = Appearance(
93-
primaryColor: colorWithHexString(hexString: "#FF9100"),
96+
primaryColor: colorWithHexString(hexString: primaryColor),
9497
primaryTitleColor: colorWithHexString(hexString: "#FFFFFF"),
9598
primaryBackgroundPressedColor: colorWithHexString(hexString: "#111222"),
9699
secondaryBackgroundPressedColor:colorWithHexString(hexString: "#333444")
@@ -140,10 +143,11 @@ class Onfido: NSObject {
140143
andApplicantId id: String,
141144
andCountryCode countryId: String,
142145
resolver resolve: @escaping RCTResponseSenderBlock,
143-
rejecter reject: @escaping RCTResponseSenderBlock) {
146+
rejecter reject: @escaping RCTResponseSenderBlock,
147+
andPrimaryColor primaryColor: String = "#FF9100") {
144148

145149
let appearance = Appearance(
146-
primaryColor: colorWithHexString(hexString: "#FF9100"),
150+
primaryColor: colorWithHexString(hexString: primaryColor),
147151
primaryTitleColor: colorWithHexString(hexString: "#FFFFFF"),
148152
primaryBackgroundPressedColor: colorWithHexString(hexString: "#111222"),
149153
secondaryBackgroundPressedColor:colorWithHexString(hexString: "#333444")

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "react-native-onfido",
33
"title": "React Native Onfido",
4-
"version": "4.0.0",
4+
"version": "4.1.0",
55
"description": "React Native Onfido",
66
"main": "index.js",
77
"scripts": {

0 commit comments

Comments
 (0)