Skip to content

Commit 218753a

Browse files
committed
chore(dep): replace deprecated RN AsyncStorage/WebView
1 parent 979e764 commit 218753a

File tree

13 files changed

+71
-11
lines changed

13 files changed

+71
-11
lines changed

android/app/build.gradle

+2
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,8 @@ android {
148148
}
149149

150150
dependencies {
151+
implementation project(':react-native-webview')
152+
implementation project(':@react-native-community_async-storage')
151153
compile project(':react-native-svg')
152154
compile project(':react-native-vector-icons')
153155
compile project(':react-native-linear-gradient')

android/app/src/main/java/com/gitpoint/MainApplication.java

+4
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
import android.app.Application;
44

55
import com.facebook.react.ReactApplication;
6+
import com.reactnativecommunity.webview.RNCWebViewPackage;
7+
import com.reactnativecommunity.asyncstorage.AsyncStoragePackage;
68
import com.horcrux.svg.SvgPackage;
79
import com.BV.LinearGradient.LinearGradientPackage;
810
import com.psykar.cookiemanager.CookieManagerPackage;
@@ -38,6 +40,8 @@ public boolean getUseDeveloperSupport() {
3840
protected List<ReactPackage> getPackages() {
3941
return Arrays.<ReactPackage>asList(
4042
new MainReactPackage(),
43+
new RNCWebViewPackage(),
44+
new AsyncStoragePackage(),
4145
new SvgPackage(),
4246
new LinearGradientPackage(),
4347
new CookieManagerPackage(),

android/settings.gradle

+4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
rootProject.name = 'GitPoint'
2+
include ':react-native-webview'
3+
project(':react-native-webview').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-webview/android')
4+
include ':@react-native-community_async-storage'
5+
project(':@react-native-community_async-storage').projectDir = new File(rootProject.projectDir, '../node_modules/@react-native-community/async-storage/android')
26
include ':react-native-svg'
37
project(':react-native-svg').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-svg/android')
48
include ':react-native-linear-gradient'

ios/GitPoint.xcodeproj/project.pbxproj

+34-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
};
66
objectVersion = 46;
77
objects = {
8-
98
/* Begin PBXBuildFile section */
109
00C302E51ABCBA2D00DB3ED1 /* libRCTActionSheet.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302AC1ABCB8CE00DB3ED1 /* libRCTActionSheet.a */; };
1110
00C302E71ABCBA2D00DB3ED1 /* libRCTGeolocation.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302BA1ABCB90400DB3ED1 /* libRCTGeolocation.a */; };
@@ -67,6 +66,8 @@
6766
DC5C35E71E37AD1800F3F526 /* FontAwesome.ttf in Resources */ = {isa = PBXBuildFile; fileRef = DC5C35DD1E37AD1800F3F526 /* FontAwesome.ttf */; };
6867
EB0F176BE52B4561B9FF07AB /* libReactNativeConfig.a in Frameworks */ = {isa = PBXBuildFile; fileRef = D7043BDB577E427391ECFBB0 /* libReactNativeConfig.a */; };
6968
F16AF5D05B394C8C832C7E68 /* Feather.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 5B85AC9D921B42D4BDF35CC7 /* Feather.ttf */; };
69+
52AF08BFDBB141A08110475A /* libRNCAsyncStorage.a in Frameworks */ = {isa = PBXBuildFile; fileRef = E0C4D7095AD24919AD979CB8 /* libRNCAsyncStorage.a */; };
70+
34CAF34980E142918AAAB802 /* libRNCWebView.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 1A0357426E304B6AA98645B8 /* libRNCWebView.a */; };
7071
/* End PBXBuildFile section */
7172

