-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #780 from DataDog/dev/support-prev-73-newarch-text…
…-props [FIX] SR: Support < RN 0.73 new arch text properties
- Loading branch information
Showing
3 changed files
with
56 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 47 additions & 0 deletions
47
packages/react-native-session-replay/scripts/set-ios-rn-version.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
/* | ||
* Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0. | ||
* This product includes software developed at Datadog (https://www.datadoghq.com/). | ||
* Copyright 2016-Present Datadog, Inc. | ||
*/ | ||
/* eslint-disable @typescript-eslint/no-var-requires */ | ||
const fs = require('fs'); | ||
const path = require('path'); | ||
|
||
function getReactNativeVersion() { | ||
try { | ||
// eslint-disable-next-line global-require | ||
return require('react-native/package.json').version; | ||
} catch (error) { | ||
throw new Error( | ||
'Failed to find React Native. Ensure it is installed in your project.' | ||
); | ||
} | ||
} | ||
|
||
const rnVersion = getReactNativeVersion(); | ||
|
||
const outputDir = path.resolve(__dirname, '../ios/Sources'); | ||
const outputFile = path.join(outputDir, 'RCTVersion.h'); | ||
|
||
if (!fs.existsSync(outputDir)) { | ||
fs.mkdirSync(outputDir, { recursive: true }); | ||
} | ||
|
||
const [major, minor, patch] = rnVersion.split('.').map(Number); | ||
|
||
const headerContent = `#ifndef RCTVersion_h | ||
#define RCTVersion_h | ||
#define RCT_VERSION_MAJOR ${major || 0} | ||
#define RCT_VERSION_MINOR ${minor || 0} | ||
#define RCT_VERSION_PATCH ${patch || 0} | ||
#endif /* RCTVersion_h */ | ||
`; | ||
|
||
try { | ||
fs.writeFileSync(outputFile, headerContent, 'utf8'); | ||
} catch (error) { | ||
console.error(`Failed to write RCTVersion.h: ${error.message}`); | ||
process.exit(1); | ||
} |