LoginSignup
8
4

More than 3 years have passed since last update.

React NativeでLINEアプリを起動

Last updated at Posted at 2021-05-12

React NativeでLINEアプリを起動するには、URLスキームを利用すれば簡単だった。
(てっきりUniversal Linkの設定するかと思っていた)

テキストメッセージを送る例

<Button
  onPress={() => {
    const text = 'シェアする内容'
    const url = `https://line.me/R/share?text=${text}`
    Linking.canOpenURL(url)
      .then(supported => {
        if (supported) {
          return Linking.openURL(url)
        }
      })
      .catch(err => console.error('URLを開けませんでした。', err))
  }}
  title="シェアする"
/>

挙動

Android iOS
Screenshot_20210512-191538.png IMG_2359.PNG
8
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
8
4