Skip to content

Commit 1463b0c

Browse files
committed
Adding support for iOS 13 DarkMode
1 parent ad22d89 commit 1463b0c

File tree

5 files changed

+82
-37
lines changed

5 files changed

+82
-37
lines changed

ios/gutenberg.xcodeproj/project.pbxproj

+30-30
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
2DF0FFEE2056DD460020B375 /* libReact.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 3DAD3EA31DF850E9000B6D8A /* libReact.a */; };
3434
5E9157361DD0AC6A00FF2AA8 /* libRCTAnimation.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 5E9157331DD0AC6500FF2AA8 /* libRCTAnimation.a */; };
3535
7E45CC5B218B42E000C0B2AB /* libRNReactNativeGutenbergBridge.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 7E45CC5A218B42C000C0B2AB /* libRNReactNativeGutenbergBridge.a */; };
36+
7E8FA9582301CAB000D007F0 /* libRNDarkMode.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 7E8FA9522301CA9E00D007F0 /* libRNDarkMode.a */; };
3637
7EC7328F21907E3F00FED2E6 /* GutenbergViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7EC7328E21907E3F00FED2E6 /* GutenbergViewController.swift */; };
3738
832341BD1AAA6AB300B99B32 /* libRCTText.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 832341B51AAA6A8300B99B32 /* libRCTText.a */; };
3839
8C666FF0C9224FB88C2C0447 /* libRNSVG-tvOS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 9BFAFEB337654221B2F14D03 /* libRNSVG-tvOS.a */; };
@@ -126,20 +127,6 @@
126127
remoteGlobalIDString = ADD01A681E09402E00F6D226;
127128
remoteInfo = "RCTBlob-tvOS";
128129
};
129-
2D16E6831FA4F8DC00B85C8A /* PBXContainerItemProxy */ = {
130-
isa = PBXContainerItemProxy;
131-
containerPortal = 139FDEE61B06529A00C62182 /* RCTWebSocket.xcodeproj */;
132-
proxyType = 2;
133-
remoteGlobalIDString = 3DBE0D001F3B181A0099AA32;
134-
remoteInfo = fishhook;
135-
};
136-
2D16E6851FA4F8DC00B85C8A /* PBXContainerItemProxy */ = {
137-
isa = PBXContainerItemProxy;
138-
containerPortal = 139FDEE61B06529A00C62182 /* RCTWebSocket.xcodeproj */;
139-
proxyType = 2;
140-
remoteGlobalIDString = 3DBE0D0D1F3B181C0099AA32;
141-
remoteInfo = "fishhook-tvOS";
142-
};
143130
2DF0FFDE2056DD460020B375 /* PBXContainerItemProxy */ = {
144131
isa = PBXContainerItemProxy;
145132
containerPortal = 146833FF1AC3E56700842450 /* React.xcodeproj */;
@@ -287,6 +274,13 @@
287274
remoteGlobalIDString = 134814201AA4EA6300B7C361;
288275
remoteInfo = RNReactNativeGutenbergBridge;
289276
};
277+
7E8FA9512301CA9E00D007F0 /* PBXContainerItemProxy */ = {
278+
isa = PBXContainerItemProxy;
279+
containerPortal = 7E8FA9292301CA9E00D007F0 /* RNDarkMode.xcodeproj */;
280+
proxyType = 2;
281+
remoteGlobalIDString = 6E20834822AADA1000CC4732;
282+
remoteInfo = RNDarkMode;
283+
};
290284
7EA30E0221ADC8540092F894 /* PBXContainerItemProxy */ = {
291285
isa = PBXContainerItemProxy;
292286
containerPortal = F619623252704B46A619C33C /* RNTAztecView.xcodeproj */;
@@ -427,6 +421,7 @@
427421
69F3DF692A7C4E5994CD3CBB /* libRNSafeArea.a */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = archive.ar; path = libRNSafeArea.a; sourceTree = "<group>"; };
428422
78C398B01ACF4ADC00677621 /* RCTLinking.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTLinking.xcodeproj; path = "../node_modules/react-native/Libraries/LinkingIOS/RCTLinking.xcodeproj"; sourceTree = "<group>"; };
429423
7E45CC55218B42C000C0B2AB /* RNReactNativeGutenbergBridge.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RNReactNativeGutenbergBridge.xcodeproj; path = "../react-native-gutenberg-bridge/ios/RNReactNativeGutenbergBridge.xcodeproj"; sourceTree = "<group>"; };
424+
7E8FA9292301CA9E00D007F0 /* RNDarkMode.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RNDarkMode.xcodeproj; path = "../node_modules/react-native-dark-mode/ios/RNDarkMode.xcodeproj"; sourceTree = "<group>"; };
430425
7EA30CF021AC8CDA0092F894 /* libxml2.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libxml2.tbd; path = usr/lib/libxml2.tbd; sourceTree = SDKROOT; };
431426
7EC7328E21907E3F00FED2E6 /* GutenbergViewController.swift */ = {isa = PBXFileReference; indentWidth = 4; lastKnownFileType = sourcecode.swift; name = GutenbergViewController.swift; path = gutenberg/GutenbergViewController.swift; sourceTree = "<group>"; tabWidth = 1; };
432427
832341B01AAA6A8300B99B32 /* RCTText.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTText.xcodeproj; path = "../node_modules/react-native/Libraries/Text/RCTText.xcodeproj"; sourceTree = "<group>"; };
@@ -472,6 +467,7 @@
472467
146834051AC3E58100842450 /* libReact.a in Frameworks */,
473468
5E9157361DD0AC6A00FF2AA8 /* libRCTAnimation.a in Frameworks */,
474469
00C302E51ABCBA2D00DB3ED1 /* libRCTActionSheet.a in Frameworks */,
470+
7E8FA9582301CAB000D007F0 /* libRNDarkMode.a in Frameworks */,
475471
00C302E81ABCBA2D00DB3ED1 /* libRCTImage.a in Frameworks */,
476472
133E29F31AD74F7200F7D852 /* libRCTLinking.a in Frameworks */,
477473
00C302E91ABCBA2D00DB3ED1 /* libRCTNetwork.a in Frameworks */,
@@ -580,8 +576,6 @@
580576
children = (
581577
139FDEF41B06529B00C62182 /* libRCTWebSocket.a */,
582578
3DAD3E991DF850E9000B6D8A /* libRCTWebSocket-tvOS.a */,
583-
2D16E6841FA4F8DC00B85C8A /* libfishhook.a */,
584-
2D16E6861FA4F8DC00B85C8A /* libfishhook-tvOS.a */,
585579
);
586580
name = Products;
587581
sourceTree = "<group>";
@@ -666,9 +660,18 @@
666660
name = Products;
667661
sourceTree = "<group>";
668662
};
663+
7E8FA92A2301CA9E00D007F0 /* Products */ = {
664+
isa = PBXGroup;
665+
children = (
666+
7E8FA9522301CA9E00D007F0 /* libRNDarkMode.a */,
667+
);
668+
name = Products;
669+
sourceTree = "<group>";
670+
};
669671
832341AE1AAA6A7D00B99B32 /* Libraries */ = {
670672
isa = PBXGroup;
671673
children = (
674+
7E8FA9292301CA9E00D007F0 /* RNDarkMode.xcodeproj */,
672675
91C2E1AE22422C9F00D5E1F5 /* RNTKeyboardAwareScrollView.xcodeproj */,
673676
7E45CC55218B42C000C0B2AB /* RNReactNativeGutenbergBridge.xcodeproj */,
674677
5E91572D1DD0AC6500FF2AA8 /* RCTAnimation.xcodeproj */,
@@ -975,6 +978,10 @@
975978
ProductGroup = 146834001AC3E56700842450 /* Products */;
976979
ProjectRef = 146833FF1AC3E56700842450 /* React.xcodeproj */;
977980
},
981+
{
982+
ProductGroup = 7E8FA92A2301CA9E00D007F0 /* Products */;
983+
ProjectRef = 7E8FA9292301CA9E00D007F0 /* RNDarkMode.xcodeproj */;
984+
},
978985
{
979986
ProductGroup = 7E45CC56218B42C000C0B2AB /* Products */;
980987
ProjectRef = 7E45CC55218B42C000C0B2AB /* RNReactNativeGutenbergBridge.xcodeproj */;
@@ -1063,20 +1070,6 @@
10631070
remoteRef = 2D16E6711FA4F8DC00B85C8A /* PBXContainerItemProxy */;
10641071
sourceTree = BUILT_PRODUCTS_DIR;
10651072
};
1066-
2D16E6841FA4F8DC00B85C8A /* libfishhook.a */ = {
1067-
isa = PBXReferenceProxy;
1068-
fileType = archive.ar;
1069-
path = libfishhook.a;
1070-
remoteRef = 2D16E6831FA4F8DC00B85C8A /* PBXContainerItemProxy */;
1071-
sourceTree = BUILT_PRODUCTS_DIR;
1072-
};
1073-
2D16E6861FA4F8DC00B85C8A /* libfishhook-tvOS.a */ = {
1074-
isa = PBXReferenceProxy;
1075-
fileType = archive.ar;
1076-
path = "libfishhook-tvOS.a";
1077-
remoteRef = 2D16E6851FA4F8DC00B85C8A /* PBXContainerItemProxy */;
1078-
sourceTree = BUILT_PRODUCTS_DIR;
1079-
};
10801073
2DF0FFDF2056DD460020B375 /* libjsinspector.a */ = {
10811074
isa = PBXReferenceProxy;
10821075
fileType = archive.ar;
@@ -1224,6 +1217,13 @@
12241217
remoteRef = 7E45CC59218B42C000C0B2AB /* PBXContainerItemProxy */;
12251218
sourceTree = BUILT_PRODUCTS_DIR;
12261219
};
1220+
7E8FA9522301CA9E00D007F0 /* libRNDarkMode.a */ = {
1221+
isa = PBXReferenceProxy;
1222+
fileType = archive.ar;
1223+
path = libRNDarkMode.a;
1224+
remoteRef = 7E8FA9512301CA9E00D007F0 /* PBXContainerItemProxy */;
1225+
sourceTree = BUILT_PRODUCTS_DIR;
1226+
};
12271227
832341B51AAA6A8300B99B32 /* libRCTText.a */ = {
12281228
isa = PBXReferenceProxy;
12291229
fileType = archive.ar;

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,7 @@
141141
"node-sass": "^4.12.0",
142142
"react": "16.8.6",
143143
"react-native": "jtreanor/react-native#v0.60.0-patched",
144+
"react-native-dark-mode": "^0.0.7",
144145
"react-native-hr": "git+https://github.com/Riglerr/react-native-hr.git#2d01a5cf77212d100e8b99e0310cce5234f977b3",
145146
"react-native-keyboard-aware-scroll-view": "git+https://github.com/wordpress-mobile/react-native-keyboard-aware-scroll-view.git#gb-v0.8.7",
146147
"react-native-modal": "^6.5.0",

src/index.js

+8-6
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*/
44
import { AppRegistry, I18nManager, YellowBox } from 'react-native';
55
import React from 'react';
6-
6+
import { DarkModeProvider } from 'react-native-dark-mode'
77
/**
88
* WordPress dependencies
99
*/
@@ -66,11 +66,13 @@ export class RootComponent extends React.Component {
6666
}
6767
const Editor = require( '@wordpress/edit-post' ).Editor;
6868
return (
69-
<Editor
70-
initialHtml={ initialData }
71-
initialHtmlModeEnabled={ initialHtmlModeEnabled }
72-
initialTitle={ initialTitle }
73-
/>
69+
<DarkModeProvider>
70+
<Editor
71+
initialHtml={ initialData }
72+
initialHtmlModeEnabled={ initialHtmlModeEnabled }
73+
initialTitle={ initialTitle }
74+
/>
75+
</DarkModeProvider>
7476
);
7577
}
7678
}

