Open
Description
Issue
I’m facing an issue on iOS. When I trigger the purchase event, the Firebase dashboard shows purchase event twice, as you can see in the two screenshots I’ve attached. This is happening in both debug and release modes.
Attachments (Android/iOS)
Attachments (Real Data)
You can see every purchase event captured twice.
let dummyData = {
currency: "USD",
value: 30.03,
coupon: "SUMMER_FUN",
items: [
{
item_id: "SKU_12345",
item_name: "Stan and Friends Tee",
affiliation: "Google Merchandise Store",
coupon: "SUMMER_FUN",
discount: 2.22,
index: 0,
item_brand: "Google",
item_category: "Apparel",
item_category2: "Adult",
item_category3: "Shirts",
item_category4: "Crew",
item_category5: "Short sleeve",
item_list_id: "related_products",
item_list_name: "Related Products",
item_variant: "green",
location_id: "ChIJIQBpAG2ahYAR_6128GcTUEo",
price: 10.01,
quantity: 3
}
]
}
await getAnalytics().logEvent("purchase", dummyData);
Project Files
Javascript
Click To Expand
package.json
:
{
"name": "redtag",
"version": "0.0.1",
"private": true,
"scripts": {
"android": "react-native run-android",
"ios": "react-native run-ios",
"lint": "eslint .",
"start": "react-native start",
"test": "jest",
"podinstall": "cd ios && RCT_NEW_ARCH_ENABLED=0 pod install",
"release": "cd android && ./gradlew assembleRelease",
"bundle": "cd android && ./gradlew bundleRelease",
"clean": "cd android && ./gradlew clean",
"postinstall": "patch-package"
},
"dependencies": {
"@kichiyaki/react-native-barcode-generator": "^0.6.7",
"@ptomasroos/react-native-multi-slider": "^2.2.2",
"@react-native-async-storage/async-storage": "^2.1.0",
"@react-native-clipboard/clipboard": "^1.15.0",
"@react-native-community/datetimepicker": "^8.2.0",
"@react-native-firebase/analytics": "^21.6.0",
"@react-native-firebase/app": "^21.6.0",
"@react-native-firebase/crashlytics": "^21.6.0",
"@react-native-firebase/messaging": "^21.6.1",
"@react-navigation/bottom-tabs": "^7.0.4",
"@react-navigation/native": "^7.0.3",
"@react-navigation/native-stack": "^7.0.3",
"@reduxjs/toolkit": "^2.3.0",
"@shopify/flash-list": "^1.7.2",
"axios": "^1.7.7",
"intl-pluralrules": "^2.0.1",
"js-sha256": "^0.11.0",
"patch-package": "^8.0.0",
"react": "18.3.1",
"react-i18next": "^15.1.1",
"react-native": "0.76.5",
"react-native-appsflyer": "^6.15.1",
"react-native-blob-util": "^0.19.11",
"react-native-device-info": "^14.0.0",
"react-native-fast-image": "^8.6.3",
"react-native-gesture-handler": "^2.21.0",
"react-native-keyboard-aware-scroll-view": "^0.9.5",
"react-native-linear-gradient": "^2.8.3",
"react-native-moengage": "^11.1.1",
"react-native-otp-entry": "^1.8.1",
"react-native-otp-textinput": "^1.1.6",
"react-native-reanimated": "^3.16.1",
"react-native-restart": "^0.0.27",
"react-native-safe-area-context": "^4.14.0",
"react-native-screens": "^4.1.0",
"react-native-splash-screen": "^3.3.0",
"react-native-svg": "^15.9.0",
"react-native-webview": "^13.12.3",
"react-native-zoom-toolkit": "^4.0.0",
"react-redux": "^9.1.2",
"redux": "^5.0.1",
"rn-secure-storage": "^3.0.1"
},
"devDependencies": {
"@babel/core": "^7.25.2",
"@babel/preset-env": "^7.25.3",
"@babel/runtime": "^7.25.0",
"@react-native-community/cli": "15.0.1",
"@react-native-community/cli-platform-android": "15.0.1",
"@react-native-community/cli-platform-ios": "15.0.1",
"@react-native/babel-preset": "0.76.5",
"@react-native/eslint-config": "0.76.5",
"@react-native/metro-config": "0.76.5",
"@react-native/typescript-config": "0.76.5",
"@types/react": "^18.2.6",
"@types/react-test-renderer": "^18.0.0",
"babel-jest": "^29.6.3",
"eslint": "^8.19.0",
"jest": "^29.6.3",
"prettier": "2.8.8",
"react-test-renderer": "18.3.1",
"typescript": "5.0.4"
},
"engines": {
"node": ">=18"
}
}
firebase.json
for react-native-firebase v6:
# N/A
iOS
Click To Expand
ios/Podfile
:
- I'm not using Pods
- I'm using Pods and my Podfile looks like:
# Resolve react_native_pods.rb with node to allow for hoisting
require Pod::Executable.execute_command('node', ['-p',
'require.resolve(
"react-native/scripts/react_native_pods.rb",
{paths: [process.argv[1]]},
)', __dir__]).strip
platform :ios, '15.1'
prepare_react_native_project!
linkage = ENV['USE_FRAMEWORKS']
if linkage != nil
Pod::UI.puts "Configuring Pod with #{linkage}ally linked Frameworks".green
use_frameworks! :linkage => linkage.to_sym
end
target 'redtag' do
config = use_native_modules!
use_frameworks! :linkage => :static
$RNFirebaseAsStaticFramework = true
$RNAppsFlyerStrictMode=true
$RNFirebaseAnalyticsWithoutAdIdSupport = true
use_react_native!(
:path => config[:reactNativePath],
# An absolute path to your application root.
:app_path => "#{Pod::Config.instance.installation_root}/.."
)
target 'redtagTests' do
inherit! :complete
# Pods for testing
end
post_install do |installer|
# https://github.com/facebook/react-native/blob/main/packages/react-native/scripts/react_native_pods.rb#L197-L202
react_native_post_install(
installer,
config[:reactNativePath],
:mac_catalyst_enabled => false,
# :ccache_enabled => true
)
end
end
target "NotificationService" do
use_frameworks! :linkage => :static
pod 'MoEngage-iOS-SDK/RichNotification'
end
target "NotificationContent" do
use_frameworks! :linkage => :static
pod 'MoEngage-iOS-SDK/RichNotification'
end
AppDelegate.m
:
// N/A
Android
Working fine in android.
Environment
Click To Expand
react-native info
output:
OUTPUT GOES HERE
- Platform that you're experiencing the issue on:
- iOS
- Android
- iOS but have not tested behavior on Android
- Android but have not tested behavior on iOS
- Both
react-native-firebase
version you're using that has this issue:21.6.0
Firebase
module(s) you're using that has the issue:e.g. Instance ID
- Are you using
TypeScript
?- `No
`
- 👉 Check out
React Native Firebase
andInvertase
on Twitter for updates on the library.