UNPKG

airbridge-react-native-sdk

Version:

Airbridge SDK for React Native

65 lines (55 loc) 1.91 kB
import React, { Component } from 'react' import { View, NativeModules } from 'react-native' import { storage } from '../common/Storage' import { Styles } from '../common/Styles' import VerticalPreference from '../component/VerticalPreference'; export default class InstallReferrerPage extends Component { constructor(props) { super(props); this.state = { attributeResult: storage.get('attributeResult'), }; this.addRef = React.createRef() this.removeRef = React.createRef() this.fetch() } fetch = async () => { const response = await NativeModules.InstallReferrerInteractor.installReferrer() console.log('response : ' + response) const jsonData = JSON.parse(response) const data = jsonData['data'] const NA = 'N/A' this.setState({ google: data['google'] ?? NA, oneStore: data['oneStore'] ?? NA, huawei: data['huawei'] ?? NA, galaxyStore: data['galaxyStore'] ?? NA, }) } render() { return ( <View style={Styles.container}> <VerticalPreference title='Google install referrer' text={this.state.google} accessibilityLabel={'googleInstallReferrer'} /> <VerticalPreference title='ONE Store install referrer' text={this.state.oneStore} accessibilityLabel={'oneStoreInstallReferrer'} /> <VerticalPreference title='Huawei install referrer' text={this.state.huawei} accessibilityLabel={'huaweiInstallReferrer'} /> <VerticalPreference title='Galaxy Store install referrer' text={this.state.galaxyStore} accessibilityLabel={'galaxyStoreInstallReferrer'} /> <VerticalPreference title='Attributed touch point' text={this.state.attributeResult} accessibilityLabel={'attributedTouchPoint'} /> </View> ) } }