/react-native-FBInStream

Facebook InStream Ads for React Native

Primary LanguageObjective-C

Facebook InStream Ads

Installation

1. Install Javascript packages.

$ yarn add react-native-facebook-instream-ads

Link to your project

$ react-native link react-native-facebook-instream-ads

2. Downloading and linking the native Facebook SDK for iOS

Follow all the steps in the Getting Started Guide for Facebook SDK and Getting Started Guide for Facebook Audience for iOS.

Usage

import { InStreamView } from 'react-native-facebook-instream-ads'
export default class Example extends Component {

  handleSuccess = () => {
    //Handle when Ads loaded
  }

  handleError = () => {
    //Handle when Ads had err
  }

  render() {
    return (
      <View style={styles.container}>
        <InStreamView
          style={{"Your-own-style"}} //Optional.
          placementId={"your-placement-id"} //Required.
          onAdDone={() => this.handleSuccess()} //Required.
          onAdError={() => this.handleError()} //Required.
        />
      </View>
    );
  }
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    justifyContent: 'center',
    alignItems: 'center',
    backgroundColor: '#F5FCFF',
  },
  welcome: {
    fontSize: 20,
    textAlign: 'center',
    margin: 10,
  },
  instructions: {
    textAlign: 'center',
    color: '#333333',
    marginBottom: 5,
  },
});

TODO

  • iOS
  • Android