Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update react-native dependency to 0.59 #2411

Merged
merged 5 commits into from
Jul 18, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
71 changes: 1 addition & 70 deletions current/Libraries/Alert/Alert.windows.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,7 @@
*/
'use strict';

const AlertIOS = require('AlertIOS');
const NativeModules = require('NativeModules');
const Platform = require('Platform');

import type { AlertType, AlertButtonStyle } from 'AlertIOS';

export type Buttons = Array<{
text?: string,
Expand Down Expand Up @@ -62,72 +58,7 @@ class Alert {
options?: Options,
type?: AlertType,
): void {
if (Platform.OS === 'ios') {
if (typeof type !== 'undefined') {
console.warn('Alert.alert() with a 5th "type" parameter is deprecated and will be removed. Use AlertIOS.prompt() instead.');
AlertIOS.alert(title, message, buttons, type);
return;
}
AlertIOS.alert(title, message, buttons);
} else if (Platform.OS === 'android') {
AlertAndroid.alert(title, message, buttons, options);
} else if (Platform.OS === 'windows') {
AlertWindows.alert(title, message, buttons, options);
}
}
}

/**
* Wrapper around the Android native module.
*/
class AlertAndroid {

static alert(
title: ?string,
message?: ?string,
buttons?: Buttons,
options?: Options,
): void {
var config = {
title: title || '',
message: message || '',
};

if (options) {
config = {...config, cancelable: options.cancelable};
}
// At most three buttons (neutral, negative, positive). Ignore rest.
// The text 'OK' should be probably localized. iOS Alert does that in native.
var validButtons: Buttons = buttons ? buttons.slice(0, 3) : [{text: 'OK'}];
var buttonPositive = validButtons.pop();
var buttonNegative = validButtons.pop();
var buttonNeutral = validButtons.pop();
if (buttonNeutral) {
config = {...config, buttonNeutral: buttonNeutral.text || '' };
}
if (buttonNegative) {
config = {...config, buttonNegative: buttonNegative.text || '' };
}
if (buttonPositive) {
config = {...config, buttonPositive: buttonPositive.text || '' };
}
NativeModules.DialogManagerAndroid.showAlert(
config,
(errorMessage) => console.warn(errorMessage),
(action, buttonKey) => {
if (action === NativeModules.DialogManagerAndroid.buttonClicked) {
if (buttonKey === NativeModules.DialogManagerAndroid.buttonNeutral) {
buttonNeutral.onPress && buttonNeutral.onPress();
} else if (buttonKey === NativeModules.DialogManagerAndroid.buttonNegative) {
buttonNegative.onPress && buttonNegative.onPress();
} else if (buttonKey === NativeModules.DialogManagerAndroid.buttonPositive) {
buttonPositive.onPress && buttonPositive.onPress();
}
} else if (action === NativeModules.DialogManagerAndroid.dismissed) {
options && options.onDismiss && options.onDismiss();
}
}
);
AlertWindows.alert(title, message, buttons, options);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ class FlipViewWindows extends React.Component {
setPage = (selectedPage: number) => {
UIManager.dispatchViewManagerCommand(
ReactNative.findNodeHandle(this),
UIManager.WindowsFlipView.Commands.setPage,
UIManager.getViewManagerConfig('WindowsFlipView').Commands.setPage,
[selectedPage],
);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ FocusableWindowsTemplate.propTypes = Object.assign({}, ViewPropTypes, FocusableW
function createFocusableComponent(Component: any) {
class FocusableWindows extends React.Component {

static keys = UIManager.WindowsControl.Constants.Keys;
static keys = UIManager.getViewManagerConfig('WindowsControl').Constants.Keys;

_focusable: any;
_component: any;
Expand Down Expand Up @@ -300,7 +300,7 @@ function createFocusableComponent(Component: any) {
if (this._focusable) {
UIManager.dispatchViewManagerCommand(
ReactNative.findNodeHandle(this._focusable),
UIManager.WindowsControl.Commands.focus,
UIManager.getViewManagerConfig('WindowsControl').Commands.focus,
null);
}
}
Expand All @@ -309,7 +309,7 @@ function createFocusableComponent(Component: any) {
if (this._focusable) {
UIManager.dispatchViewManagerCommand(
ReactNative.findNodeHandle(this._focusable),
UIManager.WindowsControl.Commands.blur,
UIManager.getViewManagerConfig('WindowsControl').Commands.blur,
null);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ var UIManager = require('UIManager');
var View = require('View');
var ViewPropTypes = require('ViewPropTypes');

var SplitViewConsts = UIManager.WindowsSplitView.Constants;
var SplitViewConsts = UIManager.getViewManagerConfig('WindowsSplitView').Constants;

var createReactClass = require('create-react-class');
var dismissKeyboard = require('dismissKeyboard');
Expand Down Expand Up @@ -182,7 +182,7 @@ var SplitViewWindows = createReactClass({
openPane: function() {
UIManager.dispatchViewManagerCommand(
this._getPaneLayoutHandle(),
UIManager.WindowsSplitView.Commands.openPane,
UIManager.getViewManagerConfig('WindowsSplitView').Commands.openPane,
null
);
},
Expand All @@ -193,7 +193,7 @@ var SplitViewWindows = createReactClass({
closePane: function() {
UIManager.dispatchViewManagerCommand(
this._getPaneLayoutHandle(),
UIManager.WindowsSplitView.Commands.closePane,
UIManager.getViewManagerConfig('WindowsSplitView').Commands.closePane,
null
);
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,13 @@ function focusTextInput(textFieldID: ?number) {
} else if (Platform.OS === 'android') {
UIManager.dispatchViewManagerCommand(
textFieldID,
UIManager.AndroidTextInput.Commands.focusTextInput,
UIManager.getViewManagerConfig('AndroidTextInput').Commands.focusTextInput,
null,
);
} else if (Platform.OS === 'windows') {
UIManager.dispatchViewManagerCommand(
textFieldID,
UIManager.RCTTextBox.Commands.focusTextInput,
UIManager.getViewManagerConfig('RCTTextBox').Commands.focusTextInput,
null
)
}
Expand All @@ -75,13 +75,13 @@ function blurTextInput(textFieldID: ?number) {
} else if (Platform.OS === 'android') {
UIManager.dispatchViewManagerCommand(
textFieldID,
UIManager.AndroidTextInput.Commands.blurTextInput,
UIManager.getViewManagerConfig('AndroidTextInput').Commands.blurTextInput,
null,
);
} else if (Platform.OS === 'windows') {
UIManager.dispatchViewManagerCommand(
textFieldID,
UIManager.RCTTextBox.Commands.blurTextInput,
UIManager.getViewManagerConfig('RCTTextBox').Commands.blurTextInput,
null
);
}
Expand Down
2 changes: 1 addition & 1 deletion current/RNTester
Submodule RNTester updated 126 files
2 changes: 1 addition & 1 deletion current/Yoga
Submodule Yoga updated 445 files
6 changes: 3 additions & 3 deletions current/local-cli/generator-common/index.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
const fs = require('fs');
const chalk = require('chalk');
const path = require('path');
const copyAndReplace = require('react-native-local-cli/util/copyAndReplace');
const walk = require('react-native-local-cli/util/walk');
const prompt = require('react-native-local-cli/generator/promptSync')();
const copyAndReplace = require('@react-native-community/cli/build/tools/copyAndReplace').default;
const walk = require('@react-native-community/cli/build/tools/walk').default;
const prompt = require('@react-native-community/cli/build/tools/generator/promptSync').default();

function createDir(destPath) {
if (!fs.existsSync(destPath)) {
Expand Down
1 change: 1 addition & 0 deletions current/metro.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ const defaultPolyfills = require("react-native/rn-get-polyfills");

var config = {
resolver: {
platforms: [ 'windows' ],
hasteImplModulePath: require.resolve('./jest/hasteImpl'),
},
};
Expand Down
16 changes: 8 additions & 8 deletions current/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@
"README.md"
],
"peerDependencies": {
"react": "16.6.3",
"react-native": "~0.58.0"
"react": "16.8.6",
"react-native": "~0.59.0"
},
"devDependencies": {
"babel-eslint": "9.0.0",
Expand All @@ -42,20 +42,20 @@
"eslint-plugin-flowtype": "2.43.0",
"eslint-plugin-prettier": "2.6.0",
"eslint-plugin-react": "7.8.2",
"flow-bin": "^0.86.0",
"flow-bin": "^0.92.0",
"https-proxy-agent": "^2.2.1",
"jasmine": "^2.6.0",
"jasmine-reporters": "^2.2.1",
"minimist": "^1.2.0",
"prettier": "1.13.6",
"react": "16.6.3",
"react-devtools-core": "^3.4.2",
"react-native": "~0.58.0"
"react": "16.8.6",
"react-devtools-core": "^3.6.0",
"react-native": "~0.59.0"
},
"dependencies": {
"chalk": "^1.1.1",
"chalk": "^2.4.1",
"glob": "^7.1.1",
"react-native-local-cli": "^1.0.0-alpha.5",
"@react-native-community/cli": "^1.2.1",
"shelljs": "^0.7.8",
"username": "^3.0.0",
"uuid": "^2.0.1",
Expand Down