Workaround for RN 0.54 on iOS (#246)

This commit is contained in:
Diego Mello 2018-03-06 14:40:44 -03:00 committed by GitHub
parent 872532251b
commit fcf55d259f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 27 additions and 34 deletions

View File

@ -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;

View File

@ -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 (
<TouchableOpacity

View File

@ -42,6 +42,10 @@ export default class EmojiPicker extends Component {
componentDidMount() {
requestAnimationFrame(() => 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);

View File

@ -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());
}

View File

@ -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());
}

View File

@ -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 });
}

View File

@ -57,7 +57,7 @@ export default class MentionedMessagesView extends React.PureComponent {
};
}
componentWillMount() {
componentDidMount() {
this.props.navigation.setParams({
onPressToogleStatus: this.onPressToogleStatus,
allUsers: this.state.allUsers