├── .gitignore
├── README.md
├── RNTouchbar
├── RNTouchbar.xcodeproj
│ ├── project.pbxproj
│ └── xcuserdata
│ │ └── potomushto.xcuserdatad
│ │ └── xcschemes
│ │ ├── RNTouchbar.xcscheme
│ │ └── xcschememanagement.plist
└── RNTouchbar
│ ├── RNTouchbarManager.h
│ ├── RNTouchbarManager.m
│ ├── RNTouchbarRootView.h
│ └── RNTouchbarRootView.m
├── index.js
└── package.json
/.gitignore:
--------------------------------------------------------------------------------
1 | node_modules
2 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
2 | ```js
3 | import React from 'react';
4 | import { View } from 'react-native-macos';
5 | import TouchBar from 'react-native-touchbar';
6 |
7 | export default myApp = () => (
8 |
9 |
10 |
14 |
15 | Welcome to React Native macOS!
16 |
17 |
18 | To get started, edit index.macos.js
19 |
20 |
21 | Press Cmd+R to reload,{'\n'}
22 | Or use Developer Menu
23 |
24 |
25 | )
26 | ```
27 |
28 |
29 | You need Xcode 8.1 on macOS Sierra 10.12.1 (12B2657) or later.
30 |
31 | Enable Touchbar simulator in Xcode -> Windows menu:
32 | 
33 |
34 | TODO:
35 |
36 | - [ ] Different native TouchBarItems (like segmented controls)
37 | - [ ] Inner touchbar (touchbar inside touchbars)
38 | - [ ] Customization
39 | - [ ] Several Touchbar instances per app
40 |
--------------------------------------------------------------------------------
/RNTouchbar/RNTouchbar.xcodeproj/project.pbxproj:
--------------------------------------------------------------------------------
1 | // !$*UTF8*$!
2 | {
3 | archiveVersion = 1;
4 | classes = {
5 | };
6 | objectVersion = 46;
7 | objects = {
8 |
9 | /* Begin PBXBuildFile section */
10 | 03BAB7FD1DC372B30005EAB8 /* RNTouchbarManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 03BAB7FB1DC372B30005EAB8 /* RNTouchbarManager.h */; };
11 | 03BAB7FE1DC372B30005EAB8 /* RNTouchbarManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 03BAB7FC1DC372B30005EAB8 /* RNTouchbarManager.m */; };
12 | 03BAB8011DC373360005EAB8 /* RNTouchbarRootView.h in Headers */ = {isa = PBXBuildFile; fileRef = 03BAB7FF1DC373360005EAB8 /* RNTouchbarRootView.h */; };
13 | 03BAB8021DC373360005EAB8 /* RNTouchbarRootView.m in Sources */ = {isa = PBXBuildFile; fileRef = 03BAB8001DC373360005EAB8 /* RNTouchbarRootView.m */; };
14 | /* End PBXBuildFile section */
15 |
16 | /* Begin PBXFileReference section */
17 | 03BAB7D61DC36BE70005EAB8 /* libRNTouchbar.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libRNTouchbar.a; sourceTree = BUILT_PRODUCTS_DIR; };
18 | 03BAB7FB1DC372B30005EAB8 /* RNTouchbarManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RNTouchbarManager.h; sourceTree = ""; };
19 | 03BAB7FC1DC372B30005EAB8 /* RNTouchbarManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RNTouchbarManager.m; sourceTree = ""; };
20 | 03BAB7FF1DC373360005EAB8 /* RNTouchbarRootView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RNTouchbarRootView.h; sourceTree = ""; };
21 | 03BAB8001DC373360005EAB8 /* RNTouchbarRootView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RNTouchbarRootView.m; sourceTree = ""; };
22 | /* End PBXFileReference section */
23 |
24 | /* Begin PBXFrameworksBuildPhase section */
25 | 03BAB7D31DC36BE70005EAB8 /* Frameworks */ = {
26 | isa = PBXFrameworksBuildPhase;
27 | buildActionMask = 2147483647;
28 | files = (
29 | );
30 | runOnlyForDeploymentPostprocessing = 0;
31 | };
32 | /* End PBXFrameworksBuildPhase section */
33 |
34 | /* Begin PBXGroup section */
35 | 03BAB7CD1DC36BE70005EAB8 = {
36 | isa = PBXGroup;
37 | children = (
38 | 03BAB7D81DC36BE70005EAB8 /* RNTouchbar */,
39 | 03BAB7D71DC36BE70005EAB8 /* Products */,
40 | );
41 | sourceTree = "";
42 | };
43 | 03BAB7D71DC36BE70005EAB8 /* Products */ = {
44 | isa = PBXGroup;
45 | children = (
46 | 03BAB7D61DC36BE70005EAB8 /* libRNTouchbar.a */,
47 | );
48 | name = Products;
49 | sourceTree = "";
50 | };
51 | 03BAB7D81DC36BE70005EAB8 /* RNTouchbar */ = {
52 | isa = PBXGroup;
53 | children = (
54 | 03BAB7FF1DC373360005EAB8 /* RNTouchbarRootView.h */,
55 | 03BAB8001DC373360005EAB8 /* RNTouchbarRootView.m */,
56 | 03BAB7FB1DC372B30005EAB8 /* RNTouchbarManager.h */,
57 | 03BAB7FC1DC372B30005EAB8 /* RNTouchbarManager.m */,
58 | );
59 | path = RNTouchbar;
60 | sourceTree = "";
61 | };
62 | /* End PBXGroup section */
63 |
64 | /* Begin PBXHeadersBuildPhase section */
65 | 03BAB7D41DC36BE70005EAB8 /* Headers */ = {
66 | isa = PBXHeadersBuildPhase;
67 | buildActionMask = 2147483647;
68 | files = (
69 | 03BAB7FD1DC372B30005EAB8 /* RNTouchbarManager.h in Headers */,
70 | 03BAB8011DC373360005EAB8 /* RNTouchbarRootView.h in Headers */,
71 | );
72 | runOnlyForDeploymentPostprocessing = 0;
73 | };
74 | /* End PBXHeadersBuildPhase section */
75 |
76 | /* Begin PBXNativeTarget section */
77 | 03BAB7D51DC36BE70005EAB8 /* RNTouchbar */ = {
78 | isa = PBXNativeTarget;
79 | buildConfigurationList = 03BAB7DF1DC36BE70005EAB8 /* Build configuration list for PBXNativeTarget "RNTouchbar" */;
80 | buildPhases = (
81 | 03BAB7D21DC36BE70005EAB8 /* Sources */,
82 | 03BAB7D31DC36BE70005EAB8 /* Frameworks */,
83 | 03BAB7D41DC36BE70005EAB8 /* Headers */,
84 | );
85 | buildRules = (
86 | );
87 | dependencies = (
88 | );
89 | name = RNTouchbar;
90 | productName = RNTouchbar;
91 | productReference = 03BAB7D61DC36BE70005EAB8 /* libRNTouchbar.a */;
92 | productType = "com.apple.product-type.library.static";
93 | };
94 | /* End PBXNativeTarget section */
95 |
96 | /* Begin PBXProject section */
97 | 03BAB7CE1DC36BE70005EAB8 /* Project object */ = {
98 | isa = PBXProject;
99 | attributes = {
100 | LastUpgradeCheck = 0810;
101 | ORGANIZATIONNAME = Skilled;
102 | TargetAttributes = {
103 | 03BAB7D51DC36BE70005EAB8 = {
104 | CreatedOnToolsVersion = 8.1;
105 | ProvisioningStyle = Automatic;
106 | };
107 | };
108 | };
109 | buildConfigurationList = 03BAB7D11DC36BE70005EAB8 /* Build configuration list for PBXProject "RNTouchbar" */;
110 | compatibilityVersion = "Xcode 3.2";
111 | developmentRegion = English;
112 | hasScannedForEncodings = 0;
113 | knownRegions = (
114 | en,
115 | );
116 | mainGroup = 03BAB7CD1DC36BE70005EAB8;
117 | productRefGroup = 03BAB7D71DC36BE70005EAB8 /* Products */;
118 | projectDirPath = "";
119 | projectRoot = "";
120 | targets = (
121 | 03BAB7D51DC36BE70005EAB8 /* RNTouchbar */,
122 | );
123 | };
124 | /* End PBXProject section */
125 |
126 | /* Begin PBXSourcesBuildPhase section */
127 | 03BAB7D21DC36BE70005EAB8 /* Sources */ = {
128 | isa = PBXSourcesBuildPhase;
129 | buildActionMask = 2147483647;
130 | files = (
131 | 03BAB8021DC373360005EAB8 /* RNTouchbarRootView.m in Sources */,
132 | 03BAB7FE1DC372B30005EAB8 /* RNTouchbarManager.m in Sources */,
133 | );
134 | runOnlyForDeploymentPostprocessing = 0;
135 | };
136 | /* End PBXSourcesBuildPhase section */
137 |
138 | /* Begin XCBuildConfiguration section */
139 | 03BAB7DD1DC36BE70005EAB8 /* Debug */ = {
140 | isa = XCBuildConfiguration;
141 | buildSettings = {
142 | ALWAYS_SEARCH_USER_PATHS = NO;
143 | CLANG_ANALYZER_NONNULL = YES;
144 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
145 | CLANG_CXX_LIBRARY = "libc++";
146 | CLANG_ENABLE_MODULES = YES;
147 | CLANG_ENABLE_OBJC_ARC = YES;
148 | CLANG_WARN_BOOL_CONVERSION = YES;
149 | CLANG_WARN_CONSTANT_CONVERSION = YES;
150 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
151 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
152 | CLANG_WARN_EMPTY_BODY = YES;
153 | CLANG_WARN_ENUM_CONVERSION = YES;
154 | CLANG_WARN_INFINITE_RECURSION = YES;
155 | CLANG_WARN_INT_CONVERSION = YES;
156 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
157 | CLANG_WARN_SUSPICIOUS_MOVES = YES;
158 | CLANG_WARN_UNREACHABLE_CODE = YES;
159 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
160 | CODE_SIGN_IDENTITY = "-";
161 | COPY_PHASE_STRIP = NO;
162 | DEBUG_INFORMATION_FORMAT = dwarf;
163 | ENABLE_STRICT_OBJC_MSGSEND = YES;
164 | ENABLE_TESTABILITY = YES;
165 | GCC_C_LANGUAGE_STANDARD = gnu99;
166 | GCC_DYNAMIC_NO_PIC = NO;
167 | GCC_NO_COMMON_BLOCKS = YES;
168 | GCC_OPTIMIZATION_LEVEL = 0;
169 | GCC_PREPROCESSOR_DEFINITIONS = (
170 | "DEBUG=1",
171 | "$(inherited)",
172 | );
173 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
174 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
175 | GCC_WARN_UNDECLARED_SELECTOR = YES;
176 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
177 | GCC_WARN_UNUSED_FUNCTION = YES;
178 | GCC_WARN_UNUSED_VARIABLE = YES;
179 | LIBRARY_SEARCH_PATHS = "";
180 | MACOSX_DEPLOYMENT_TARGET = 10.12;
181 | MTL_ENABLE_DEBUG_INFO = YES;
182 | ONLY_ACTIVE_ARCH = YES;
183 | SDKROOT = macosx;
184 | USER_HEADER_SEARCH_PATHS = "$(SRCROOT)/../../react-native-macos/React/**";
185 | };
186 | name = Debug;
187 | };
188 | 03BAB7DE1DC36BE70005EAB8 /* Release */ = {
189 | isa = XCBuildConfiguration;
190 | buildSettings = {
191 | ALWAYS_SEARCH_USER_PATHS = NO;
192 | CLANG_ANALYZER_NONNULL = YES;
193 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
194 | CLANG_CXX_LIBRARY = "libc++";
195 | CLANG_ENABLE_MODULES = YES;
196 | CLANG_ENABLE_OBJC_ARC = YES;
197 | CLANG_WARN_BOOL_CONVERSION = YES;
198 | CLANG_WARN_CONSTANT_CONVERSION = YES;
199 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
200 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
201 | CLANG_WARN_EMPTY_BODY = YES;
202 | CLANG_WARN_ENUM_CONVERSION = YES;
203 | CLANG_WARN_INFINITE_RECURSION = YES;
204 | CLANG_WARN_INT_CONVERSION = YES;
205 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
206 | CLANG_WARN_SUSPICIOUS_MOVES = YES;
207 | CLANG_WARN_UNREACHABLE_CODE = YES;
208 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
209 | CODE_SIGN_IDENTITY = "-";
210 | COPY_PHASE_STRIP = NO;
211 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
212 | ENABLE_NS_ASSERTIONS = NO;
213 | ENABLE_STRICT_OBJC_MSGSEND = YES;
214 | GCC_C_LANGUAGE_STANDARD = gnu99;
215 | GCC_NO_COMMON_BLOCKS = YES;
216 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
217 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
218 | GCC_WARN_UNDECLARED_SELECTOR = YES;
219 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
220 | GCC_WARN_UNUSED_FUNCTION = YES;
221 | GCC_WARN_UNUSED_VARIABLE = YES;
222 | LIBRARY_SEARCH_PATHS = "";
223 | MACOSX_DEPLOYMENT_TARGET = 10.12;
224 | MTL_ENABLE_DEBUG_INFO = NO;
225 | SDKROOT = macosx;
226 | USER_HEADER_SEARCH_PATHS = "$(SRCROOT)/../../react-native-macos/React/**";
227 | };
228 | name = Release;
229 | };
230 | 03BAB7E01DC36BE70005EAB8 /* Debug */ = {
231 | isa = XCBuildConfiguration;
232 | buildSettings = {
233 | EXECUTABLE_PREFIX = lib;
234 | PRODUCT_NAME = "$(TARGET_NAME)";
235 | };
236 | name = Debug;
237 | };
238 | 03BAB7E11DC36BE70005EAB8 /* Release */ = {
239 | isa = XCBuildConfiguration;
240 | buildSettings = {
241 | EXECUTABLE_PREFIX = lib;
242 | PRODUCT_NAME = "$(TARGET_NAME)";
243 | };
244 | name = Release;
245 | };
246 | /* End XCBuildConfiguration section */
247 |
248 | /* Begin XCConfigurationList section */
249 | 03BAB7D11DC36BE70005EAB8 /* Build configuration list for PBXProject "RNTouchbar" */ = {
250 | isa = XCConfigurationList;
251 | buildConfigurations = (
252 | 03BAB7DD1DC36BE70005EAB8 /* Debug */,
253 | 03BAB7DE1DC36BE70005EAB8 /* Release */,
254 | );
255 | defaultConfigurationIsVisible = 0;
256 | defaultConfigurationName = Release;
257 | };
258 | 03BAB7DF1DC36BE70005EAB8 /* Build configuration list for PBXNativeTarget "RNTouchbar" */ = {
259 | isa = XCConfigurationList;
260 | buildConfigurations = (
261 | 03BAB7E01DC36BE70005EAB8 /* Debug */,
262 | 03BAB7E11DC36BE70005EAB8 /* Release */,
263 | );
264 | defaultConfigurationIsVisible = 0;
265 | };
266 | /* End XCConfigurationList section */
267 | };
268 | rootObject = 03BAB7CE1DC36BE70005EAB8 /* Project object */;
269 | }
270 |
--------------------------------------------------------------------------------
/RNTouchbar/RNTouchbar.xcodeproj/xcuserdata/potomushto.xcuserdatad/xcschemes/RNTouchbar.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
24 |
25 |
30 |
31 |
32 |
33 |
34 |
35 |
45 |
46 |
52 |
53 |
54 |
55 |
56 |
57 |
63 |
64 |
70 |
71 |
72 |
73 |
75 |
76 |
79 |
80 |
81 |
--------------------------------------------------------------------------------
/RNTouchbar/RNTouchbar.xcodeproj/xcuserdata/potomushto.xcuserdatad/xcschemes/xcschememanagement.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | SchemeUserState
6 |
7 | RNTouchbar.xcscheme
8 |
9 | orderHint
10 | 2
11 |
12 |
13 | SuppressBuildableAutocreation
14 |
15 | 03BAB7D51DC36BE70005EAB8
16 |
17 | primary
18 |
19 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/RNTouchbar/RNTouchbar/RNTouchbarManager.h:
--------------------------------------------------------------------------------
1 | //
2 | // RNTouchbar.h
3 | // RNTouchbar
4 | //
5 | // Created by Dmitriy Loktev on 10/28/16.
6 | // Copyright © 2016 React Native Community. All rights reserved.
7 | //
8 |
9 | #import
10 | #import
11 |
12 | #import "RCTViewManager.h"
13 |
14 | @interface RNTouchbarManager : RCTViewManager
15 | @end
16 |
--------------------------------------------------------------------------------
/RNTouchbar/RNTouchbar/RNTouchbarManager.m:
--------------------------------------------------------------------------------
1 | //
2 | // RNTouchbar.m
3 | // RNTouchbar
4 | //
5 | // Created by Dmitriy Loktev on 10/28/16.
6 | // Copyright © 2016 React Native Community. All rights reserved.
7 | //
8 |
9 | #import "RNTouchbarManager.h"
10 | #import "RNTouchbarRootView.h"
11 |
12 | @implementation RNTouchbarManager
13 |
14 | RCT_EXPORT_MODULE()
15 |
16 | - (NSView *)view
17 | {
18 | NSView *view = [[RNTouchbarRootView alloc] initWithEventDispatcher:self.bridge.eventDispatcher];
19 | return view;
20 | }
21 |
22 | - (RCTShadowView *)shadowView
23 | {
24 | return nil;
25 | }
26 |
27 | @end
28 |
--------------------------------------------------------------------------------
/RNTouchbar/RNTouchbar/RNTouchbarRootView.h:
--------------------------------------------------------------------------------
1 | //
2 | // RNTouchbar.h
3 | // RNTouchbar
4 | //
5 | // Created by Dmitriy Loktev on 10/28/16.
6 | // Copyright © 2016 React Native Community. All rights reserved.
7 | //
8 | #import
9 | #import "NSView+React.h"
10 | #import "React/RCTEventDispatcher.h"
11 |
12 | @interface NSWindow (Touchbar)
13 | @property (strong, nonatomic) NSCustomTouchBarItem *customViewItem;
14 | @property (strong, nonatomic) NSMutableArray *touchBarItems;
15 | @end
16 |
17 | @interface RNTouchbarRootView : NSView
18 |
19 | - (instancetype)initWithEventDispatcher:(RCTEventDispatcher *)eventDispatcher NS_DESIGNATED_INITIALIZER;
20 | @property (strong) NSCustomTouchBarItem *customViewItem;
21 | @end
22 |
--------------------------------------------------------------------------------
/RNTouchbar/RNTouchbar/RNTouchbarRootView.m:
--------------------------------------------------------------------------------
1 | //
2 | // RNTouchbar.m
3 | // RNTouchbar
4 | //
5 | // Created by Dmitriy Loktev on 10/28/16.
6 | // Copyright © 2016 React Native Community. All rights reserved.
7 | //
8 |
9 | #import "RNTouchbarRootView.h"
10 | #import
11 |
12 | // static NSTouchBarItemIdentifier CustomViewIdentifier = @"touchbarPrefix_";
13 | static NSTouchBarCustomizationIdentifier RNTouchbarIdentifier = @"RNTouchbarIdentifier";
14 |
15 | static void * TouchBarItemsKey = &TouchBarItemsKey;
16 |
17 | @implementation NSWindow (Touchbar)
18 |
19 | - (NSMutableArray *)touchBarItems {
20 | return objc_getAssociatedObject(self, TouchBarItemsKey);
21 | }
22 |
23 | - (void)setTouchBarItems:(NSMutableArray *)touchBarItems {
24 | objc_setAssociatedObject(self, TouchBarItemsKey, touchBarItems, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
25 | }
26 |
27 | - (NSTouchBar *)makeTouchBar
28 | {
29 | NSTouchBar *bar = [[NSTouchBar alloc] init];
30 | bar.delegate = self;
31 | bar.customizationIdentifier = RNTouchbarIdentifier;
32 |
33 | // Set the default ordering of items.
34 | NSMutableArray *ids = [[NSMutableArray alloc] init];
35 | [self.touchBarItems enumerateObjectsUsingBlock:^(id touchItem, NSUInteger index, BOOL *stop) {
36 | NSNumber *reactTag = ((NSCustomTouchBarItem *)touchItem).view.reactTag;
37 | [ids addObject:reactTag.stringValue];
38 | }];
39 |
40 | bar.defaultItemIdentifiers = [ids arrayByAddingObjectsFromArray:@[NSTouchBarItemIdentifierOtherItemsProxy]];
41 | bar.customizationAllowedItemIdentifiers = @[ids];
42 |
43 | return bar;
44 | }
45 |
46 | - (nullable NSTouchBarItem *)touchBar:(NSTouchBar *)touchBar makeItemForIdentifier:(NSTouchBarItemIdentifier)identifier
47 | {
48 | if (!self.touchBarItems || self.touchBarItems.count == 0) {
49 | return nil;
50 | }
51 | NSCustomTouchBarItem __block *toRender = nil;
52 | [self.touchBarItems enumerateObjectsUsingBlock:^(id touchItem, NSUInteger index, BOOL *stop) {
53 | if (((NSCustomTouchBarItem *)touchItem).view.reactTag.stringValue == identifier) {
54 | toRender = touchItem;
55 | }
56 | }];
57 | return toRender;
58 | }
59 |
60 | @end
61 |
62 | @implementation RNTouchbarRootView
63 | {
64 | NSMutableArray *toolbarItems;
65 | }
66 |
67 | -(instancetype)initWithEventDispatcher:(RCTEventDispatcher *)eventDispatcher
68 | {
69 | if ((self = [super initWithFrame:CGRectZero])) {
70 | [NSApp mainWindow].touchBarItems = [[NSMutableArray alloc] init];
71 | }
72 | return self;
73 | }
74 |
75 | - (void)insertReactSubview:(NSView *)subview atIndex:(NSInteger)atIndex
76 | {
77 | [super insertReactSubview:subview atIndex:atIndex];
78 | NSCustomTouchBarItem *touchItem = [[NSCustomTouchBarItem alloc] initWithIdentifier:subview.reactTag.stringValue];
79 | touchItem.view = subview;
80 | [[NSApp mainWindow].touchBarItems insertObject:touchItem atIndex:atIndex];
81 | [NSApp mainWindow].touchBar = nil;
82 | }
83 |
84 | - (void)removeReactSubview:(NSView *)subview
85 | {
86 | [super removeReactSubview:subview];
87 | self.touchBar = nil;
88 | }
89 |
90 | - (void)didUpdateReactSubviews
91 | {
92 | self.touchBar = nil;
93 |
94 | // Do nothing, as subviews are inserted by insertReactSubview:
95 | }
96 |
97 | @end
98 |
--------------------------------------------------------------------------------
/index.js:
--------------------------------------------------------------------------------
1 | //import { createReactNativeComponentClass } from 'react-native-macos';
2 | const createReactNativeComponentClass = require('react-native/Libraries/Renderer/src/renderers/native/createReactNativeComponentClass');
3 |
4 | const NativeRNTouchbar = createReactNativeComponentClass({
5 | validAttributes: {},
6 | uiViewClassName: 'RNTouchbar'
7 | });
8 |
9 | export default NativeRNTouchbar;
10 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "react-native-touchbar",
3 | "version": "1.1.0",
4 | "description": "NSTouchBar wrapper for react-native",
5 | "main": "index.js",
6 | "scripts": {
7 | "test": "echo \"Error: no test specified\" && exit 1"
8 | },
9 | "keywords": ["react-native", "touchbar", "macos", "courage"],
10 | "author": "Dmitriy Loktev",
11 | "license": "ISC"
12 | }
13 |
--------------------------------------------------------------------------------