yarn.lock

+42
Original file line numberDiff line numberDiff line change
@@ -1703,6 +1703,11 @@
17031703
dependencies:
17041704
"@babel/types" "^7.3.0"
17051705

1706+
"@types/events@^3.0.0":
1707+
version "3.0.0"
1708+
resolved "https://registry.yarnpkg.com/@types/events/-/events-3.0.0.tgz#2862f3f58a9a7f7c3e78d79f130dd4d71c25c2a7"
1709+
integrity sha512-EaObqwIvayI5a8dCzhFrjKzVwKLxjoG9T6Ppd5CEo07LRKfQ8Yokw54r5+Wq7FaBQ+yXRvQAYPrHwya1/UFt9g==
1710+
17061711
"@types/istanbul-lib-coverage@*", "@types/istanbul-lib-coverage@^2.0.0":
17071712
version "2.0.1"
17081713
resolved "https://registry.yarnpkg.com/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.1.tgz#42995b446db9a48a11a07ec083499a860e9138ff"
@@ -1733,6 +1738,22 @@
17331738
resolved "https://registry.yarnpkg.com/@types/prop-types/-/prop-types-15.7.1.tgz#f1a11e7babb0c3cad68100be381d1e064c68f1f6"
17341739
integrity sha512-CFzn9idOEpHrgdw8JsoTkaDDyRWk1jrzIV8djzcgpq0y9tG4B4lFT+Nxh52DVpDXV+n4+NPNv7M1Dj5uMp6XFg==
17351740

