-
Notifications
You must be signed in to change notification settings - Fork 24.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Expose React Native version as a symbol rather than macro
Summary: Add RCTGetReactNativeVersion() to expose version in native code. Right now, version is exposed internally to RN using a MACRO constant. This exposes a symbol (function) that can be called to retrieve the React Native version in iOS. Also exposed RCTVersion.h as a public header in the React project so it is available to developers. The motivation behind this is for https://github.com/wix/detox —we need to know what RN version the user has, if any, so we can properly handle support and abstract differences. Ran bump-oss-version.js to ensure the template is applied properly. Also compiled the project to make sure nothing is broken. [IOS] [ENHANCEMENT] [RCTVersion.h] - Expose version as a compile-time symbol for native queries <!-- Help reviewers and the release process by writing your own release notes **INTERNAL and MINOR tagged notes will not be included in the next version's final release notes.** CATEGORY [----------] TYPE [ CLI ] [-------------] LOCATION [ DOCS ] [ BREAKING ] [-------------] [ GENERAL ] [ BUGFIX ] [-{Component}-] [ INTERNAL ] [ ENHANCEMENT ] [ {File} ] [ IOS ] [ FEATURE ] [ {Directory} ] |-----------| [ ANDROID ] [ MINOR ] [ {Framework} ] - | {Message} | [----------] [-------------] [-------------] |-----------| [CATEGORY] [TYPE] [LOCATION] - MESSAGE EXAMPLES: [IOS] [BREAKING] [FlatList] - Change a thing that breaks other things [ANDROID] [BUGFIX] [TextInput] - Did a thing to TextInput [CLI] [FEATURE] [local-cli/info/info.js] - CLI easier to do things with [DOCS] [BUGFIX] [GettingStarted.md] - Accidentally a thing/word [GENERAL] [ENHANCEMENT] [Yoga] - Added new yoga thing/position [INTERNAL] [FEATURE] [./scripts] - Added thing to script that nobody will see --> Closes #18136 Differential Revision: D7141076 Pulled By: hramos fbshipit-source-id: 18a92b8c60d7b43fa0ed22597ea46a35cff73c56
- Loading branch information
1 parent
7be3d1c
commit 30469ed
Showing
7 changed files
with
86 additions
and
26 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,16 @@ | ||
/** | ||
* @generated by scripts/bump-oss-version.js | ||
* | ||
* Copyright (c) 2015-present, Facebook, Inc. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
#define RCT_REACT_NATIVE_VERSION @{ \ | ||
@"major": @(0), \ | ||
@"minor": @(0), \ | ||
@"patch": @(0), \ | ||
@"prerelease": [NSNull null], \ | ||
} | ||
|
||
#import <Foundation/Foundation.h> | ||
|
||
extern NSString* const RCTVersionMajor; | ||
extern NSString* const RCTVersionMinor; | ||
extern NSString* const RCTVersionPatch; | ||
extern NSString* const RCTVersionPrerelease; | ||
|
||
extern NSDictionary* RCTGetReactNativeVersion(void); |
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,33 @@ | ||
/** | ||
* @generated by scripts/bump-oss-version.js | ||
* | ||
* Copyright (c) 2015-present, Facebook, Inc. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
#import "RCTVersion.h" | ||
|
||
NSString* const RCTVersionMajor = @"major"; | ||
NSString* const RCTVersionMinor = @"minor"; | ||
NSString* const RCTVersionPatch = @"patch"; | ||
NSString* const RCTVersionPrerelease = @"prerelease"; | ||
|
||
static NSDictionary* __rnVersion; | ||
|
||
__attribute__((constructor)) | ||
static void __makeVersion() | ||
{ | ||
__rnVersion = @{ | ||
RCTVersionMajor: @(0), | ||
RCTVersionMinor: @(0), | ||
RCTVersionPatch: @(0), | ||
RCTVersionPrerelease: [NSNull null], | ||
}; | ||
} | ||
|
||
NSDictionary* RCTGetReactNativeVersion(void) | ||
{ | ||
return __rnVersion; | ||
} |
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
This file was deleted.
Oops, something went wrong.
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,33 @@ | ||
/** | ||
* @generated by scripts/bump-oss-version.js | ||
* | ||
* Copyright (c) 2015-present, Facebook, Inc. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
#import "RCTVersion.h" | ||
|
||
NSString* const RCTVersionMajor = @"major"; | ||
NSString* const RCTVersionMinor = @"minor"; | ||
NSString* const RCTVersionPatch = @"patch"; | ||
NSString* const RCTVersionPrerelease = @"prerelease"; | ||
|
||
static NSDictionary* __rnVersion; | ||
|
||
__attribute__((constructor)) | ||
static void __makeVersion() | ||
{ | ||
__rnVersion = @{ | ||
RCTVersionMajor: ${major}, | ||
RCTVersionMinor: ${minor}, | ||
RCTVersionPatch: ${patch}, | ||
RCTVersionPrerelease: ${prerelease}, | ||
}; | ||
} | ||
|
||
NSDictionary* RCTGetReactNativeVersion(void) | ||
{ | ||
return __rnVersion; | ||
} |