react-native-daro
v2.2.0
Published
React Native module for the Daro SDK on Android and iOS
Readme
react-native-daro
React Native module for the Daro SDK on Android and iOS.
Installation
npm install react-native-daroiOS SwiftPM
React Native 0.75 이상이 필요합니다. Expo SDK 51에서는 RN 0.75를 선택하세요. Expo SDK 51에서 RN 0.75 사용하기
Expo 앱은 npx expo prebuild --platform ios --no-install로 iOS 프로젝트를 생성합니다.
Daro config plugin이 앱의 Info.plist에 ios.daroIntegrationKey 값을 쓰고
SwiftPM 프레임워크를 포함하는 훅을 추가합니다.
Bare RN 앱은 Podfile의 react_native_post_install 호출을 유지하고,
앱 타깃에 use_frameworks! :linkage => :dynamic을 설정합니다.
Info.plist에 DaroIntegrationKey를 설정하고 다음 훅을 추가하세요.
이미 post_integrate가 있다면 호출을 그 블록에 넣습니다.
post_integrate do |installer|
DaroReactNativeSwiftPM.integrate!(installer)
end수동으로 추가한 DaroAds Pod 선언이나 Daro 키 주입용 post_install 코드를 제거합니다.
예제의 MyApp을 실제 Xcode 앱 이름으로 바꿔 실행하고, Bundler를 쓰면 pod install 앞에
bundle exec를 붙이세요. Expo prebuild를 다시 실행한 뒤에는 플랫폼 키를 다시 주입합니다.
cd ios
USE_FRAMEWORKS=dynamic pod install
xcodebuild -workspace MyApp.xcworkspace -scheme MyApp -resolvePackageDependencies \
-clonedSourcePackagesDirPath "$PWD/.daro-source-packages"
.daro-source-packages/artifacts/daro-ios-sdk/Daro/Scripts/daro platform-key \
--plist MyApp/Info.plist --injectUsage
import { initialize, setAppMuted, InterstitialAd } from 'react-native-daro';
// Optional: explicitly enable sound. Omit this call to keep the RN default mute.
// await setAppMuted(false);
await initialize();
const interstitialAd = InterstitialAd.createForAdRequest('AD_UNIT_ID');
interstitialAd.load();Ads are muted by default in React Native. Use await setAppMuted(false) to
enable sound or await setAppMuted(true) to mute again. The latest setting made
before or during initialization is applied before initialize() resolves.
Always await successful initialization before loading the first ad. Duplicate
initialization and JS bridge reloads retain the process's explicit setting;
failed initialization rejects and can be retried without resetting it.
The setting follows the native SDK's supported ad and mediation paths. It does not guarantee changing already-loaded ads or controlling every network's audio.
Expo Config Plugin
For Expo apps, add react-native-daro to plugins.
module.exports = {
expo: {
plugins: [
[
'react-native-daro',
{
ios: {
daroIntegrationKey: 'DARO_IOS_INTEGRATION_KEY',
},
android: {
daroIntegrationKey: 'DARO_ANDROID_INTEGRATION_KEY',
},
},
],
],
},
};If an Android Release build fails in a SafeDK or manifest task with a
Configuration Cache error, set Boolean android.safedkConfigurationCacheWorkaround
to true in the plugin options and rerun prebuild or EAS Build. false disables
the workaround; omission preserves the existing Gradle value. Generated Android
builds use SDK 2.1.2 and Gradle plugin 2.0.5. React Native CLI projects can set
daro.safedkConfigurationCacheWorkaround=true in android/gradle.properties
after updating the Gradle plugin to 2.0.5.
