Skip to content

Commit 2b59abe

Browse files
authored
Upgrading to react-native 0.58.6 (#571)
* Changes to work with react-native 0.58.6
1 parent c798cd7 commit 2b59abe

25 files changed

+1278
-676
lines changed

Examples/Button/ButtonApp.js

+8
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,14 @@ import {
88
Text
99
} from 'react-native';
1010

11+
import MessageQueue from 'react-native/Libraries/BatchedBridge/MessageQueue.js';
12+
13+
const spyFunction = (msg) => {
14+
console.log(msg);
15+
};
16+
17+
MessageQueue.spy(spyFunction);
18+
1119

1220
export default class ButtonReactNative extends Component {
1321

Libraries/Components/Button.desktop-qt.js

+61-61
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,8 @@
1010

1111
'use strict';
1212

13-
const ColorPropType = require('ColorPropType');
1413
const Platform = require('Platform');
1514
const React = require('React');
16-
const PropTypes = require('prop-types');
1715
const StyleSheet = require('StyleSheet');
1816
const Text = require('Text');
1917
const TouchableNativeFeedback = require('TouchableNativeFeedback');
@@ -22,6 +20,45 @@ const View = require('View');
2220

2321
const invariant = require('fbjs/lib/invariant');
2422

23+
import type {PressEvent} from 'CoreEventTypes';
24+
25+
type ButtonProps = $ReadOnly<{|
26+
/**
27+
* Text to display inside the button
28+
*/
29+
title: string,
30+
31+
/**
32+
* Handler to be called when the user taps the button
33+
*/
34+
onPress: (event?: PressEvent) => mixed,
35+
36+
/**
37+
* Color of the text (iOS), or background color of the button (Android)
38+
*/
39+
color?: ?string,
40+
41+
/**
42+
* TV preferred focus (see documentation for the View component).
43+
*/
44+
hasTVPreferredFocus?: ?boolean,
45+
46+
/**
47+
* Text to display for blindness accessibility features
48+
*/
49+
accessibilityLabel?: ?string,
50+
51+
/**
52+
* If true, disable all interactions for this component.
53+
*/
54+
disabled?: ?boolean,
55+
56+
/**
57+
* Used to locate this view in end-to-end tests.
58+
*/
59+
testID?: ?string,
60+
|}>;
61+
2562
/**
2663
* A basic button component that should render nicely on any platform. Supports
2764
* a minimal level of customization.
@@ -50,46 +87,7 @@ const invariant = require('fbjs/lib/invariant');
5087
*
5188
*/
5289

53-
class Button extends React.Component<{
54-
title: string,
55-
onPress: () => any,
56-
color?: ?string,
57-
hasTVPreferredFocus?: ?boolean,
58-
accessibilityLabel?: ?string,
59-
disabled?: ?boolean,
60-
testID?: ?string,
61-
}> {
62-
static propTypes = {
63-
/**
64-
* Text to display inside the button
65-
*/
66-
title: PropTypes.string.isRequired,
67-
/**
68-
* Text to display for blindness accessibility features
69-
*/
70-
accessibilityLabel: PropTypes.string,
71-
/**
72-
* Color of the text (iOS), or background color of the button (Android)
73-
*/
74-
color: ColorPropType,
75-
/**
76-
* If true, disable all interactions for this component.
77-
*/
78-
disabled: PropTypes.bool,
79-
/**
80-
* TV preferred focus (see documentation for the View component).
81-
*/
82-
hasTVPreferredFocus: PropTypes.bool,
83-
/**
84-
* Handler to be called when the user taps the button
85-
*/
86-
onPress: PropTypes.func.isRequired,
87-
/**
88-
* Used to locate this view in end-to-end tests.
89-
*/
90-
testID: PropTypes.string,
91-
};
92-
90+
class Button extends React.Component<ButtonProps> {
9391
render() {
9492
const {
9593
accessibilityLabel,
@@ -152,26 +150,28 @@ const styles = StyleSheet.create({
152150
borderRadius: 2,
153151
},
154152
}),
155-
text: Platform.select({
156-
ios: {
157-
// iOS blue from https://developer.apple.com/ios/human-interface-guidelines/visual-design/color/
158-
color: '#007AFF',
159-
textAlign: 'center',
160-
padding: 8,
161-
fontSize: 18,
162-
},
163-
android: {
164-
color: 'white',
165-
textAlign: 'center',
166-
padding: 8,
167-
fontWeight: '500',
153+
text: {
154+
...Platform.select({
155+
ios: {
156+
// iOS blue from https://developer.apple.com/ios/human-interface-guidelines/visual-design/color/
157+
color: '#007AFF',
158+
textAlign: 'center',
159+
padding: 8,
160+
fontSize: 18,
161+
},
162+
android: {
163+
color: 'white',
164+
textAlign: 'center',
165+
padding: 8,
166+
fontWeight: '500',
167+
},
168+
desktop: {
169+
color: '#007AFF',
170+
textAlign: 'center',
171+
fontSize: 14,
168172
},
169-
desktop: {
170-
color: '#007AFF',
171-
textAlign: 'center',
172-
fontSize: 14,
173-
},
174-
}),
173+
}),
174+
},
175175
buttonDisabled: Platform.select({
176176
ios: {},
177177
android: {

Libraries/Components/NativeButton.desktop-qt.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
*/
1111
'use strict';
1212

13-
const ColorPropType = require('ColorPropType');
13+
const ColorPropType = require('DeprecatedColorPropType');
1414
const NativeMethodsMixin = require('NativeMethodsMixin');
1515
const Platform = require('Platform');
1616
const React = require('React');

0 commit comments

Comments
 (0)