7273
/* Begin PBXContainerItemProxy section */
@@ -528,6 +529,10 @@
528529
EE0605281E45441288EA9435 /* RNDeviceInfo.xcodeproj */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = "wrapper.pb-project"; name = RNDeviceInfo.xcodeproj; path = "../node_modules/react-native-device-info/RNDeviceInfo.xcodeproj"; sourceTree = "<group>"; };
529530
F8897F92D0984B73821678B1 /* Foundation.ttf */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = unknown; name = Foundation.ttf; path = "../node_modules/react-native-vector-icons/Fonts/Foundation.ttf"; sourceTree = "<group>"; };
530531
FBD0F4CBD299403498005E08 /* Nunito-SemiBold.ttf */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = unknown; name = "Nunito-SemiBold.ttf"; path = "../src/assets/fonts/Nunito-SemiBold.ttf"; sourceTree = "<group>"; };
532+
6389F544B2B64B5BB176E2A4 /* RNCAsyncStorage.xcodeproj */ = {isa = PBXFileReference; name = "RNCAsyncStorage.xcodeproj"; path = "../node_modules/@react-native-community/async-storage/ios/RNCAsyncStorage.xcodeproj"; sourceTree = "<group>"; fileEncoding = undefined; lastKnownFileType = wrapper.pb-project; explicitFileType = undefined; includeInIndex = 0; };
533+
E0C4D7095AD24919AD979CB8 /* libRNCAsyncStorage.a */ = {isa = PBXFileReference; name = "libRNCAsyncStorage.a"; path = "libRNCAsyncStorage.a"; sourceTree = "<group>"; fileEncoding = undefined; lastKnownFileType = archive.ar; explicitFileType = undefined; includeInIndex = 0; };
534+
26B720B887404BDC8D51E8EB /* RNCWebView.xcodeproj */ = {isa = PBXFileReference; name = "RNCWebView.xcodeproj"; path = "../node_modules/react-native-webview/ios/RNCWebView.xcodeproj"; sourceTree = "<group>"; fileEncoding = undefined; lastKnownFileType = wrapper.pb-project; explicitFileType = undefined; includeInIndex = 0; };
535+
1A0357426E304B6AA98645B8 /* libRNCWebView.a */ = {isa = PBXFileReference; name = "libRNCWebView.a"; path = "libRNCWebView.a"; sourceTree = "<group>"; fileEncoding = undefined; lastKnownFileType = archive.ar; explicitFileType = undefined; includeInIndex = 0; };
531536
/* End PBXFileReference section */
532537