1741+
"@types/react-native@^0.57.60":
1742+
version "0.57.65"
1743+
resolved "https://registry.yarnpkg.com/@types/react-native/-/react-native-0.57.65.tgz#9da4773aaa95924bce42a54a5c19cfd8ffd5022b"
1744+
integrity sha512-7P5ulTb+/cnwbABWaAjzKmSYkRWeK7UCTfUwHhDpnwxdiL2X/KbdN1sPgo0B2E4zxfYE3MEoHv7FhB8Acfvf8A==
1745+
dependencies:
1746+
"@types/prop-types" "*"
1747+
"@types/react" "*"
1748+
1749+
"@types/react@*", "@types/react@^16.8.19":
1750+
version "16.9.1"
1751+
resolved "https://registry.yarnpkg.com/@types/react/-/react-16.9.1.tgz#862c83b4c9d5cd116e42fd9a4f3694843cd2c051"
1752+
integrity sha512-jGM2x8F7m7/r+81N/BOaUKVwbC5Cdw6ExlWEUpr77XPwVeNvAppnPEnMMLMfxRDYL8FPEX8MHjwtD2NQMJ0yyQ==
1753+
dependencies:
1754+
"@types/prop-types" "*"
1755+
csstype "^2.2.0"
1756+
17361757
"@types/react@^16.8.8":
17371758
version "16.8.23"
17381759
resolved "https://registry.yarnpkg.com/@types/react/-/react-16.8.23.tgz#ec6be3ceed6353a20948169b6cb4c97b65b97ad2"
@@ -5079,6 +5100,11 @@ eventemitter3@^3.0.0:
50795100
resolved "https://registry.yarnpkg.com/eventemitter3/-/eventemitter3-3.1.2.tgz#2d3d48f9c346698fce83a85d7d664e98535df6e7"
50805101
integrity sha512-tvtQIeLVHjDkJYnzf2dgVMxfuSGJeM/7UCG17TT4EumTfNtF+0nebF/4zWOIkCreAbtNqhGEboB6BWrwqNaw4Q==
50815102

