1- import React , { Component } from 'react'
2- import { StyleSheet , Text , TextInput , TouchableHighlight , View } from 'react-native'
3- import { WebView } from 'react-native-webview'
1+ import React , { Component } from 'react' ;
2+ import { StyleSheet , Text , TextInput , TouchableHighlight , View } from 'react-native' ;
3+ import { WebView } from 'react-native-webview' ;
44
5- import branch , { BranchEvent } from 'react-native-branch'
5+ import branch , { BranchEvent } from 'react-native-branch' ;
66
77const styles = StyleSheet . create ( {
88 container : {
@@ -29,53 +29,53 @@ const styles = StyleSheet.create({
2929 fontWeight : 'bold' ,
3030 textAlign : 'center' ,
3131 } ,
32- } )
32+ } ) ;
3333
3434export default class App extends Component {
35- _unsubscribeFromBranch = null
36- buo = null
35+ _unsubscribeFromBranch = null ;
36+ buo = null ;
3737
3838 constructor ( props ) {
39- super ( props )
40- this . state = { text : 'https://branch.io' , url : 'https://branch.io' }
39+ super ( props ) ;
40+ this . state = { text : 'https://branch.io' , url : 'https://branch.io' } ;
4141 }
4242
4343 componentDidMount ( ) {
4444 this . _unsubscribeFromBranch = branch . subscribe ( ( { error, params } ) => {
4545 if ( error ) {
46- console . error ( "Error from Branch: " + error )
47- return
46+ console . error ( "Error from Branch: " + error ) ;
47+ return ;
4848 }
4949
50- console . log ( "Branch params: " + JSON . stringify ( params ) )
50+ console . log ( "Branch params: " + JSON . stringify ( params ) ) ;
5151
5252 if ( ! params [ '+clicked_branch_link' ] ) {
5353 if ( ! ! params [ '+non_branch_link' ] ) {
54- this . setState ( { url : params [ '+non_branch_link' ] , title : params [ '+non_branch_link' ] } )
54+ this . setState ( { url : params [ '+non_branch_link' ] , title : params [ '+non_branch_link' ] } ) ;
5555 }
56- return
56+ return ;
5757 }
5858
5959 // Get title and url for route
60- let title = params . $og_title
61- let url = params . $canonical_url
62- let image = params . $og_image_url
60+ let title = params . $og_title ;
61+ let url = params . $canonical_url ;
62+ let image = params . $og_image_url ;
6363
6464 // Now reload the webview
65- this . setState ( { url : url , title : title , image : image } )
65+ this . setState ( { url : url , title : title , image : image } ) ;
6666 } ) ;
6767 this . registerView ( ) ;
6868 }
6969
7070 componentWillUnmount ( ) {
7171 if ( this . _unsubscribeFromBranch ) {
72- this . _unsubscribeFromBranch ( )
73- this . _unsubscribeFromBranch = null
72+ this . _unsubscribeFromBranch ( ) ;
73+ this . _unsubscribeFromBranch = null ;
7474 }
7575
7676 if ( this . buo ) {
77- this . buo . release ( )
78- this . buo = null
77+ this . buo . release ( ) ;
78+ this . buo = null ;
7979 }
8080 }
8181
@@ -105,25 +105,24 @@ export default class App extends Component {
105105 </ Text >
106106 </ TouchableHighlight >
107107 </ View >
108- )
108+ ) ;
109109 }
110110
111111 editingEnded ( ) {
112- // branch.openURL(this.state.text)
113- branch . openURL ( this . state . text , { newActivity : true } )
112+ branch . openURL ( this . state . text ) ;
114113 }
115114
116115 async registerView ( ) {
117- if ( this . buo ) this . buo . release ( )
118- if ( this . state . url === '' ) return
116+ if ( this . buo ) this . buo . release ( ) ;
117+ if ( this . state . url === '' ) return ;
119118
120119 this . buo = await branch . createBranchUniversalObject ( "url/" + this . state . url , {
121120 canonicalUrl : this . state . url ,
122121 title : this . state . title ,
123- contentImageUrl : this . state . image
124- } )
125- this . buo . logEvent ( BranchEvent . ViewItem )
126- console . log ( "Created Branch Universal Object and logged standard view item event." )
122+ contentImageUrl : this . state . image ,
123+ } ) ;
124+ this . buo . logEvent ( BranchEvent . ViewItem ) ;
125+ console . log ( "Created Branch Universal Object and logged standard view item event." ) ;
127126 }
128127
129128 async onShare ( ) {
0 commit comments