Skip to content

Commit b149bd5

Browse files
committed
[Headers] Add an umbrella header for the library
The umbrella header allows projects that link React Native using CocoaPods to import it in standard fashion: `#import <React/React.h>`. Only some headers are included based on what I've found to be useful. Generated with `scripts/generate-umbrella-header.sh`, which is a script that scans the Base and Executors directories for all headers and also includes some handpicked Views headers as well.
1 parent 28b9a6f commit b149bd5

File tree

3 files changed

+108
-0
lines changed

3 files changed

+108
-0
lines changed

React/React.h

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
/**
2+
* Copyright (c) 2015-present, Facebook, Inc.
3+
* All rights reserved.
4+
*
5+
* This source code is licensed under the BSD-style license found in the
6+
* LICENSE file in the root directory of this source tree. An additional grant
7+
* of patent rights can be found in the PATENTS file in the same directory.
8+
*/
9+
10+
#import "RCTAssert.h"
11+
#import "RCTBridge.h"
12+
#import "RCTBridgeModule.h"
13+
#import "RCTCache.h"
14+
#import "RCTConvert.h"
15+
#import "RCTDefines.h"
16+
#import "RCTDevMenu.h"
17+
#import "RCTEventDispatcher.h"
18+
#import "RCTFPSGraph.h"
19+
#import "RCTFrameUpdate.h"
20+
#import "RCTInvalidating.h"
21+
#import "RCTJavaScriptExecutor.h"
22+
#import "RCTJavaScriptLoader.h"
23+
#import "RCTJSMethodRegistrar.h"
24+
#import "RCTKeyCommands.h"
25+
#import "RCTLog.h"
26+
#import "RCTModuleData.h"
27+
#import "RCTModuleMethod.h"
28+
#import "RCTPerformanceLogger.h"
29+
#import "RCTPerfStats.h"
30+
#import "RCTProfile.h"
31+
#import "RCTRedBox.h"
32+
#import "RCTRootView.h"
33+
#import "RCTSparseArray.h"
34+
#import "RCTTouchHandler.h"
35+
#import "RCTURLRequestDelegate.h"
36+
#import "RCTURLRequestHandler.h"
37+
#import "RCTUtils.h"
38+
39+
#import "RCTContextExecutor.h"
40+
#import "RCTWebViewExecutor.h"
41+
42+
#import "RCTExceptionsManager.h"
43+
#import "RCTUIManager.h"
44+
45+
#import "RCTAnimationType.h"
46+
#import "RCTAutoInsetsProtocol.h"
47+
#import "RCTConvert+CoreLocation.h"
48+
#import "RCTConvert+MapKit.h"
49+
#import "RCTPointerEvents.h"
50+
#import "RCTScrollableProtocol.h"
51+
#import "RCTShadowView.h"
52+
#import "RCTView.h"
53+
#import "RCTViewControllerProtocol.h"
54+
#import "RCTViewManager.h"
55+
#import "RCTViewNodeProtocol.h"
56+
#import "UIView+React.h"

React/React.xcodeproj/project.pbxproj

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,8 @@
212212
58C571C01AA56C1900CDF9C8 /* RCTDatePickerManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTDatePickerManager.h; sourceTree = "<group>"; };
213213
63F014BE1B02080B003B75D2 /* RCTPointAnnotation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTPointAnnotation.h; sourceTree = "<group>"; };
214214
63F014BF1B02080B003B75D2 /* RCTPointAnnotation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTPointAnnotation.m; sourceTree = "<group>"; };
215+
783ABB341B38A9D3003FFD95 /* RCTJavaScriptExecutor.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTJavaScriptExecutor.m; sourceTree = "<group>"; };
216+
78BEE2481ABABC2E00F44561 /* React.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = React.h; sourceTree = "<group>"; };
215217
830213F31A654E0800B993E6 /* RCTBridgeModule.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RCTBridgeModule.h; sourceTree = "<group>"; };
216218
830A229C1A66C68A008503DA /* RCTRootView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTRootView.h; sourceTree = "<group>"; };
217219
830A229D1A66C68A008503DA /* RCTRootView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTRootView.m; sourceTree = "<group>"; };
@@ -396,6 +398,7 @@
396398
83CBBA2F1A601D0F00E9B192 /* React */ = {
397399
isa = PBXGroup;
398400
children = (
401+
78BEE2481ABABC2E00F44561 /* React.h */,
399402
83CBBA491A601E3B00E9B192 /* Base */,
400403
134FCB381A6E7F0800051CC8 /* Executors */,
401404
13B07FC41A68125100A75B9A /* Layout */,

scripts/generate-umbrella-header.sh

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
#!/usr/bin/env bash
2+
3+
set -e
4+
5+
SCRIPTS=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
6+
ROOT=$(dirname $SCRIPTS)
7+
8+
LIBRARY_NAME="React"
9+
UMBRELLA_HEADER_PATH="${ROOT}/React/${LIBRARY_NAME}.h"
10+
11+
cd $ROOT
12+
13+
LIBRARY_HEADERS="\
14+
$(find React/Base -name "*.h" -exec basename {} \;)
15+
16+
$(find React/Executors -name "*.h" -exec basename {} \;)
17+
18+
RCTExceptionsManager.h
19+
RCTUIManager.h
20+
21+
RCTAnimationType.h
22+
RCTAutoInsetsProtocol.h
23+
RCTConvert+CoreLocation.h
24+
RCTConvert+MapKit.h
25+
RCTPointerEvents.h
26+
RCTScrollableProtocol.h
27+
RCTShadowView.h
28+
RCTView.h
29+
RCTViewControllerProtocol.h
30+
RCTViewManager.h
31+
RCTViewNodeProtocol.h
32+
UIView+React.h\
33+
"
34+
35+
echo \
36+
"/**
37+
* Copyright (c) 2015-present, Facebook, Inc.
38+
* All rights reserved.
39+
*
40+
* This source code is licensed under the BSD-style license found in the
41+
* LICENSE file in the root directory of this source tree. An additional grant
42+
* of patent rights can be found in the PATENTS file in the same directory.
43+
*/
44+
45+
$(
46+
echo "${LIBRARY_HEADERS}" |
47+
awk -v lib="${LIBRARY_NAME}" '{if (NF) print "#import \""$0"\""; else print;}'
48+
)\
49+
" > "${UMBRELLA_HEADER_PATH}"

0 commit comments

Comments
 (0)