5103+
events@3.0.0:
5104+
version "3.0.0"
5105+
resolved "https://registry.yarnpkg.com/events/-/events-3.0.0.tgz#9a0a0dfaf62893d92b875b8f2698ca4114973e88"
5106+
integrity sha512-Dc381HFWJzEOhQ+d8pkNon++bk9h6cdAoAj4iE6Q4y6xgTzySWXlKn05/TVNpjnfRqi/X0EpJEJohPjNI3zpVA==
5107+
50825108
events@^1.0.0:
50835109
version "1.1.1"
50845110
resolved "https://registry.yarnpkg.com/events/-/events-1.1.1.tgz#9ebdb7635ad099c70dcc4c2a1f5004288e8bd924"
@@ -10086,6 +10112,17 @@ react-native-crypto@^2.0.1:
1008610112
pbkdf2 "3.0.8"
1008710113
public-encrypt "^4.0.0"
1008810114

10115+
react-native-dark-mode@^0.0.7:
10116+
version "0.0.7"
10117+
resolved "https://registry.yarnpkg.com/react-native-dark-mode/-/react-native-dark-mode-0.0.7.tgz#dbcf9f9a24f8a1bafb352edd4643bcba6b1747dd"
10118+
integrity sha512-igfiUN9QKHPlQcLvAnwkwqAsKZvicRtRLVUJ01VhKMu5dNruM43TG/WJRCW9coCg3HAnNpRoK9U85QtUDfnc8w==
10119+
dependencies:
10120+
"@types/events" "^3.0.0"
10121+
"@types/react" "^16.8.19"
10122+
"@types/react-native" "^0.57.60"
10123+
events "3.0.0"
10124+
toolkit.ts "0.0.2"
10125+
1008910126
"react-native-hr@git+https://github.com/Riglerr/react-native-hr.git#2d01a5cf77212d100e8b99e0310cce5234f977b3":
1009010127
version "1.1.3"
1009110128
resolved "git+https://github.com/Riglerr/react-native-hr.git#2d01a5cf77212d100e8b99e0310cce5234f977b3"
@@ -11839,6 +11876,11 @@ toidentifier@1.0.0:
1183911876
resolved "https://registry.yarnpkg.com/toidentifier/-/toidentifier-1.0.0.tgz#7e1be3470f1e77948bc43d94a3c8f4d7752ba553"
1184011877
integrity sha512-yaOH/Pk/VEhBWWTlhI+qXxDFXlejDGcQipMlyxda9nthulaxLZUNcUqFxokp0vcYnvteJln5FNQDRrxj3YcbVw==
1184111878

11879+
toolkit.ts@0.0.2:
11880+
version "0.0.2"
11881+
resolved "https://registry.yarnpkg.com/toolkit.ts/-/toolkit.ts-0.0.2.tgz#91bde730e5e6ad1a22146cdaf83f4a52721cf3b2"
11882+
integrity sha512-yJJTVbCwiD6AfFgReewJCGJuODmyZUeL1sDjnxp33t0UBxnezgQrLbz/F9++RC28CTlk5u5pVji4TbeondYEkw==
11883+
1184211884
tough-cookie@^2.3.3, tough-cookie@^2.3.4:
1184311885
version "2.5.0"
1184411886
resolved "https://registry.yarnpkg.com/tough-cookie/-/tough-cookie-2.5.0.tgz#cd9fb2a0aa1d5a12b473bd9fb96fa3dcff65ade2"

0 commit comments

Comments
 (0)