533538
/* Begin PBXFrameworksBuildPhase section */
@@ -568,6 +573,8 @@
568573
24D143B2F7E8472D9E2CE7EF /* libBVLinearGradient.a in Frameworks */,
569574
16DAE21EEC0A42F882FDCC46 /* libLRDRCTSimpleToast.a in Frameworks */,
570575
D96DE03CB0A04CA4B3FCFFBA /* libRNSVG.a in Frameworks */,
576+
52AF08BFDBB141A08110475A /* libRNCAsyncStorage.a in Frameworks */,
577+
34CAF34980E142918AAAB802 /* libRNCWebView.a in Frameworks */,
571578
);
572579
runOnlyForDeploymentPostprocessing = 0;
573580
};
@@ -876,6 +883,8 @@
876883
292314143C1743648A44C564 /* BVLinearGradient.xcodeproj */,
877884
AEAB9C270A9F45B0A2617DC8 /* LRDRCTSimpleToast.xcodeproj */,
878885
35BE07ABB46146DEAA9C1627 /* RNSVG.xcodeproj */,
886+
6389F544B2B64B5BB176E2A4 /* RNCAsyncStorage.xcodeproj */,
887+
26B720B887404BDC8D51E8EB /* RNCWebView.xcodeproj */,
879888
);
880889
name = Libraries;
881890
sourceTree = "<group>";
@@ -1711,6 +1720,8 @@
17111720
"$(SRCROOT)/../node_modules/react-native-linear-gradient/BVLinearGradient",
17121721
"$(SRCROOT)/../node_modules/react-native-simple-toast/ios/LRDRCTSimpleToast",
17131722
"$(SRCROOT)/../node_modules/react-native-svg/ios/**",
1723+
"$(SRCROOT)/../node_modules/@react-native-community/async-storage/ios",
1724+
"$(SRCROOT)/../node_modules/react-native-webview/ios",
17141725
);
17151726
INFOPLIST_FILE = GitPointTests/Info.plist;
17161727
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
@@ -1723,6 +1734,8 @@
17231734
"\"$(SRCROOT)/$(TARGET_NAME)\"",
17241735
"\"$(SRCROOT)/$(TARGET_NAME)\"",
17251736
"\"$(SRCROOT)/$(TARGET_NAME)\"",
1737+
"\"$(SRCROOT)/$(TARGET_NAME)\"",
1738+
"\"$(SRCROOT)/$(TARGET_NAME)\"",
17261739
);
17271740
OTHER_LDFLAGS = (
17281741
"-ObjC",
@@ -1753,6 +1766,8 @@
17531766
"$(SRCROOT)/../node_modules/react-native-linear-gradient/BVLinearGradient",
17541767
"$(SRCROOT)/../node_modules/react-native-simple-toast/ios/LRDRCTSimpleToast",
17551768
"$(SRCROOT)/../node_modules/react-native-svg/ios/**",
1769+
"$(SRCROOT)/../node_modules/@react-native-community/async-storage/ios",
1770+
"$(SRCROOT)/../node_modules/react-native-webview/ios",
17561771
);
17571772
INFOPLIST_FILE = GitPointTests/Info.plist;
17581773
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
@@ -1765,6 +1780,8 @@
17651780
"\"$(SRCROOT)/$(TARGET_NAME)\"",
17661781
"\"$(SRCROOT)/$(TARGET_NAME)\"",
17671782
"\"$(SRCROOT)/$(TARGET_NAME)\"",
1783+
"\"$(SRCROOT)/$(TARGET_NAME)\"",
1784+
"\"$(SRCROOT)/$(TARGET_NAME)\"",
17681785
);
17691786
OTHER_LDFLAGS = (
17701787
"-ObjC",
@@ -1800,6 +1817,8 @@
18001817
"$(SRCROOT)/../node_modules/react-native-linear-gradient/BVLinearGradient",
18011818
"$(SRCROOT)/../node_modules/react-native-simple-toast/ios/LRDRCTSimpleToast",
18021819
"$(SRCROOT)/../node_modules/react-native-svg/ios/**",
1820+
"$(SRCROOT)/../node_modules/@react-native-community/async-storage/ios",
1821+
"$(SRCROOT)/../node_modules/react-native-webview/ios",
18031822
);
18041823
INFOPLIST_FILE = GitPoint/Info.plist;
18051824
INFOPLIST_OTHER_PREPROCESSOR_FLAGS = "-traditional";
@@ -1844,6 +1863,8 @@
18441863
"$(SRCROOT)/../node_modules/react-native-linear-gradient/BVLinearGradient",
18451864
"$(SRCROOT)/../node_modules/react-native-simple-toast/ios/LRDRCTSimpleToast",
18461865
"$(SRCROOT)/../node_modules/react-native-svg/ios/**",
1866+
"$(SRCROOT)/../node_modules/@react-native-community/async-storage/ios",
1867+
"$(SRCROOT)/../node_modules/react-native-webview/ios",
18471868
);
18481869
INFOPLIST_FILE = GitPoint/Info.plist;
18491870
INFOPLIST_OTHER_PREPROCESSOR_FLAGS = "-traditional";
@@ -1889,6 +1910,8 @@
18891910
"$(SRCROOT)/../node_modules/react-native-linear-gradient/BVLinearGradient",
18901911
"$(SRCROOT)/../node_modules/react-native-simple-toast/ios/LRDRCTSimpleToast",
18911912
"$(SRCROOT)/../node_modules/react-native-svg/ios/**",
1913+
"$(SRCROOT)/../node_modules/@react-native-community/async-storage/ios",
1914+
"$(SRCROOT)/../node_modules/react-native-webview/ios",
18921915
);
18931916
INFOPLIST_FILE = "GitPoint-tvOS/Info.plist";
18941917
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
@@ -1900,6 +1923,8 @@
19001923
"\"$(SRCROOT)/$(TARGET_NAME)\"",
19011924
"\"$(SRCROOT)/$(TARGET_NAME)\"",
19021925
"\"$(SRCROOT)/$(TARGET_NAME)\"",
1926+
"\"$(SRCROOT)/$(TARGET_NAME)\"",
1927+
"\"$(SRCROOT)/$(TARGET_NAME)\"",
19031928
);
19041929
OTHER_LDFLAGS = (
19051930
"-ObjC",
@@ -1939,6 +1964,8 @@
19391964
"$(SRCROOT)/../node_modules/react-native-linear-gradient/BVLinearGradient",
19401965
"$(SRCROOT)/../node_modules/react-native-simple-toast/ios/LRDRCTSimpleToast",
19411966
"$(SRCROOT)/../node_modules/react-native-svg/ios/**",
1967+
"$(SRCROOT)/../node_modules/@react-native-community/async-storage/ios",
1968+
"$(SRCROOT)/../node_modules/react-native-webview/ios",
19421969
);
19431970
INFOPLIST_FILE = "GitPoint-tvOS/Info.plist";
19441971
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
@@ -1950,6 +1977,8 @@
19501977
"\"$(SRCROOT)/$(TARGET_NAME)\"",
19511978
"\"$(SRCROOT)/$(TARGET_NAME)\"",
19521979
"\"$(SRCROOT)/$(TARGET_NAME)\"",
1980+
"\"$(SRCROOT)/$(TARGET_NAME)\"",
1981+
"\"$(SRCROOT)/$(TARGET_NAME)\"",
19531982
);
19541983
OTHER_LDFLAGS = (
19551984
"-ObjC",
@@ -1984,6 +2013,8 @@
19842013
"\"$(SRCROOT)/$(TARGET_NAME)\"",
19852014
"\"$(SRCROOT)/$(TARGET_NAME)\"",
19862015
"\"$(SRCROOT)/$(TARGET_NAME)\"",
2016+
"\"$(SRCROOT)/$(TARGET_NAME)\"",
2017+
"\"$(SRCROOT)/$(TARGET_NAME)\"",
19872018
);
19882019
PRODUCT_BUNDLE_IDENTIFIER = "com.facebook.REACT.GitPoint-tvOSTests";
19892020
PRODUCT_NAME = "$(TARGET_NAME)";
@@ -2014,6 +2045,8 @@
20142045
"\"$(SRCROOT)/$(TARGET_NAME)\"",
20152046
"\"$(SRCROOT)/$(TARGET_NAME)\"",
20162047
"\"$(SRCROOT)/$(TARGET_NAME)\"",
2048+
"\"$(SRCROOT)/$(TARGET_NAME)\"",
2049+
"\"$(SRCROOT)/$(TARGET_NAME)\"",
20172050
);
20182051
PRODUCT_BUNDLE_IDENTIFIER = "com.facebook.REACT.GitPoint-tvOSTests";
20192052
PRODUCT_NAME = "$(TARGET_NAME)";

