-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(ios): add support for new architecture
- Loading branch information
1 parent
c9837bb
commit 8f22eed
Showing
8 changed files
with
118 additions
and
94 deletions.
There are no files selected for viewing
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,20 @@ | ||
// This guard prevent this file to be compiled in the old architecture. | ||
#ifdef RCT_NEW_ARCH_ENABLED | ||
#import <React/RCTViewComponentView.h> | ||
#import <React/RCTConversions.h> | ||
#import <WebKit/WKDataDetectorTypes.h> | ||
#import <UIKit/UIKit.h> | ||
#import <react/renderer/components/ApiVideoLiveStreamView/Props.h> | ||
|
||
#ifndef RNLiveStreamView_h | ||
#define RNLiveStreamView_h | ||
|
||
NS_ASSUME_NONNULL_BEGIN | ||
|
||
@interface RNLiveStreamView : RCTViewComponentView | ||
@end | ||
|
||
NS_ASSUME_NONNULL_END | ||
|
||
#endif /* RNLiveStreamView_h */ | ||
#endif /* RCT_NEW_ARCH_ENABLED */ |
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,86 @@ | ||
// This guard prevent the code from being compiled in the old architecture | ||
#ifdef RCT_NEW_ARCH_ENABLED | ||
#import "RNLiveStreamView.h" | ||
|
||
#import <react/renderer/components/ApiVideoLiveStreamView/ComponentDescriptors.h> | ||
#import <react/renderer/components/ApiVideoLiveStreamView/EventEmitters.h> | ||
#import <react/renderer/components/ApiVideoLiveStreamView/Props.h> | ||
#import <react/renderer/components/ApiVideoLiveStreamView/RCTComponentViewHelpers.h> | ||
|
||
#import "RCTFabricComponentsPlugins.h" | ||
|
||
// MARK: Swift classes in ObjC++ | ||
#if __has_include("react-native-livestream/react-native-livestream-Swift.h") | ||
#import "ReactNativeAvoidSoftinput/ReactNativeAvoidSoftinput-Swift.h" | ||
#else | ||
#import "react-native-livestream-Swift.h" | ||
#endif | ||
|
||
using namespace facebook::react; | ||
|
||
@class RNLiveStreamViewImpl; | ||
|
||
@interface RNLiveStreamView () <RCTApiVideoLiveStreamViewViewProtocol> | ||
|
||
@end | ||
|
||
// MARK: Implementation | ||
|
||
@implementation RNLiveStreamView { | ||
RNLiveStreamViewImpl * _view; | ||
} | ||
|
||
// MARK: Initializers | ||
- (instancetype)initWithFrame:(CGRect)frame | ||
{ | ||
self = [super initWithFrame:frame]; | ||
if (self) { | ||
static const auto defaultProps = std::make_shared<const ApiVideoLiveStreamViewProps>(); | ||
_props = defaultProps; | ||
|
||
_view = [[RNLiveStreamViewImpl alloc] init]; | ||
|
||
// TODO: events | ||
|
||
self.contentView = _view; | ||
} | ||
return self; | ||
} | ||
|
||
// MARK: Props | ||
- (void)updateProps:(Props::Shared const &)props oldProps:(Props::Shared const &)oldProps | ||
{ | ||
const auto &oldViewProps = *std::static_pointer_cast<const ApiVideoLiveStreamViewProps>(_props); | ||
const auto &newViewProps = *std::static_pointer_cast<const ApiVideoLiveStreamViewProps>(props); | ||
|
||
RNLiveStreamViewImpl *view = (RNLiveStreamViewImpl *)self.contentView; | ||
|
||
// TODO: props | ||
|
||
[super updateProps:props oldProps:oldProps]; | ||
} | ||
|
||
// MARK: RCTComponentViewProtocol | ||
- (void)startStreaming:(NSString *)streamKey url:(NSString *)url | ||
{ | ||
[_view startStreaming:streamKey url:url]; | ||
} | ||
|
||
- (void)stopStreaming | ||
{ | ||
[_view stopStreaming]; | ||
} | ||
|
||
- (void)setZoomRatioCommand:(float)zoomRatio | ||
{ | ||
[_view setZoomRatioCommand:zoomRatio]; | ||
} | ||
|
||
@end | ||
|
||
Class<RCTComponentViewProtocol> ApiVideoLiveStreamViewCls(void) | ||
{ | ||
return RNLiveStreamView.class; | ||
} | ||
|
||
#endif |
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
File renamed without changes.
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