Skip to content

Commit

Permalink
update example
Browse files Browse the repository at this point in the history
  • Loading branch information
ammarahm-ed committed Jun 27, 2023
1 parent 4254a2e commit 9b58d22
Show file tree
Hide file tree
Showing 17 changed files with 379 additions and 274 deletions.
1 change: 0 additions & 1 deletion android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ dependencies {
implementation 'com.facebook.react:react-native:+'
implementation "com.google.android.gms:play-services-ads:${safeExtGet('googlePlayServicesAdsVersion', '20.+')}"
implementation 'com.android.support:support-annotations:28.0.0'
implementation 'com.google.ads.mediation:facebook:6.+'
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'com.android.support.constraint:constraint-layout:2.0.4'
}
3 changes: 3 additions & 0 deletions example/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
module.exports = {
root: true,
extends: '@react-native-community',
rules: {
'react-native/no-inline-styles': 'off',
},
};
52 changes: 18 additions & 34 deletions example/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,7 @@ const App = () => {
width: '100%',
paddingTop: Platform.OS === 'android' ? StatusBar.currentHeight : 0,
backgroundColor: 'white',
}}
>
}}>
<StatusBar
translucent
backgroundColor="transparent"
Expand All @@ -56,11 +55,10 @@ const App = () => {
flexDirection: 'row',
alignItems: 'center',
height: 50,
paddingHorizontal: 12,
paddingHorizontal: 6,
marginBottom: 10,
width: '100%',
}}
>
}}>
{currentRoute && (
<TouchableOpacity
onPress={() => setCurrentRoute(null)}
Expand All @@ -71,9 +69,8 @@ const App = () => {
height: 50,
justifyContent: 'center',
borderRadius: 100,
}}
>
<Icon name="arrow-left" size={28} />
}}>
<Icon name="arrow-left" color="black" size={28} />
</TouchableOpacity>
)}
</View>
Expand All @@ -82,14 +79,12 @@ const App = () => {
<View
style={{
alignItems: 'center',
}}
>
}}>
<View
style={{
alignItems: 'center',
marginBottom: 50,
}}
>
}}>
<Image
source={require('./images.jpg')}
style={{
Expand All @@ -106,8 +101,7 @@ const App = () => {
fontSize: 18,
letterSpacing: 1,
textAlign: 'center',
}}
>
}}>
Admob Native Advanced Ads {'\n'} for React Native
</Text>
</View>
Expand All @@ -123,13 +117,11 @@ const App = () => {
justifyContent: 'center',
borderRadius: 5,
marginBottom: 5,
}}
>
}}>
<Text
style={{
color: 'white',
}}
>
}}>
Simple Banner Ad
</Text>
</TouchableOpacity>
Expand All @@ -145,13 +137,11 @@ const App = () => {
justifyContent: 'center',
borderRadius: 5,
marginBottom: 5,
}}
>
}}>
<Text
style={{
color: 'white',
}}
>
}}>
Ad with Image
</Text>
</TouchableOpacity>
Expand All @@ -167,13 +157,11 @@ const App = () => {
justifyContent: 'center',
borderRadius: 5,
marginBottom: 5,
}}
>
}}>
<Text
style={{
color: 'white',
}}
>
}}>
Ad with Video
</Text>
</TouchableOpacity>
Expand All @@ -189,13 +177,11 @@ const App = () => {
justifyContent: 'center',
borderRadius: 5,
marginBottom: 5,
}}
>
}}>
<Text
style={{
color: 'white',
}}
>
}}>
Multiple Ads in a List
</Text>
</TouchableOpacity>
Expand All @@ -212,8 +198,7 @@ const App = () => {
<View
style={{
height: 400,
}}
>
}}>
<AdView type="image" media={true} />
</View>
)}
Expand All @@ -222,8 +207,7 @@ const App = () => {
<View
style={{
height: 400,
}}
>
}}>
<AdView type="video" media={true} />
</View>
)}
Expand Down
2 changes: 2 additions & 0 deletions example/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,8 @@ dependencies {

implementation("androidx.swiperefreshlayout:swiperefreshlayout:1.0.0")

implementation project(':react-native-admob-native-ads')

debugImplementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}")
debugImplementation("com.facebook.flipper:flipper-network-plugin:${FLIPPER_VERSION}") {
exclude group:'com.squareup.okhttp3', module:'okhttp'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import com.facebook.react.defaults.DefaultReactNativeHost;
import com.facebook.soloader.SoLoader;
import java.util.List;
import com.ammarahmed.rnadmob.nativeads.RNAdMobNativePackage;

public class MainApplication extends Application implements ReactApplication {

Expand All @@ -25,6 +26,7 @@ protected List<ReactPackage> getPackages() {
List<ReactPackage> packages = new PackageList(this).getPackages();
// Packages that cannot be autolinked yet can be added manually here, for example:
// packages.add(new MyReactNativePackage());
packages.add(new RNAdMobNativePackage());
return packages;
}

Expand Down
2 changes: 2 additions & 0 deletions example/android/settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@ rootProject.name = 'example'
apply from: file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings)
include ':app'
includeBuild('../node_modules/react-native-gradle-plugin')
include ':react-native-admob-native-ads'
project(':react-native-admob-native-ads').projectDir = new File(rootProject.projectDir, '../../android')
17 changes: 17 additions & 0 deletions example/metro.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,24 @@
* @format
*/

const path = require('path');
const exclusionList = require('metro-config/src/defaults/exclusionList');

const moduleRoot = path.resolve(__dirname, '..');

module.exports = {
watchFolders: [moduleRoot],
resolver: {
extraNodeModules: {
react: path.resolve(__dirname, 'node_modules/react'),
'react-native': path.resolve(__dirname, 'node_modules/react-native'),
},
nodeModulesPaths: [path.resolve(path.join(__dirname, './node_modules'))],
blockList: exclusionList([
new RegExp(`${moduleRoot}/node_modules/react/.*`),
new RegExp(`${moduleRoot}/node_modules/react-native/.*`),
]),
},
transformer: {
getTransformOptions: async () => ({
transform: {
Expand Down
Loading

0 comments on commit 9b58d22

Please sign in to comment.