Skip to content

Commit aae3de5

Browse files
committed
port StudentOrgsDetailView to new communication methods
1 parent e503e35 commit aae3de5

File tree

2 files changed

+9
-14
lines changed

2 files changed

+9
-14
lines changed

source/views/student-orgs/detail.android.js

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ import {Card} from '../components/card'
66
import * as c from '../components/colors'
77
import type {StudentOrgType} from './types'
88
import type {TopLevelViewPropsType} from '../types'
9-
import {email} from 'react-native-communications'
10-
import openUrl from '../components/open-url'
9+
import {sendEmail} from '../components/send-email'
10+
import {openUrl} from '../components/open-url'
1111
import {cleanOrg, showNameOrEmail} from './util'
1212

1313
const styles = StyleSheet.create({
@@ -66,12 +66,6 @@ export class StudentOrgsDetailView extends React.PureComponent<Props> {
6666
}
6767
}
6868

69-
// Using the Communications library because `mailTo` complains about
70-
// the lack of an available Activity...
71-
openEmail = (to: string, org: string) => {
72-
email([to], null, null, org, '')
73-
}
74-
7569
render() {
7670
const {
7771
name: orgName,
@@ -113,7 +107,7 @@ export class StudentOrgsDetailView extends React.PureComponent<Props> {
113107
{contacts.map((c, i) => (
114108
<Text
115109
key={i}
116-
onPress={() => this.openEmail(c.email, orgName)}
110+
onPress={() => sendEmail({to: [c.email], subject: orgName})}
117111
selectable={true}
118112
style={styles.cardBody}
119113
>
@@ -132,7 +126,7 @@ export class StudentOrgsDetailView extends React.PureComponent<Props> {
132126
{advisors.map((c, i) => (
133127
<Text
134128
key={i}
135-
onPress={() => this.openEmail(c.email, orgName)}
129+
onPress={() => sendEmail({to: [c.email], subject: orgName})}
136130
selectable={true}
137131
style={styles.cardBody}
138132
>

source/views/student-orgs/detail.ios.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
// @flow
22
import * as React from 'react'
3-
import {ScrollView, Text, View, StyleSheet, Linking} from 'react-native'
3+
import {ScrollView, Text, View, StyleSheet} from 'react-native'
44
import moment from 'moment'
55
import {Cell, Section, TableView} from 'react-native-tableview-simple'
66
import * as c from '../components/colors'
77
import type {StudentOrgType} from './types'
88
import type {TopLevelViewPropsType} from '../types'
9-
import openUrl from '../components/open-url'
9+
import {openUrl} from '../components/open-url'
10+
import {sendEmail} from '../components/send-email'
1011
import {cleanOrg, showNameOrEmail} from './util'
1112

1213
const styles = StyleSheet.create({
@@ -114,7 +115,7 @@ export class StudentOrgsDetailView extends React.PureComponent<Props> {
114115
accessory="DisclosureIndicator"
115116
cellStyle={c.title ? 'Subtitle' : 'Basic'}
116117
detail={c.title}
117-
onPress={() => Linking.openURL(`mailto:${c.email}`)}
118+
onPress={() => sendEmail({to: [c.email], subject: orgName})}
118119
title={showNameOrEmail(c)}
119120
/>
120121
))}
@@ -128,7 +129,7 @@ export class StudentOrgsDetailView extends React.PureComponent<Props> {
128129
key={i}
129130
accessory="DisclosureIndicator"
130131
cellStyle="Basic"
131-
onPress={() => Linking.openURL(`mailto:${c.email}`)}
132+
onPress={() => sendEmail({to: [c.email], subject: orgName})}
132133
title={c.name}
133134
/>
134135
))}

0 commit comments

Comments
 (0)