Files
react-native/Examples/UIExplorer/AdSupportIOSExample.js
Alex Kotliarskyi fab5ec617d Updates from Tue Mar 10
- [ReactNative] Make tests run on TravisCI | Alex Kotliarskyi
- [Relay] Update Relay + ES6 class containers | Christoph Pojer
- [React Native] Add RCTAdSupport.xcodeproj | Alexsander Akers
- [ReactNative][Android] Fix after a new React version was downstreamed | Philipp von Weitershausen
- [React Native] Add preliminary animation API | Alex Akers
- [ReactKit] Create test for OSS ReactKit | Alex Kotliarskyi
- [React Native][Device ID][wip] implement most basic js access | Alex Akers
- [ReactNative] OSS Picker | Spencer Ahrens
- [ReactNative] Fix typo in RCTUIManager | Tadeu Zagallo
- [ReactNative] Fix GeoLocation files letter case | Tadeu Zagallo
- Unified the method signature for addUIBlock: to further simplify porting ViewManagers | Nick Lockwood
- [ReactNative] Oss GeoMap | Tadeu Zagallo
- [ReactNative] OSS CameraRoll | Tadeu Zagallo
- [ReactNative] allowLossyConversion on NSString->NSData conversion | Andrew Rasmussen
- [React Native][RFC] Print __DEV__ value on app start | Alex Kotliarskyi
2015-03-10 19:54:10 -07:00

74 lines
1.3 KiB
JavaScript

/**
* Copyright 2004-present Facebook. All Rights Reserved.
*
* @providesModule AdSupportIOSExample
*/
/* eslint no-console: 0 */
'use strict';
var AdSupportIOS = require('AdSupportIOS');
var React = require('react-native');
var {
StyleSheet,
Text,
View,
} = React;
exports.framework = 'React';
exports.title = 'Advertising ID';
exports.description = 'Example of using the ad support API.';
exports.examples = [
{
title: 'Ad Support IOS',
render: function() {
return <AdSupportIOSExample />;
},
}
];
var AdSupportIOSExample = React.createClass({
getInitialState: function() {
return {
deviceID: 'No IDFA yet',
};
},
componentDidMount: function() {
AdSupportIOS.getAdvertisingId(
this._onSuccess,
this._onFailure
);
},
_onSuccess: function(deviceID) {
this.setState({
'deviceID': deviceID,
});
},
_onFailure: function(e) {
this.setState({
'deviceID': 'Error!',
});
},
render: function() {
return (
<View>
<Text>
<Text style={styles.title}>Advertising ID: </Text>
{JSON.stringify(this.state.deviceID)}
</Text>
</View>
);
}
});
var styles = StyleSheet.create({
title: {
fontWeight: 'bold',
},
});