ios/GitPoint/AppDelegate.m

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ - (NSURL *)sourceURLForBridge:(RCTBridge *)bridge
4444
#if DEBUG
4545
return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil];
4646
#else
47-
return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
47+
return [CodePush bundleURL];
4848
#endif
4949
}
5050

ios/GitPoint/Info.plist

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
</dict>
5252
</dict>
5353
<key>NSLocationWhenInUseUsageDescription</key>
54-
<string></string>
54+
<string/>
5555
<key>UIAppFonts</key>
5656
<array>
5757
<string>FontAwesome.ttf</string>

package.json

+2
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@
5353
]
5454
},
5555
"dependencies": {
56+
"@react-native-community/async-storage": "^1.5.0",
5657
"date-fns": "^1.29.0",
5758
"entities": "^1.1.1",
5859
"fuzzysort": "^1.0.1",
@@ -89,6 +90,7 @@
8990
"react-native-syntax-highlighter": "^1.2.1",
9091
"react-native-table-component": "^1.1.0",
9192
"react-native-vector-icons": "^4.4.0",
93+
"react-native-webview": "^5.12.1",
9294
"react-navigation": "^1.0.0",
9395
"react-redux": "^5.0.2",
9496
"react-syntax-highlighter": "^5.6.2",

root.store.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { persistReducer, persistStore } from 'redux-persist';
33
import createEncryptor from 'redux-persist-transform-encrypt';
44
import md5 from 'md5';
55
import DeviceInfo from 'react-native-device-info';
6-
import storage from 'redux-persist/lib/storage';
6+
import AsyncStorage from '@react-native-community/async-storage';
77
import Reactotron from 'reactotron-react-native'; // eslint-disable-line import/no-extraneous-dependencies
88
import createLogger from 'redux-logger';
99
import reduxThunk from 'redux-thunk';
@@ -16,7 +16,7 @@ const encryptor = createEncryptor({
1616
});
1717
const persistConfig = {
1818
key: 'root',
19-
storage,
19+
storage: AsyncStorage,
2020
transforms: [encryptor],
2121
whitelist: ['auth'],
2222
};

src/auth/auth.action.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { AsyncStorage } from 'react-native';
1+
import AsyncStorage from '@react-native-community/async-storage';
22

33
import { uniqBy } from 'lodash';
44
import { delay, configureLocale, saveLocale } from 'utils';

src/auth/screens/login.screen.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
import React, { Component } from 'react';
33
import { connect } from 'react-redux';
44
import { bindActionCreators } from 'redux';
5-
import { ActivityIndicator, Linking, WebView, Platform } from 'react-native';
5+
import { ActivityIndicator, Linking, Platform } from 'react-native';
6+
import { WebView } from 'react-native-webview';
67
import { Button, Icon } from 'react-native-elements';
78
import Swiper from 'react-native-swiper';
89
import queryString from 'query-string';

src/components/markdown-webview.component.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import React, { Component } from 'react';
2-
import { WebView, Platform } from 'react-native';
2+
import { Platform } from 'react-native';
3+
import { WebView } from 'react-native-webview';
34
import githubStyle from './github-style';
45

56
export class MarkdownWebView extends Component {

src/utils/localization-helper.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React from 'react';
2-
import { AsyncStorage } from 'react-native';
2+
import AsyncStorage from '@react-native-community/async-storage';
33
import distanceInWords from 'date-fns/distance_in_words';
44

55
import { common } from 'config';

yarn.lock

+15-2
Original file line numberDiff line numberDiff line change
@@ -1048,6 +1048,11 @@
10481048
mkdirp "^0.5.1"
10491049
rimraf "^2.5.2"
10501050

1051+
"@react-native-community/async-storage@^1.5.0":
1052+
version "1.5.0"
1053+
resolved "https://registry.yarnpkg.com/@react-native-community/async-storage/download/@react-native-community/async-storage-1.5.0.tgz#647ffcd832272068b0be57332e08d73036ed391f"
1054+
integrity sha1-ZH/82DInIGiwvlczLgjXMDbtOR8=
1055+
10511056
"@react-native-community/cli@^1.2.1":
10521057
version "1.9.10"
10531058
resolved "https://registry.yarnpkg.com/@react-native-community/cli/-/cli-1.9.10.tgz#6494e604fae3fd5993571a31bd16f0af751d56b4"
@@ -3952,7 +3957,7 @@ escape-html@~1.0.3:
39523957
resolved "https://registry.yarnpkg.com/escape-html/-/escape-html-1.0.3.tgz#0258eae4d3d0c0974de1c169188ef0051d1d1988"
39533958
integrity sha1-Aljq5NPQwJdN4cFpGI7wBR0dGYg=
39543959

3955-
escape-string-regexp@^1.0.0, escape-string-regexp@^1.0.2, escape-string-regexp@^1.0.5:
3960+
escape-string-regexp@1.0.5, escape-string-regexp@^1.0.0, escape-string-regexp@^1.0.2, escape-string-regexp@^1.0.5:
39563961
version "1.0.5"
39573962
resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4"
39583963
integrity sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=
@@ -5595,7 +5600,7 @@ inquirer@^6.2.2:
55955600
strip-ansi "^5.1.0"
55965601
through "^2.3.6"
55975602

5598-
invariant@^2.0.0, invariant@^2.1.0, invariant@^2.2.0, invariant@^2.2.1, invariant@^2.2.2, invariant@^2.2.4:
5603+
invariant@2.2.4, invariant@^2.0.0, invariant@^2.1.0, invariant@^2.2.0, invariant@^2.2.1, invariant@^2.2.2, invariant@^2.2.4:
55995604
version "2.2.4"
56005605
resolved "https://registry.yarnpkg.com/invariant/-/invariant-2.2.4.tgz#610f3c92c9359ce1db616e538008d23ff35158e6"
56015606
integrity sha512-phJfQVBuaJM5raOpJjSfkiD6BpbCE4Ns//LaXl6wGYtUBY83nWS6Rf9tXm2e8VaK60JEjYldbPif/A2B1C2gNA==
@@ -9338,6 +9343,14 @@ react-native-vector-icons@^4.2.0, react-native-vector-icons@^4.4.0:
93389343
prop-types "^15.5.10"
93399344
yargs "^8.0.2"
93409345

9346+
react-native-webview@^5.12.1:
9347+
version "5.12.1"
9348+
resolved "https://registry.yarnpkg.com/react-native-webview/download/react-native-webview-5.12.1.tgz#5e2b124e9087d64fc40040d911c10ee5744b5d4d"
9349+
integrity sha1-XisSTpCH1k/EAEDZEcEO5XRLXU0=
9350+
dependencies:
9351+
escape-string-regexp "1.0.5"
9352+
invariant "2.2.4"
9353+
93419354
93429355
version "0.59.9"
93439356
resolved "https://registry.yarnpkg.com/react-native/-/react-native-0.59.9.tgz#c94ee4fa35121720c05235a2dd6cdd2784bf5177"

0 commit comments

Comments
 (0)