-
-
Notifications
You must be signed in to change notification settings - Fork 547
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Publish fabric and classic architecture release #1308
Changes from 1 commit
cec0c26
7640e12
139a35b
94331d0
91d72f1
e3a96c2
8c010f5
054ae53
93217e4
9a00c71
e7f91e4
f835211
69af2ba
75e42aa
59ab207
0aaba53
1fc6d23
6d12b61
9d505a9
8fb1188
84e027e
73c5abf
f2b353e
da1226c
d6c0b0e
77b12b3
d9bedb3
3fdd3cd
114303c
60fab66
5c0fefe
35b438b
811cb8f
27e6b64
8300aa7
b078768
27314c9
25c9504
f4a37fb
a88f709
8ff3184
b6eae2d
e3a47da
4157680
3ff4603
fdebee4
bff934b
50404fc
d746f90
36cc005
28d19c4
3ce017a
84cd443
30850d4
3236937
3060d55
5ec3e2e
d7bb845
74462ff
0cb0f5e
97a67c2
61c9eda
11b9e0a
09b6007
c9c572c
d1887fe
57e645b
8c8d6c6
b0defb1
0d83832
071bdb6
ca51fce
06ef57a
5c71ccc
fe3e241
4e650fb
344aa01
9e7d2b1
b3102f1
6a0f07d
c992af7
3eb5b7a
9654ac4
5e2da1f
e41fd1b
10f3bee
668a8a7
eca2524
d358096
ed412ef
c59ae3b
69e63ae
2ed283e
dbc1c5c
33dd3b7
0f545e2
b484d5f
24a4db6
53f9b78
b4cf6d9
4796975
36f47cc
5198eb7
48f688c
a72df9e
da0ba74
743fa87
641e5a5
65db4b1
d267301
b99af0d
17fe593
b15e62a
3a8396e
60632f7
eb3d555
e56f572
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,8 +16,8 @@ @interface RNSScreenComponentView () <RCTRNSScreenViewProtocol> | |
@end | ||
|
||
@implementation RNSScreenComponentView { | ||
RNSScreenController *_controller; | ||
RNSScreenShadowNode::ConcreteState::Shared _state; | ||
RNSScreenController *_controller; | ||
RNSScreenShadowNode::ConcreteState::Shared _state; | ||
} | ||
|
||
- (instancetype)initWithFrame:(CGRect)frame | ||
|
@@ -40,24 +40,23 @@ - (void)mountChildComponentView:(UIView<RCTComponentViewProtocol> *)childCompone | |
} | ||
} | ||
|
||
|
||
- (void)unmountChildComponentView:(UIView<RCTComponentViewProtocol> *)childComponentView index:(NSInteger)index | ||
{ | ||
if ([childComponentView isKindOfClass:[RNSScreenStackHeaderConfigComponentView class]]) { | ||
_config = nil; | ||
_config = nil; | ||
} | ||
[super unmountChildComponentView:childComponentView index:index]; | ||
} | ||
|
||
- (void)updateBounds | ||
{ | ||
if (_state != nullptr) { | ||
auto boundsSize = self.bounds.size; | ||
auto newState = RNSScreenState{RCTSizeFromCGSize(boundsSize)}; | ||
_state->updateState(std::move(newState)); | ||
UINavigationController *navctr = _controller.navigationController; | ||
[navctr.view setNeedsLayout]; | ||
} | ||
if (_state != nullptr) { | ||
auto boundsSize = self.bounds.size; | ||
auto newState = RNSScreenState{RCTSizeFromCGSize(boundsSize)}; | ||
_state->updateState(std::move(newState)); | ||
UINavigationController *navctr = _controller.navigationController; | ||
[navctr.view setNeedsLayout]; | ||
} | ||
} | ||
|
||
- (UIView *)reactSuperview | ||
|
@@ -67,63 +66,59 @@ - (UIView *)reactSuperview | |
|
||
- (void)notifyWillAppear | ||
{ | ||
// If screen is already unmounted then there will be no event emitter | ||
// it will be cleaned in prepareForRecycle | ||
if(_eventEmitter!=nullptr){ | ||
std::dynamic_pointer_cast<const RNSScreenEventEmitter>(_eventEmitter) | ||
->onWillAppear(RNSScreenEventEmitter::OnWillAppear{}); | ||
} | ||
// If screen is already unmounted then there will be no event emitter | ||
// it will be cleaned in prepareForRecycle | ||
if (_eventEmitter != nullptr) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. maybe move the body to separate method and call proper event based on the method argument? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am not sure if that would be a good solution. These events are already in separate methods There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. But the code is repeated for all 4 lifecycle events, and the only change is the type of event in them, so it seems like an easy thing to move to a method. No strong opinion on it though. |
||
std::dynamic_pointer_cast<const RNSScreenEventEmitter>(_eventEmitter) | ||
->onWillAppear(RNSScreenEventEmitter::OnWillAppear{}); | ||
} | ||
} | ||
|
||
- (void)notifyWillDisappear | ||
{ | ||
// If screen is already unmounted then there will be no event emitter | ||
// it will be cleaned in prepareForRecycle | ||
if(_eventEmitter!=nullptr){ | ||
std::dynamic_pointer_cast<const RNSScreenEventEmitter>(_eventEmitter) | ||
->onWillDisappear(RNSScreenEventEmitter::OnWillDisappear{}); | ||
} | ||
// If screen is already unmounted then there will be no event emitter | ||
// it will be cleaned in prepareForRecycle | ||
if (_eventEmitter != nullptr) { | ||
std::dynamic_pointer_cast<const RNSScreenEventEmitter>(_eventEmitter) | ||
->onWillDisappear(RNSScreenEventEmitter::OnWillDisappear{}); | ||
} | ||
} | ||
|
||
- (void)notifyAppear | ||
{ | ||
// If screen is already unmounted then there will be no event emitter | ||
// it will be cleaned in prepareForRecycle | ||
if(_eventEmitter!=nullptr){ | ||
std::dynamic_pointer_cast<const RNSScreenEventEmitter>(_eventEmitter) | ||
->onAppear(RNSScreenEventEmitter::OnAppear{}); | ||
} | ||
// If screen is already unmounted then there will be no event emitter | ||
// it will be cleaned in prepareForRecycle | ||
if (_eventEmitter != nullptr) { | ||
std::dynamic_pointer_cast<const RNSScreenEventEmitter>(_eventEmitter)->onAppear(RNSScreenEventEmitter::OnAppear{}); | ||
} | ||
} | ||
|
||
- (void)notifyDismissedWithCount:(int)dismissCount | ||
{ | ||
if(_eventEmitter!=nullptr){ | ||
std::dynamic_pointer_cast<const RNSScreenEventEmitter>(_eventEmitter) | ||
->onDismissed(RNSScreenEventEmitter::OnDismissed{ | ||
dismissCount: dismissCount | ||
}); | ||
} | ||
if (_eventEmitter != nullptr) { | ||
std::dynamic_pointer_cast<const RNSScreenEventEmitter>(_eventEmitter) | ||
->onDismissed(RNSScreenEventEmitter::OnDismissed{dismissCount : dismissCount}); | ||
} | ||
} | ||
|
||
- (void)notifyDisappear | ||
{ | ||
// If screen is already unmounted then there will be no event emitter | ||
// it will be cleaned in prepareForRecycle | ||
if(_eventEmitter!=nullptr){ | ||
std::dynamic_pointer_cast<const RNSScreenEventEmitter>(_eventEmitter) | ||
->onDisappear(RNSScreenEventEmitter::OnDisappear{}); | ||
} | ||
// If screen is already unmounted then there will be no event emitter | ||
// it will be cleaned in prepareForRecycle | ||
if (_eventEmitter != nullptr) { | ||
std::dynamic_pointer_cast<const RNSScreenEventEmitter>(_eventEmitter) | ||
->onDisappear(RNSScreenEventEmitter::OnDisappear{}); | ||
} | ||
} | ||
|
||
|
||
#pragma mark - RCTComponentViewProtocol | ||
|
||
- (void)prepareForRecycle | ||
{ | ||
[super prepareForRecycle]; | ||
// TODO: Make sure that there is no edge case when this should be uncommented | ||
// _controller=nil; | ||
_state.reset(); | ||
[super prepareForRecycle]; | ||
// TODO: Make sure that there is no edge case when this should be uncommented | ||
Ubax marked this conversation as resolved.
Show resolved
Hide resolved
|
||
// _controller=nil; | ||
_state.reset(); | ||
} | ||
|
||
+ (ComponentDescriptorProvider)componentDescriptorProvider | ||
|
@@ -133,16 +128,16 @@ + (ComponentDescriptorProvider)componentDescriptorProvider | |
|
||
- (void)updateProps:(Props::Shared const &)props oldProps:(Props::Shared const &)oldProps | ||
{ | ||
const auto &oldScreenProps = *std::static_pointer_cast<const RNSScreenProps>(_props); | ||
const auto &newScreenProps = *std::static_pointer_cast<const RNSScreenProps>(props); | ||
const auto &oldScreenProps = *std::static_pointer_cast<const RNSScreenProps>(_props); | ||
const auto &newScreenProps = *std::static_pointer_cast<const RNSScreenProps>(props); | ||
|
||
[super updateProps:props oldProps:oldProps]; | ||
[super updateProps:props oldProps:oldProps]; | ||
} | ||
|
||
- (void)updateState:(facebook::react::State::Shared const &)state | ||
oldState:(facebook::react::State::Shared const &)oldState | ||
{ | ||
_state = std::static_pointer_cast<const RNSScreenShadowNode::ConcreteState>(state); | ||
_state = std::static_pointer_cast<const RNSScreenShadowNode::ConcreteState>(state); | ||
} | ||
|
||
@end | ||
|
@@ -151,4 +146,3 @@ - (void)updateState:(facebook::react::State::Shared const &)state | |
{ | ||
return RNSScreenComponentView.class; | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this line needed?