Skip to content

Commit acdc1f5

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 fc06dc8 commit acdc1f5

File tree

3 files changed

+119
-0
lines changed

3 files changed

+119
-0
lines changed

React/React.h

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
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 "RCTBridgeDelegate.h"
13+
#import "RCTBridgeModule.h"
14+
#import "RCTCache.h"
15+
#import "RCTConvert.h"
16+
#import "RCTDefines.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 "RCTKeyboardObserver.h"
25+
#import "RCTKeyCommands.h"
26+
#import "RCTLog.h"
27+
#import "RCTModuleData.h"
28+
#import "RCTModuleMap.h"
29+
#import "RCTModuleMethod.h"
30+
#import "RCTPerformanceLogger.h"
31+
#import "RCTPerfStats.h"
32+
#import "RCTProfile.h"
33+
#import "RCTRootView.h"
34+
#import "RCTSparseArray.h"
35+
#import "RCTTouchHandler.h"
36+
#import "RCTURLRequestDelegate.h"
37+
#import "RCTURLRequestHandler.h"
38+
#import "RCTUtils.h"
39+
40+
#import "RCTContextExecutor.h"
41+
#import "RCTWebViewExecutor.h"
42+
43+
#import "RCTAccessibilityManager.h"
44+
#import "RCTAlertManager.h"
45+
#import "RCTAppState.h"
46+
#import "RCTAsyncLocalStorage.h"
47+
#import "RCTDevLoadingView.h"
48+
#import "RCTDevMenu.h"
49+
#import "RCTExceptionsManager.h"
50+
#import "RCTPointAnnotation.h"
51+
#import "RCTRedBox.h"
52+
#import "RCTSourceCode.h"
53+
#import "RCTStatusBarManager.h"
54+
#import "RCTTiming.h"
55+
#import "RCTUIManager.h"
56+
57+
#import "RCTAnimationType.h"
58+
#import "RCTAutoInsetsProtocol.h"
59+
#import "RCTComponent.h"
60+
#import "RCTConvert+CoreLocation.h"
61+
#import "RCTConvert+MapKit.h"
62+
#import "RCTPointerEvents.h"
63+
#import "RCTScrollableProtocol.h"
64+
#import "RCTShadowView.h"
65+
#import "RCTView.h"
66+
#import "RCTViewControllerProtocol.h"
67+
#import "RCTViewManager.h"
68+
#import "UIView+React.h"

React/React.xcodeproj/project.pbxproj

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,8 @@
229229
58C571C01AA56C1900CDF9C8 /* RCTDatePickerManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTDatePickerManager.h; sourceTree = "<group>"; };
230230
63F014BE1B02080B003B75D2 /* RCTPointAnnotation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTPointAnnotation.h; sourceTree = "<group>"; };
231231
63F014BF1B02080B003B75D2 /* RCTPointAnnotation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTPointAnnotation.m; sourceTree = "<group>"; };
232+
783ABB341B38A9D3003FFD95 /* RCTJavaScriptExecutor.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTJavaScriptExecutor.m; sourceTree = "<group>"; };
233+
78BEE2481ABABC2E00F44561 /* React.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = React.h; sourceTree = "<group>"; };
232234
830213F31A654E0800B993E6 /* RCTBridgeModule.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RCTBridgeModule.h; sourceTree = "<group>"; };
233235
830A229C1A66C68A008503DA /* RCTRootView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTRootView.h; sourceTree = "<group>"; };
234236
830A229D1A66C68A008503DA /* RCTRootView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTRootView.m; sourceTree = "<group>"; };
@@ -439,6 +441,7 @@
439441
83CBBA2F1A601D0F00E9B192 /* React */ = {
440442
isa = PBXGroup;
441443
children = (
444+
78BEE2481ABABC2E00F44561 /* React.h */,
442445
83CBBA491A601E3B00E9B192 /* Base */,
443446
134FCB381A6E7F0800051CC8 /* Executors */,
444447
13B07FC41A68125100A75B9A /* Layout */,

scripts/generate-umbrella-header.sh

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
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+
$(find React/Modules -name "*.h" -exec basename {} \;)
19+
20+
RCTAnimationType.h
21+
RCTAutoInsetsProtocol.h
22+
RCTComponent.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+
UIView+React.h\
32+
"
33+
34+
echo \
35+
"/**
36+
* Copyright (c) 2015-present, Facebook, Inc.
37+
* All rights reserved.
38+
*
39+
* This source code is licensed under the BSD-style license found in the
40+
* LICENSE file in the root directory of this source tree. An additional grant
41+
* of patent rights can be found in the PATENTS file in the same directory.
42+
*/
43+
44+
$(
45+
echo "${LIBRARY_HEADERS}" |
46+
awk -v lib="${LIBRARY_NAME}" '{if (NF) print "#import \""$0"\""; else print;}'
47+
)\
48+
" > "${UMBRELLA_HEADER_PATH}"

0 commit comments

Comments
 (0)