From 2b7dfc49bbc623508b3fd839f1700ac4eaff70f5 Mon Sep 17 00:00:00 2001 From: Niall Brennan Date: Fri, 15 Sep 2023 11:52:38 +0100 Subject: [PATCH 1/2] Remove faq file and update faqs for rn --- .../libraries/mobile/react-native/index.md | 3 ++ .../mobile/react-native/react-faqs.md | 52 ------------------- 2 files changed, 3 insertions(+), 52 deletions(-) delete mode 100644 src/connections/sources/catalog/libraries/mobile/react-native/react-faqs.md diff --git a/src/connections/sources/catalog/libraries/mobile/react-native/index.md b/src/connections/sources/catalog/libraries/mobile/react-native/index.md index 41f75b615d..8b55d66cef 100644 --- a/src/connections/sources/catalog/libraries/mobile/react-native/index.md +++ b/src/connections/sources/catalog/libraries/mobile/react-native/index.md @@ -724,5 +724,8 @@ segmentClient.add({ plugin: new AddToContextPlugin() }); ### I've upgraded to React Native 2.0, but I am still getting warnings in the Google Play Store that my app is not compliant. Why is this? The React Native 2.0 library is compliant with Google Play Store policies. However, Segment recommends that you check to see if there are any old and inactive [tracks on the Google Play Store](https://developers.google.com/android-publisher/tracks){:target="_blank"} that are not updated to the latest build. If this is the case, we recommend updating those tracks to resolve the issue. +### Can I set inlineRequires to false in my metro.config.js file? +Segment requires the `inlineRequires` value in your `metro.config.js` value to be set to `true`. If you wish to disable `inlineRequires` for certain modules, you can specify this by using a [blockList](https://facebook.github.io/metro/docs/configuration/#:~:text=If%20inlineRequires%20is%20an%20object). + ## Changelog [View the Analytics React Native changelog on GitHub](https://github.com/segmentio/analytics-react-native/releases){:target="_blank"}. diff --git a/src/connections/sources/catalog/libraries/mobile/react-native/react-faqs.md b/src/connections/sources/catalog/libraries/mobile/react-native/react-faqs.md deleted file mode 100644 index 8ab6db1c7a..0000000000 --- a/src/connections/sources/catalog/libraries/mobile/react-native/react-faqs.md +++ /dev/null @@ -1,52 +0,0 @@ ---- -title: Analytics React Native FAQs -strat: react-native ---- -## FAQs -### Can I use the catalog of device-mode destinations from Segment's 1.X.X React-Native release? -No, only the plugins listed above are supported in device-mode for Analytics React Native. -### Will I still see device-mode integrations listed as `false` in the integrations object? -When you successfully package a plugin in device-mode, you won't see the integration listed as `false` in the integrations object for a Segment event. This logic is packaged in the event metadata, and isn't surfaced in the Segment debugger. - -### How do I set a distinct writeKey for iOS and android? -You can set different writeKeys for iOS and Android. This is helpful if you want to send data to different destinations based on the client side platform. To set different writeKeys, you can dynamically set the writeKey when you initialize the Segment client: - -```js -import {Platform} from 'react-native'; -import { createClient } from '@segment/analytics-react-native'; - -const segmentWriteKey = Platform.iOS ? 'ios-writekey' : 'android-writekey'; - -const segmentClient = createClient({ - writeKey: segmentWriteKey -}); -``` -### What is the instanceId set in context? -The instanceId was introduced in [V 2.10.1](https://github.com/segmentio/analytics-react-native/releases/tag/%40segment%2Fanalytics-react-native-v2.10.1) and correlates events to a particular instance of the client in a scenario when you might have multiple instances on a single app. - -### How do I interact with the integrations object? -The integrations object is no longer part of the Segment events method signature. To access the integrations object and control what destinations the event reaches, you can use a Plugin: - -```js -import { - EventType, - Plugin, - PluginType, - SegmentEvent, - } from '@segment/analytics-react-native'; - - export class Modify extends Plugin { - type = PluginType.before; - - async execute(event: SegmentEvent) { - if (event.type == EventType.TrackEvent) { - let integrations = event.integrations; - if (integrations !== undefined) { - integrations['Appboy'] = false; - } - } - //console.log(event); - return event; - } - } -``` \ No newline at end of file From f98e66ed6ffdb7650087b4a6fa326ea478084d6f Mon Sep 17 00:00:00 2001 From: pwseg <86626706+pwseg@users.noreply.github.com> Date: Tue, 19 Sep 2023 05:40:42 -0500 Subject: [PATCH 2/2] Small fix --- .../sources/catalog/libraries/mobile/react-native/index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/connections/sources/catalog/libraries/mobile/react-native/index.md b/src/connections/sources/catalog/libraries/mobile/react-native/index.md index 8b55d66cef..92492e1e2e 100644 --- a/src/connections/sources/catalog/libraries/mobile/react-native/index.md +++ b/src/connections/sources/catalog/libraries/mobile/react-native/index.md @@ -725,7 +725,7 @@ segmentClient.add({ plugin: new AddToContextPlugin() }); The React Native 2.0 library is compliant with Google Play Store policies. However, Segment recommends that you check to see if there are any old and inactive [tracks on the Google Play Store](https://developers.google.com/android-publisher/tracks){:target="_blank"} that are not updated to the latest build. If this is the case, we recommend updating those tracks to resolve the issue. ### Can I set inlineRequires to false in my metro.config.js file? -Segment requires the `inlineRequires` value in your `metro.config.js` value to be set to `true`. If you wish to disable `inlineRequires` for certain modules, you can specify this by using a [blockList](https://facebook.github.io/metro/docs/configuration/#:~:text=If%20inlineRequires%20is%20an%20object). +Segment requires the `inlineRequires` value in your `metro.config.js` value to be set to `true`. To disable `inlineRequires` for certain modules, you can specify this by using a [blockList](https://facebook.github.io/metro/docs/configuration/#:~:text=If%20inlineRequires%20is%20an%20object){:target="_blank"}. ## Changelog [View the Analytics React Native changelog on GitHub](https://github.com/segmentio/analytics-react-native/releases){:target="_blank"}.