2017-04-12 98 views

回答

1

你想要的东西绑定到MFMessageComposeViewController,在GitHub上有一个包叫做React Native Message Composer,它声称它做到了,但似乎不再被主动维护。

0

这在iOS上不可行。 (See reference。)

要打开另一个应用程序,请使用Linking API

你可以在Android上做你想要的东西,并且在iOS上至少打开短信应用程序,并为选定的收件人打开空白文本。

import {Linking, Platform} from 'react-native'

...

const url = (Platform.OS === 'android') 
    ? 'sms:1-408-555-1212?body=yourMessage' 
    : 'sms:1-408-555-1212' 

Linking.canOpenURL(url).then(supported => { 
    if (!supported) { 
    console.log('Unsupported url: ' + url) 
    } else { 
    return Linking.openURL(url) 
    } 
}).catch(err => console.error('An error occurred', err)) 
相关问题