1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-03-26 21:12:59 +02:00

Mobile: Trying to upgrade to React Native 0.55

This commit is contained in:
Laurent Cozic 2018-04-30 17:38:19 +01:00
parent e90abf3517
commit 93966b0fa1
24 changed files with 3120 additions and 1639 deletions

View File

@ -10,7 +10,7 @@ class Dropdown extends React.Component {
this.headerRef_ = null;
}
componentWillMount() {
UNSAFE_componentWillMount() {
this.setState({
headerSize: { x: 0, y: 0, width: 0, height: 0 },
listVisible: false,

View File

@ -34,7 +34,7 @@ class ItemList extends React.Component {
});
}
componentWillMount() {
UNSAFE_componentWillMount() {
this.setState({
topItemIndex: 0,
bottomItemIndex: 0,
@ -45,7 +45,7 @@ class ItemList extends React.Component {
this.updateStateItemIndexes();
}
componentWillReceiveProps(newProps) {
UNSAFE_componentWillReceiveProps(newProps) {
if (newProps.itemHeight) {
this.setState({
itemHeight: newProps.itemHeight,

View File

@ -26,7 +26,7 @@ class ActionButtonComponent extends React.Component {
};
}
componentWillReceiveProps(newProps) {
UNSAFE_componentWillReceiveProps(newProps) {
if ('buttonIndex' in newProps) {
this.setState({ buttonIndex: newProps.buttonIndex });
}

View File

@ -16,7 +16,7 @@ class AppNavComponent extends Component {
}
}
componentWillMount() {
UNSAFE_componentWillMount() {
if (Platform.OS === 'ios') {
this.keyboardDidShowListener = Keyboard.addListener('keyboardDidShow', this.keyboardDidShow.bind(this));
this.keyboardDidHideListener = Keyboard.addListener('keyboardDidHide', this.keyboardDidHide.bind(this));

View File

@ -19,11 +19,11 @@ class Checkbox extends Component {
}
}
componentWillMount() {
UNSAFE_componentWillMount() {
this.setState({ checked: this.props.checked });
}
componentWillReceiveProps(newProps) {
UNSAFE_componentWillReceiveProps(newProps) {
if ('checked' in newProps) {
this.setState({ checked: newProps.checked });
}

View File

@ -18,7 +18,7 @@ class NoteBodyViewer extends Component {
this.isMounted_ = false;
}
componentWillMount() {
UNSAFE_componentWillMount() {
this.mdToHtml_ = new MdToHtml({ supportsResourceLinks: false });
this.isMounted_ = true;
}

View File

@ -68,12 +68,12 @@ class NoteListComponent extends Component {
return output;
}
componentWillMount() {
UNSAFE_componentWillMount() {
const newDataSource = this.state.dataSource.cloneWithRows(this.filterNotes(this.props.items));
this.setState({ dataSource: newDataSource });
}
componentWillReceiveProps(newProps) {
UNSAFE_componentWillReceiveProps(newProps) {
// https://stackoverflow.com/questions/38186114/react-native-redux-and-listview
this.setState({
dataSource: this.state.dataSource.cloneWithRows(this.filterNotes(newProps.items)),

View File

@ -96,7 +96,7 @@ class NoteTagsDialogComponent extends React.Component {
}
}
componentWillMount() {
UNSAFE_componentWillMount() {
const noteId = this.props.noteId;
this.setState({ noteId: noteId });
this.loadNoteTags(noteId);

View File

@ -31,7 +31,7 @@ class ConfigScreenComponent extends BaseScreenComponent {
};
}
componentWillMount() {
UNSAFE_componentWillMount() {
this.setState({ settings: this.props.settings });
}

View File

@ -23,7 +23,7 @@ class DropboxLoginScreenComponent extends BaseScreenComponent {
);
}
componentWillMount() {
UNSAFE_componentWillMount() {
this.shared_.refreshUrl();
}

View File

@ -48,11 +48,11 @@ class EncryptionConfigScreenComponent extends BaseScreenComponent {
return shared.refreshStats(this);
}
componentWillMount() {
UNSAFE_componentWillMount() {
this.initState(this.props);
}
componentWillReceiveProps(nextProps) {
UNSAFE_componentWillReceiveProps(nextProps) {
this.initState(nextProps);
}

View File

@ -43,7 +43,7 @@ class FolderScreenComponent extends BaseScreenComponent {
return this.styles_[this.props.theme];
}
componentWillMount() {
UNSAFE_componentWillMount() {
if (!this.props.folderId) {
const folder = Folder.new();
this.setState({

View File

@ -61,7 +61,7 @@ class LogScreenComponent extends BaseScreenComponent {
return this.styles_[this.props.theme];
}
componentWillMount() {
UNSAFE_componentWillMount() {
this.resfreshLogEntries();
}

View File

@ -160,7 +160,7 @@ class NoteScreenComponent extends BaseScreenComponent {
return shared.isModified(this);
}
async componentWillMount() {
async UNSAFE_componentWillMount() {
BackButtonService.addHandler(this.backHandler);
NavService.addHandler(this.navHandler);

View File

@ -64,7 +64,7 @@ class NotesScreenComponent extends BaseScreenComponent {
await this.refreshNotes();
}
async componentWillReceiveProps(newProps) {
async UNSAFE_componentWillReceiveProps(newProps) {
if (newProps.notesOrder !== this.props.notesOrder ||
newProps.selectedFolderId != this.props.selectedFolderId ||
newProps.selectedTagId != this.props.selectedTagId ||

View File

@ -21,7 +21,7 @@ class OneDriveLoginScreenComponent extends BaseScreenComponent {
this.authCode_ = null;
}
componentWillMount() {
UNSAFE_componentWillMount() {
this.setState({
webviewUrl: this.startUrl(),
});

View File

@ -70,7 +70,7 @@ class SearchScreenComponent extends BaseScreenComponent {
this.isMounted_ = false;
}
componentWillReceiveProps(newProps) {
UNSAFE_componentWillReceiveProps(newProps) {
let newState = {};
if ('query' in newProps) newState.query = newProps.query;

View File

@ -34,7 +34,7 @@ class StatusScreenComponent extends BaseScreenComponent {
};
}
componentWillMount() {
UNSAFE_componentWillMount() {
this.resfreshScreen();
}

View File

@ -25,7 +25,7 @@ class TagScreenComponent extends BaseScreenComponent {
this.refreshNotes();
}
componentWillReceiveProps(newProps) {
UNSAFE_componentWillReceiveProps(newProps) {
if (newProps.selectedTagId !== this.props.selectedTagId) {
this.refreshNotes(newProps);
}

View File

@ -14,7 +14,7 @@ class SelectDateTimeDialog extends Component {
this.state = { date: null };
}
componentWillReceiveProps(newProps) {
UNSAFE_componentWillReceiveProps(newProps) {
if (newProps.date != this.state.date) {
this.setState({ date: newProps.date });
}

View File

@ -6,6 +6,14 @@
// So there's basically still a one way flux: React => SQLite => Redux => React
// To disable warnings internal to React Native for componentWillMount and
// componentWillReceiveProps. Should be fixed at some point and at that
// time this code could be removed.
// https://github.com/facebook/react-native/issues/18165#issuecomment-369907978
require("ReactFeatureFlags").warnAboutDeprecatedLifecycles = false;
const { AppRegistry } = require('react-native');
const { Root } = require('./root.js');

File diff suppressed because it is too large Load Diff

View File

@ -24,7 +24,7 @@
"prop-types": "^15.6.0",
"query-string": "4.3.4",
"react": "16.0.0-beta.5",
"react-native": "0.49.0",
"react-native": "0.55.0",
"react-native-action-button": "^2.6.9",
"react-native-datepicker": "^1.6.0",
"react-native-dialogbox": "^0.6.6",
@ -43,8 +43,8 @@
"react-native-sqlite-storage": "3.3.*",
"react-native-vector-icons": "^4.4.2",
"react-navigation": "^1.0.0-beta.21",
"react-redux": "4.4.8",
"redux": "3.6.0",
"react-redux": "5.0.7",
"redux": "4.0.0",
"stream": "0.0.2",
"string-natural-compare": "^2.0.2",
"timers": "^0.1.1",

View File

@ -535,7 +535,7 @@ class AppComponent extends React.Component {
return false;
}
componentWillReceiveProps(newProps) {
UNSAFE_componentWillReceiveProps(newProps) {
if (newProps.syncStarted != this.lastSyncStarted_) {
if (!newProps.syncStarted) FoldersScreenUtils.refreshFolders();
this.lastSyncStarted_ = newProps.syncStarted;