Skip to content
Open
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
13 changes: 4 additions & 9 deletions src/auth/screens/events.screen.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,12 +100,6 @@ class Events extends Component {
this.getUserEvents();
}

componentWillReceiveProps(nextProps) {
if (nextProps.user.login && !this.props.user.login) {
this.getUserEvents(nextProps);
}
}

getUserEvents = ({ user, accessToken } = this.props) => {
this.props.getUserEvents(user.login, { forceRefresh: true });
this.props.getNotificationsCount(accessToken);
Expand Down Expand Up @@ -676,6 +670,7 @@ class Events extends Component {
}
}

export const EventsScreen = connect(mapStateToProps, mapDispatchToProps)(
Events
);
export const EventsScreen = connect(
mapStateToProps,
mapDispatchToProps
)(Events);
24 changes: 14 additions & 10 deletions src/auth/screens/language-setting.screen.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,19 +45,23 @@ class LanguageSettings extends Component {
props: {
locale: string,
changeLocale: () => void,
navigation: object,
};

componentWillReceiveProps(nextState) {
if (nextState.locale !== this.props.locale) {
const navigationParams = NavigationActions.setParams({
params: {
title: t('Language', nextState.locale),
},
key: nextState.navigation.state.key,
});
shouldComponentUpdate(nextProps) {
return nextProps.locale !== this.props.locale;
}

componentDidUpdate() {
const { locale, navigation } = this.props;
const navigationParams = NavigationActions.setParams({
params: {
title: t('Language', locale),
},
key: navigation.state.key,
});

nextState.navigation.dispatch(navigationParams);
}
navigation.dispatch(navigationParams);
}

renderListItem = ({ item }) => {
Expand Down
42 changes: 26 additions & 16 deletions src/auth/screens/user-options.screen.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,15 @@ const updateText = locale => ({
});

class UserOptions extends Component {
static getDerivedStateFromProps(props, state) {
return props.locale !== state.locale
? {
updateText: updateText(props.locale).check,
locale: props.locale,
}
: null;
}

props: {
locale: string,
signOut: () => void,
Expand All @@ -77,24 +86,24 @@ class UserOptions extends Component {

this.state = {
updateText: updateText(props.locale).check,
locale: props.locale,
};
}

componentWillReceiveProps(nextState) {
if (nextState.locale !== this.props.locale) {
this.setState({
updateText: updateText(nextState.locale).check,
});
shouldComponentUpdate(nextProps) {
return nextProps.locale !== this.props.locale;
}

const navigationParams = NavigationActions.setParams({
params: {
title: t('Options', nextState.locale),
},
key: nextState.navigation.state.key,
});
componentDidUpdate() {
const { locale, navigation } = this.props;
const navigationParams = NavigationActions.setParams({
params: {
title: t('Options', locale),
},
key: navigation.state.key,
});

nextState.navigation.dispatch(navigationParams);
}
navigation.dispatch(navigationParams);
}

checkForUpdate = () => {
Expand Down Expand Up @@ -183,6 +192,7 @@ class UserOptions extends Component {
}
}

export const UserOptionsScreen = connect(mapStateToProps, mapDispatchToProps)(
UserOptions
);
export const UserOptionsScreen = connect(
mapStateToProps,
mapDispatchToProps
)(UserOptions);
34 changes: 17 additions & 17 deletions src/notifications/screens/notifications.screen.js
Original file line number Diff line number Diff line change
Expand Up @@ -184,18 +184,18 @@ class Notifications extends Component {
this.getNotifications();
}

componentWillReceiveProps(nextProps) {
componentDidUpdate(prevProps) {
const pendingType = this.getPendingType();

if (
!nextProps.isPendingMarkAllNotificationsAsRead &&
this.props.isPendingMarkAllNotificationsAsRead &&
!this.props.isPendingMarkAllNotificationsAsRead &&
prevProps.isPendingMarkAllNotificationsAsRead &&
!this.isLoading()
) {
this.getNotificationsForCurrentType()();
}

if (!nextProps[pendingType] && this.props[pendingType]) {
if (!this.props[pendingType] && prevProps[pendingType]) {
this.props.getNotificationsCount();
}
}
Expand Down Expand Up @@ -385,16 +385,15 @@ class Notifications extends Component {

return (
<View>
{isFirstItem &&
isFirstTab && (
<MarkAllAsReadButtonContainer>
<Button
icon={{ name: 'check', type: 'octicon' }}
onPress={() => markAllNotificationsAsRead()}
title={t('Mark all as read')}
/>
</MarkAllAsReadButtonContainer>
)}
{isFirstItem && isFirstTab && (
<MarkAllAsReadButtonContainer>
<Button
icon={{ name: 'check', type: 'octicon' }}
onPress={() => markAllNotificationsAsRead()}
title={t('Mark all as read')}
/>
</MarkAllAsReadButtonContainer>
)}

<RepositoryContainer>
<HeaderContainer>
Expand Down Expand Up @@ -504,6 +503,7 @@ class Notifications extends Component {
}
}

export const NotificationsScreen = connect(mapStateToProps, mapDispatchToProps)(
Notifications
);
export const NotificationsScreen = connect(
mapStateToProps,
mapDispatchToProps
)(Notifications);
25 changes: 12 additions & 13 deletions src/organization/screens/organization-profile.screen.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ const LoadingMembersContainer = styled.View`
`;

class OrganizationProfile extends Component {
static getDerivedStateFromProps() {
return { refreshing: false };
}

props: {
org: Object,
orgId: String,
Expand Down Expand Up @@ -68,10 +72,6 @@ class OrganizationProfile extends Component {
getOrgMembers(orgId);
}

componentWillReceiveProps() {
this.setState({ refreshing: false });
}

refresh = () => {
this.setState({ refreshing: true });
const { orgId, getOrgById, getOrgMembers } = this.props;
Expand Down Expand Up @@ -162,15 +162,14 @@ class OrganizationProfile extends Component {
/>
)}

{!!org.description &&
org.description !== '' && (
<SectionList title={t('DESCRIPTION', locale)}>
<DescriptionListItem
subtitle={emojifyText(org.description)}
hideChevron
/>
</SectionList>
)}
{!!org.description && org.description !== '' && (
<SectionList title={t('DESCRIPTION', locale)}>
<DescriptionListItem
subtitle={emojifyText(org.description)}
hideChevron
/>
</SectionList>
)}

{org && (
<EntityInfo entity={org} navigation={navigation} locale={locale} />
Expand Down
2 changes: 1 addition & 1 deletion src/user/screens/starred-repository-list.screen.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class StarredRepositoryList extends Component {
navigation: Object,
};

componentWillMount() {
componentDidMount() {
const { getStarredReposForUser, userId } = this.props;

getStarredReposForUser(userId);
Expand Down