Comments (2)
Hello @ilya-bmi We added some fixes for banner view behaviour in the latest release (v2.10.3). Also I would like to recommend you use AppodealBanner
Integration sample with react-navigation
/* eslint-disable react-native/no-inline-styles */
/**
* Sample React Native App
* https://github.com/facebook/react-native
*
* Generated with the TypeScript template
* https://github.com/react-native-community/react-native-template-typescript
*
* @format
*/
import React from 'react';
import {
Appodeal,
AppodealAdType,
AppodealBanner,
AppodealLogLevel,
} from 'react-native-appodeal';
import {useNavigation} from '@react-navigation/native';
import {StackNavigationProp} from '@react-navigation/stack';
import {NavigationContainer} from '@react-navigation/native';
import {createStackNavigator} from '@react-navigation/stack';
import {Button, Text, View} from 'react-native';
import {Switch} from 'react-native-gesture-handler';
Appodeal.setTesting(true);
Appodeal.setLogLevel(AppodealLogLevel.VERBOSE);
Appodeal.initialize(
'fee50c333ff3825fd6ad6d38cff78154de3025546d47a84f',
AppodealAdType.BANNER,
false,
);
type RootStackParamList = {
Home: undefined;
Details: undefined;
};
type Props = StackNavigationProp<RootStackParamList>;
const Banner = () => {
return (
<AppodealBanner
style={{
height: 50,
width: '100%',
backgroundColor: 'clear',
alignContent: 'stretch',
}}
adSize="phone"
usesSmartSizing
/>
);
};
const Spacer = () => <View style={{flex: 1}} />;
const Home = () => {
const navigation = useNavigation<Props>();
return (
<View
style={{
flex: 1,
alignItems: 'center',
justifyContent: 'center',
}}>
<Button
title="Go to detail"
onPress={() => navigation.navigate('Details')}
/>
<Spacer />
<Banner />
</View>
);
};
const Details = () => {
const navigation = useNavigation<Props>();
const [isBannerVisible, setBannerVisible] = React.useState(false);
React.useEffect(() => {
const updateBannerVisibility = () => setBannerVisible(true);
navigation.addListener('transitionEnd', updateBannerVisibility);
return () => {
navigation.removeListener('transitionEnd', updateBannerVisibility);
};
}, [navigation]);
return (
<View
// eslint-disable-next-line react-native/no-inline-styles
style={{
flex: 1,
alignItems: 'center',
justifyContent: 'center',
}}>
<Text>Details</Text>
<Spacer />
{isBannerVisible ? <Banner /> : null}
</View>
);
};
const App = () => {
const Stack = createStackNavigator<RootStackParamList>();
return (
<NavigationContainer>
<Stack.Navigator>
<Stack.Screen name="Home" component={Home} />
<Stack.Screen name="Details" component={Details} />
</Stack.Navigator>
</NavigationContainer>
);
};
export default App;
from react-native-appodeal.
Closed due to inactivity
from react-native-appodeal.
Related Issues (20)
- Reason of onAdFailedToLoad? HOT 1
- artifactory: Received status code 401 from server: Unauthorized HOT 2
- Not using Admob still facing issue with native android build. HOT 2
- Could not find any version that matches com.appodeal.ads:sdk:3.0.2.+. HOT 4
- Using WebView from more than one process at once with the same data directory is not supported.
- App crashes when navigate back from a screen shown INTERSTITIAL/REWARDED_VIDEO to a screen has BannerAds HOT 1
- CocoaPods could not find compatible versions for pod "StackModules" HOT 2
- TypeError: Cannot read property 'initializeWithAppKey' of null HOT 2
- SDK issues on Google Play HOT 1
- Android: NullPointerException on app start HOT 1
- Gradle Build Error - Unable to Resolve Dependency for Appodeal SDK HOT 3
- Error "pod install" on CocoaPods 1.11.1 HOT 1
- TypeError: null is not an object (evaluating 'RNAppodeal.initialize') HOT 6
- Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
- consent manager is missing HOT 1
- Expo Integration with new Development Builds HOT 1
- Ads are not displayed HOT 1
- i cannot find the 'network_security_config.xml file' in the android folder of my project HOT 1
- Getting Error " ERROR TypeError: null is not an object (evaluating 'RNAppodeal.initializeWithAppKey') " in my terminal
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-native-appodeal.