diff --git a/app/animations/fade.js b/app/animations/fade.js index b9657e494..97693d03a 100644 --- a/app/animations/fade.js +++ b/app/animations/fade.js @@ -17,6 +17,7 @@ export default class Fade extends React.Component { this.state = { visible: props.visible }; + this._visibility = new Animated.Value(this.props.visible ? 1 : 0); } componentWillReceiveProps(nextProps) { @@ -32,10 +33,6 @@ export default class Fade extends React.Component { }); } - UNSAFE_componentWillMount() { - this._visibility = new Animated.Value(this.props.visible ? 1 : 0); - } - render() { const { style, children, ...rest } = this.props; diff --git a/app/containers/EmojiPicker/EmojiCategory.js b/app/containers/EmojiPicker/EmojiCategory.js index 5643e0570..3e3823ba8 100644 --- a/app/containers/EmojiPicker/EmojiCategory.js +++ b/app/containers/EmojiPicker/EmojiCategory.js @@ -36,17 +36,13 @@ export default class EmojiCategory extends React.Component { const { width, height } = this.props.window; this.size = Math.min(this.props.width || width, height) / (this.props.emojisPerRow || emojisPerRow); - this.emojis = []; + this.emojis = props.emojis; } shouldComponentUpdate() { return false; } - UNSAFE_componentWillMount() { - this.emojis = this.props.emojis; - } - renderItem(emoji, size) { return ( this.setState({ show: true })); + this.frequentlyUsed.addListener(this.updateFrequentlyUsed); + this.customEmojis.addListener(this.updateCustomEmojis); + this.updateFrequentlyUsed(); + this.updateCustomEmojis(); } componentWillUnmount() { this.frequentlyUsed.removeAllListeners(); @@ -64,13 +68,6 @@ export default class EmojiPicker extends Component { } } - UNSAFE_componentWillMount() { - this.frequentlyUsed.addListener(this.updateFrequentlyUsed); - this.customEmojis.addListener(this.updateCustomEmojis); - this.updateFrequentlyUsed(); - this.updateCustomEmojis(); - } - _addFrequentlyUsed = (emoji) => { database.write(() => { database.create('frequentlyUsedEmoji', emoji, true); diff --git a/app/containers/Sidebar.js b/app/containers/Sidebar.js index 186a0af32..66538af5a 100644 --- a/app/containers/Sidebar.js +++ b/app/containers/Sidebar.js @@ -52,6 +52,16 @@ export default class Sidebar extends Component { gotoAddServer: PropTypes.func.isRequired } + constructor(props) { + super(props); + this.state = { servers: [] }; + } + + componentDidMount() { + database.databases.serversDB.addListener('change', this.updateState); + this.setState(this.getState()); + } + componentWillUnmount() { database.databases.serversDB.removeListener('change', this.updateState); } @@ -72,11 +82,6 @@ export default class Sidebar extends Component { servers: database.databases.serversDB.objects('servers') }) - UNSAFE_componentWillMount() { - database.databases.serversDB.addListener('change', this.updateState); - this.setState(this.getState()); - } - updateState = () => { this.setState(this.getState()); } diff --git a/app/views/ListServerView.js b/app/views/ListServerView.js index 423e967c8..7b4c2905d 100644 --- a/app/views/ListServerView.js +++ b/app/views/ListServerView.js @@ -88,6 +88,12 @@ export default class ListServerView extends React.Component { this.data.addListener(this.updateState); } + componentDidMount() { + zeroconf.on('update', this.updateState); + zeroconf.scan('http', 'tcp', 'local.'); + this.setState(this.getState()); + } + componentDidUpdate() { if (this.props.connected && this.props.server && @@ -140,14 +146,6 @@ export default class ListServerView extends React.Component { }; }; - UNSAFE_componentWillMount() { - zeroconf.on('update', this.updateState); - - zeroconf.scan('http', 'tcp', 'local.'); - - this.setState(this.getState()); - } - updateState = () => { this.setState(this.getState()); } diff --git a/app/views/LoginView.js b/app/views/LoginView.js index 523378794..d1647cfff 100644 --- a/app/views/LoginView.js +++ b/app/views/LoginView.js @@ -70,6 +70,10 @@ export default class LoginView extends React.Component { this.redirectRegex = new RegExp(`(?=.*(${ this.props.server }))(?=.*(credentialToken))(?=.*(credentialSecret))`, 'g'); } + componentDidMount() { + this.props.open(); + } + componentWillReceiveProps(nextProps) { if (this.props.services !== nextProps.services) { LayoutAnimation.easeInEaseOut(); @@ -150,10 +154,6 @@ export default class LoginView extends React.Component { return Base64.encodeURI(JSON.stringify({ loginStyle: 'popup', credentialToken, isCordova: true })); } - UNSAFE_componentWillMount() { - this.props.open(); - } - openOAuth = (oAuthUrl) => { this.setState({ oAuthUrl, modalVisible: true }); } diff --git a/app/views/RoomMembersView/index.js b/app/views/RoomMembersView/index.js index a3d8d6f04..321864f68 100644 --- a/app/views/RoomMembersView/index.js +++ b/app/views/RoomMembersView/index.js @@ -57,7 +57,7 @@ export default class MentionedMessagesView extends React.PureComponent { }; } - componentWillMount() { + componentDidMount() { this.props.navigation.setParams({ onPressToogleStatus: this.onPressToogleStatus, allUsers: this.state.allUsers