Skip to content

Commit bc3b852

Browse files
committed
chore: Bump RN to 0.62
We only bump to 0.62 because react-native-macos isn't 0.63 yet. To simplify our lives, we stay in sync to avoid any potential issues from having both 0.62 and 0.63 installed.
1 parent afdb129 commit bc3b852

File tree

5 files changed

+2043
-2121
lines changed

5 files changed

+2043
-2121
lines changed

example/examples/GetSetClear.js

Lines changed: 41 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -8,72 +8,61 @@
88
* @flow
99
*/
1010

11-
import React, {Component} from 'react';
11+
import React from 'react';
1212
import {StyleSheet, Text, View, Button} from 'react-native';
1313

1414
import AsyncStorage from '@react-native-async-storage/async-storage';
1515

1616
type Props = {};
17-
type State = {
18-
storedNumber: string,
19-
needRestart: boolean,
20-
};
21-
export default class GetSet extends Component<Props, State> {
22-
state = {
23-
storedNumber: '',
24-
needRestart: false,
25-
};
2617

27-
async componentWillMount() {
28-
const storedNumber = await AsyncStorage.getItem(STORAGE_KEY);
29-
if (storedNumber) {
30-
this.setState({
31-
storedNumber,
32-
});
33-
}
34-
}
18+
export default function GetSet(_: Props) {
19+
const [storedNumber, setStoredNumber] = React.useState('');
20+
const [needsRestart, setNeedsRestart] = React.useState(false);
3521

36-
increaseByTen = async () => {
37-
const {storedNumber} = this.state;
22+
React.useEffect(() => {
23+
AsyncStorage.getItem(STORAGE_KEY).then((storedNumber) => {
24+
if (storedNumber) {
25+
setStoredNumber(storedNumber);
26+
}
27+
});
28+
}, []);
3829

30+
const increaseByTen = React.useCallback(async () => {
3931
const newNumber = +storedNumber > 0 ? +storedNumber + 10 : 10;
4032

4133
await AsyncStorage.setItem(STORAGE_KEY, `${newNumber}`);
4234

43-
this.setState({storedNumber: `${newNumber}`, needRestart: true});
44-
};
35+
setStoredNumber(`${newNumber}`);
36+
setNeedsRestart(true);
37+
}, [setNeedsRestart, setStoredNumber, storedNumber]);
4538

46-
clearItem = async () => {
39+
const clearItem = React.useCallback(async () => {
4740
await AsyncStorage.removeItem(STORAGE_KEY);
48-
49-
this.setState({needRestart: true});
50-
};
51-
52-
render() {
53-
const {storedNumber, needRestart} = this.state;
54-
return (
55-
<View>
56-
<Text style={styles.text}>Currently stored: </Text>
57-
<Text testID="storedNumber_text" style={styles.text}>
58-
{storedNumber}
59-
</Text>
60-
61-
<Button
62-
testID="increaseByTen_button"
63-
title="Increase by 10"
64-
onPress={this.increaseByTen}
65-
/>
66-
67-
<Button
68-
testID="clear_button"
69-
title="Clear item"
70-
onPress={this.clearItem}
71-
/>
72-
73-
{needRestart ? <Text>Hit restart to see effect</Text> : null}
74-
</View>
75-
);
76-
}
41+
setNeedsRestart(true);
42+
}, [setNeedsRestart]);
43+
44+
return (
45+
<View>
46+
<Text style={styles.text}>Currently stored: </Text>
47+
<Text testID="storedNumber_text" style={styles.text}>
48+
{storedNumber}
49+
</Text>
50+
51+
<Button
52+
testID="increaseByTen_button"
53+
title="Increase by 10"
54+
onPress={increaseByTen}
55+
/>
56+
57+
<Button
58+
testID="clear_button"
59+
title="Clear item"
60+
onPress={clearItem}
61+
/>
62+
63+
{needsRestart ? <Text>Hit restart to see effect</Text> : null}
64+
</View>
65+
);
7766
}
7867

7968
const styles = StyleSheet.create({

example/ios/Podfile

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
source 'https://cdn.cocoapods.org/'
2-
platform :ios, '9.0'
2+
platform :ios, '12.0'
33
require_relative '../../node_modules/@react-native-community/cli-platform-ios/native_modules'
44

55
target 'AsyncStorageExample' do
6-
# Pods for AsyncStorageExample
7-
pod 'RNCAsyncStorage', :path => "../.."
86
pod 'FBLazyVector', :path => "../../node_modules/react-native/Libraries/FBLazyVector"
97
pod 'FBReactNativeSpec', :path => "../../node_modules/react-native/Libraries/FBReactNativeSpec"
108
pod 'RCTRequired', :path => "../../node_modules/react-native/Libraries/RCTRequired"
@@ -28,13 +26,15 @@ target 'AsyncStorageExample' do
2826
pod 'React-jsi', :path => '../../node_modules/react-native/ReactCommon/jsi'
2927
pod 'React-jsiexecutor', :path => '../../node_modules/react-native/ReactCommon/jsiexecutor'
3028
pod 'React-jsinspector', :path => '../../node_modules/react-native/ReactCommon/jsinspector'
31-
pod 'ReactCommon/jscallinvoker', :path => "../../node_modules/react-native/ReactCommon"
29+
pod 'ReactCommon/callinvoker', :path => "../../node_modules/react-native/ReactCommon"
3230
pod 'ReactCommon/turbomodule/core', :path => "../../node_modules/react-native/ReactCommon"
33-
pod 'Yoga', :path => '../../node_modules/react-native/ReactCommon/yoga'
31+
pod 'Yoga', :path => '../../node_modules/react-native/ReactCommon/yoga', :modular_headers => true
3432

3533
pod 'DoubleConversion', :podspec => '../../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec'
3634
pod 'glog', :podspec => '../../node_modules/react-native/third-party-podspecs/glog.podspec'
3735
pod 'Folly', :podspec => '../../node_modules/react-native/third-party-podspecs/Folly.podspec'
3836

37+
pod 'RNCAsyncStorage', :path => "../.."
38+
3939
use_native_modules!
40-
end
40+
end

package.json

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -64,26 +64,25 @@
6464
"@babel/core": "^7.6.2",
6565
"@babel/runtime": "^7.6.2",
6666
"@react-native-community/bob": "^0.14.0",
67-
"@react-native-community/cli": "^3.1.0",
68-
"@react-native-community/cli-platform-android": "^3.1.0",
69-
"@react-native-community/cli-platform-ios": "^3.1.0",
70-
"@react-native-community/eslint-config": "^0.0.5",
67+
"@react-native-community/cli": "^4.5.1",
68+
"@react-native-community/cli-platform-android": "^4.5.1",
69+
"@react-native-community/cli-platform-ios": "^4.5.0",
7170
"babel-jest": "^26.5.2",
7271
"babel-plugin-module-resolver": "3.1.3",
7372
"detox": "16.7.2",
7473
"eslint": "5.1.0",
75-
"expo": "36.0.2",
74+
"expo": "^38.0.10",
7675
"flow-bin": "0.105.2",
7776
"jest": "^26.5.3",
7877
"metro": "0.56.4",
79-
"metro-react-native-babel-preset": "^0.56.0",
80-
"react": "16.9.0",
81-
"react-dom": "16.9.0",
82-
"react-native": "0.61.5",
83-
"react-native-macos": "0.60.0-microsoft.50",
78+
"metro-react-native-babel-preset": "^0.58.0",
79+
"react": "16.11.0",
80+
"react-dom": "16.11.0",
81+
"react-native": "0.62.2",
82+
"react-native-macos": "0.62.16",
8483
"react-native-web": "~0.12.0",
85-
"react-native-windows": "0.61.0",
86-
"react-test-renderer": "16.9.0"
84+
"react-native-windows": "0.62.13",
85+
"react-test-renderer": "16.11.0"
8786
},
8887
"jest": {
8988
"preset": "react-native",

react-native.config.js

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@
55
* https://github.com/react-native-community/discussions-and-proposals/issues/182
66
*
77
* The work-around involves having a metro.config.js for each out-of-tree
8-
* platform, i.e. metro.config.js for react-native and
8+
* platform, i.e. metro.config.js for react-native and
99
* metro.config.macos.js for react-native-macos.
1010
* This react-native.config.js looks for a --use-react-native-macos
11-
* switch and when present pushes --config=metro.config.macos.js
11+
* switch and when present pushes --config=metro.config.macos.js
1212
* and specifies reactNativePath: 'node_modules/react-native-macos'.
13-
* The metro.config.js has to blacklist 'node_modules/react-native-macos',
13+
* The metro.config.js has to blacklist 'node_modules/react-native-macos',
1414
* and conversely metro.config.macos.js has to blacklist 'node_modules/react-native'.
1515
*/
1616
'use strict';
@@ -31,3 +31,17 @@ if (process.argv.includes(macSwitch)) {
3131
reactNativePath: 'node_modules/react-native-windows',
3232
};
3333
}
34+
35+
module.exports = {
36+
dependencies: {
37+
"@react-native-community/bob": {
38+
// Suppress warnings about bob not being a proper native module
39+
platforms: {
40+
android: null,
41+
ios: null,
42+
macos: null,
43+
windows: null,
44+
},
45+
},
46+
},
47+
};

0 commit comments

Comments
 (0)