Skip to content

Commit 5a47ea2

Browse files
authored
Merge pull request taskrabbit#31 from taskrabbit/upgrade
Upgrade to react-native 0.33.0
2 parents 8675b89 + 8afcba5 commit 5a47ea2

File tree

9 files changed

+48
-363
lines changed

9 files changed

+48
-363
lines changed

App/Components/SpinnerLoader.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,11 @@ import {
55
PixelRatio,
66
View,
77
PropTypes,
8+
ActivityIndicator,
89
} from 'react-native';
910

1011
import cssVar from '../Lib/cssVar';
1112

12-
import ActivityIndicator from '../Platform/ActivityIndicator';
13-
1413
const SpinnerLoader = React.createClass({
1514
propTypes: {
1615
spinning: React.PropTypes.bool,

App/Mixins/KeyboardListener.js

Lines changed: 33 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
import React from 'react';
2-
import KeyboardEvents from 'react-native-keyboardevents';
3-
var KeyboardEventEmitter = KeyboardEvents.Emitter;
2+
3+
import {
4+
Keyboard,
5+
} from 'react-native';
6+
47

58
var KeyboardListener = {
69
getInitialState: function() {
@@ -13,9 +16,13 @@ var KeyboardListener = {
1316
return this.state.keyboardSpace > 0;
1417
},
1518

16-
updateKeyboardSpace: function(frames) {
17-
if (this.isMounted() && frames && frames.end) {
18-
this.setState({keyboardSpace: frames.end.height});
19+
isKeyboardVisible: function() {
20+
return this.state.keyboardSpace > 0;
21+
},
22+
23+
updateKeyboardSpace: function(e) {
24+
if (this.isMounted() && e && e.endCoordinates) {
25+
this.setState({keyboardSpace: e.endCoordinates.height});
1926
}
2027
},
2128

@@ -25,15 +32,32 @@ var KeyboardListener = {
2532
}
2633
},
2734

35+
// onKeyboardHideCallback: function() {
36+
// // TODO handle case when the keyboard never showed up in the first place
37+
// // Might want to use state to check that it did showed up
38+
// if (this.params.onKeyboardHide) {
39+
// this.params.onKeyboardHide.call(this.originalComponent());
40+
// }
41+
// },
42+
43+
2844
componentDidMount: function() {
29-
KeyboardEventEmitter.on(KeyboardEvents.KeyboardDidShowEvent, this.updateKeyboardSpace);
30-
KeyboardEventEmitter.on(KeyboardEvents.KeyboardWillHideEvent, this.resetKeyboardSpace);
45+
this._keyboardSubscriptions = [];
46+
this._keyboardSubscriptions.push(Keyboard.addListener('keyboardWillShow', this.updateKeyboardSpace));
47+
this._keyboardSubscriptions.push(Keyboard.addListener('keyboardDidShow', this.updateKeyboardSpace));
48+
this._keyboardSubscriptions.push(Keyboard.addListener('keyboardWillHide', this.resetKeyboardSpace));
49+
this._keyboardSubscriptions.push(Keyboard.addListener('keyboardDidHide', this.resetKeyboardSpace));
50+
//if (this.params.onKeyboardHide) {
51+
// this._keyboardSubscriptions.push(Keyboard.addListener('keyboardDidHide', this.onKeyboardHideCallback));
52+
//}
3153
},
3254

3355
componentWillUnmount: function() {
34-
KeyboardEventEmitter.off(KeyboardEvents.KeyboardDidShowEvent, this.updateKeyboardSpace);
35-
KeyboardEventEmitter.off(KeyboardEvents.KeyboardWillHideEvent, this.resetKeyboardSpace);
56+
this._keyboardSubscriptions.forEach((subscription) => {
57+
subscription.remove();
58+
});
3659
},
60+
3761
};
3862

3963
export default KeyboardListener;

App/Platform/ActivityIndicator.js

Lines changed: 0 additions & 8 deletions
This file was deleted.

App/Stores/CurrentUserStore.js

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,11 +66,17 @@ var SingletonStore = assign({}, EventEmitter.prototype, {
6666
Dispatcher.register(function(action) {
6767
switch(action.actionType) {
6868
case AppConstants.APP_LAUNCHED:
69-
Keychain.getGenericPassword(KEYCHAIN_SERVICE, function(keychainError, username, token) {
70-
LocalKeyStore.getKey(LOCAL_STORE_KEY, function(storeError, props) {
71-
initSingleton(props, token, username);
69+
Keychain.getGenericPassword(KEYCHAIN_SERVICE).then((values) => {
70+
const { username, password } = values || {};
71+
// password is the stored token.
72+
LocalKeyStore.getKey(LOCAL_STORE_KEY, (storeError, props) => {
73+
initSingleton(props, password, username);
7274
SingletonStore.emitChange();
7375
});
76+
}).catch((error) => {
77+
console.log(error);
78+
initSingleton({}, null, null);
79+
SingletonStore.emitChange();
7480
});
7581
break;
7682
case AppConstants.LOGIN_USER:

App/Vendor/react-native-refreshable-listview/README.md

Lines changed: 0 additions & 213 deletions
This file was deleted.

App/Vendor/react-native-refreshable-listview/example/renderHeaderWrapper.js

Lines changed: 0 additions & 22 deletions
This file was deleted.

App/Vendor/react-native-refreshable-listview/lib/RefreshingIndicator.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import React, {
77
import {
88
View,
99
Text,
10-
ActivityIndicatorIOS,
10+
ActivityIndicator,
1111
StyleSheet,
1212
} from 'react-native';
1313

@@ -19,7 +19,7 @@ var RefreshingIndicator = React.createClass({
1919
},
2020
getDefaultProps() {
2121
return {
22-
activityIndicatorComponent: ActivityIndicatorIOS,
22+
activityIndicatorComponent: ActivityIndicator,
2323
}
2424
},
2525
renderActivityIndicator(style) {

0 commit comments

Comments
 (0)