-
Notifications
You must be signed in to change notification settings - Fork 5
/
LeagueOptions.js
49 lines (45 loc) · 1.3 KB
/
LeagueOptions.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
import React from "react";
import * as Amplitude from 'expo-analytics-amplitude';
import { withNavigation } from "react-navigation";
import HeaderDropdown from "../base/HeaderDropdown";
import RemoveLeagueMutation from "../graphql/RemoveLeagueMutation";
class LeagueOptions extends React.PureComponent {
_shareLeague = () => {
const { leagueId, leagueTitle } = this.props;
Amplitude.logEventWithProperties("OpenShareLeague", {
leagueId
});
this.props.navigation.navigate("ShareLeague", {
leagueId,
leagueTitle
});
};
render() {
return (
<RemoveLeagueMutation leagueId={this.props.leagueId}>
{({ removeLeagueHandler }) => (
<HeaderDropdown
options={[
{
label: "Share League",
onSelect: () => {
this._shareLeague();
}
},
{
label: "Delete League",
onSelect: async () => {
const removed = await removeLeagueHandler();
if (removed) {
this.props.navigation.goBack();
}
}
}
]}
/>
)}
</RemoveLeagueMutation>
);
}
}
export default withNavigation(LeagueOptions);