$ yarn add react-native-facebook-instream-ads
Link to your project
$ react-native link react-native-facebook-instream-ads
Follow all the steps in the Getting Started Guide for Facebook SDK and Getting Started Guide for Facebook Audience for iOS.
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,
},
});
- iOS
- Android