Jats1596
Jats1596

Reputation: 1215

DeepLinking in iOS react native

Hi how can I redirect to youtube using deepLinking in iOS ? I got a warning telling me : Unable to open URL. Here is the code :

class ChaineYT extends React.Component {

  state = {
    isLoading:false,
    isLinked: false
  }

  componentDidMount = () => {
      Linking.openURL('vnd.youtube://' + 'www.youtube.com/channel/UC1UpcbyFVTZTDrvdjNmSzSg');
      this.setState({isLoading:true, isLinked:true});
        if(this.state.isLoading && this.state.isLinking){
        this.props.navigation.navigate('Acceuil')
      }
  }

  render() {
    return (
      <View>

      </View>
    )
  }
}

export default ChaineYT

Upvotes: 0

Views: 78

Answers (1)

Zeeshan Ansari
Zeeshan Ansari

Reputation: 10858

Try to use

Linking.openURL('http://www.youtube.com/channel/UC1UpcbyFVTZTDrvdjNmSzSg');

For more information

https://developer.apple.com/library/archive/featuredarticles/iPhoneURLScheme_Reference/YouTubeLinks/YouTubeLinks.html#//apple_ref/doc/uid/TP40007899-CH8-SW1

Upvotes: 1

Related Questions