-
Notifications
You must be signed in to change notification settings - Fork 444
feat(iOS): change Fabric implementation to UIScrollView #672
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
Merged
Merged
Changes from 1 commit
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
c90e6e1
feat(iOS): change Fabric implementation to UIScrollView
krozniata 9e84e5f
fix: fix offset values in vertical orientation
krozniata 6113f38
feat: add initialPage props support
krozniata ff0afab
feat: add RTL language support
krozniata 5053860
feat: add pageMargin prop support
krozniata f458b5d
fix: fix typescript error
krozniata b20447f
feat: remove React.cloneElement
krozniata d725159
feat(ios): add getPageOffset method
krozniata 86020ee
fix: fix styles in old example
krozniata 5b2238f
fix: behavior on page remove
krozniata File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
12 changes: 12 additions & 0 deletions
12
common/cpp/react/renderer/components/RNCViewPager/RNCViewPagerComponentDescriptor.h
This file contains hidden or 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,12 @@ | ||
#pragma once | ||
|
||
#include "RNCViewPagerShadowNode.h" | ||
#include <react/renderer/core/ConcreteComponentDescriptor.h> | ||
|
||
namespace facebook { | ||
namespace react { | ||
|
||
using RNCViewPagerComponentDescriptor = ConcreteComponentDescriptor<RNCViewPagerShadowNode>; | ||
|
||
} | ||
} |
35 changes: 35 additions & 0 deletions
35
common/cpp/react/renderer/components/RNCViewPager/RNCViewPagerShadowNode.cpp
This file contains hidden or 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,35 @@ | ||
#include "RNCViewPagerShadowNode.h" | ||
|
||
#include <react/debug/react_native_assert.h> | ||
#include <react/renderer/core/LayoutMetrics.h> | ||
|
||
namespace facebook { | ||
namespace react { | ||
|
||
const char RNCViewPagerComponentName[] = "RNCViewPager"; | ||
|
||
void RNCViewPagerShadowNode::updateStateIfNeeded() { | ||
ensureUnsealed(); | ||
|
||
auto contentBoundingRect = Rect{}; | ||
for (const auto &childNode : getLayoutableChildNodes()) { | ||
contentBoundingRect.unionInPlace(childNode->getLayoutMetrics().frame); | ||
} | ||
|
||
auto state = getStateData(); | ||
|
||
if (state.contentBoundingRect != contentBoundingRect) { | ||
state.contentBoundingRect = contentBoundingRect; | ||
setStateData(std::move(state)); | ||
} | ||
} | ||
|
||
#pragma mark - LayoutableShadowNode | ||
|
||
void RNCViewPagerShadowNode::layout(LayoutContext layoutContext) { | ||
ConcreteViewShadowNode::layout(layoutContext); | ||
updateStateIfNeeded(); | ||
} | ||
|
||
} | ||
} |
31 changes: 31 additions & 0 deletions
31
common/cpp/react/renderer/components/RNCViewPager/RNCViewPagerShadowNode.h
This file contains hidden or 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,31 @@ | ||
#pragma once | ||
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. |
||
|
||
#include <react/renderer/components/RNCViewPager/EventEmitters.h> | ||
#include <react/renderer/components/RNCViewPager/Props.h> | ||
#include <react/renderer/components/RNCViewPager/RNCViewPagerState.h> | ||
#include <react/renderer/components/view/ConcreteViewShadowNode.h> | ||
#include <react/renderer/core/LayoutContext.h> | ||
|
||
namespace facebook { | ||
namespace react { | ||
|
||
extern const char RNCViewPagerComponentName[]; | ||
|
||
class RNCViewPagerShadowNode final : public ConcreteViewShadowNode< | ||
RNCViewPagerComponentName, | ||
RNCViewPagerProps, | ||
RNCViewPagerEventEmitter, | ||
RNCViewPagerState> { | ||
public: | ||
using ConcreteViewShadowNode::ConcreteViewShadowNode; | ||
|
||
#pragma mark - LayoutableShadowNode | ||
|
||
void layout(LayoutContext layoutContext) override; | ||
|
||
private: | ||
void updateStateIfNeeded(); | ||
}; | ||
|
||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
common/cpp/react/renderer/components/RNCViewPager/RNCViewPagerState.cpp
This file contains hidden or 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,11 @@ | ||
#include "RNCViewPagerState.h" | ||
|
||
namespace facebook { | ||
namespace react { | ||
|
||
Size RNCViewPagerState::getContentSize() const { | ||
return contentBoundingRect.size; | ||
} | ||
|
||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
common/cpp/react/renderer/components/RNCViewPager/RNCViewPagerState.h
This file contains hidden or 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,18 @@ | ||
#pragma once | ||
|
||
#include <react/renderer/graphics/Geometry.h> | ||
|
||
namespace facebook { | ||
namespace react { | ||
|
||
class RNCViewPagerState final { | ||
public: | ||
Point contentOffset; | ||
Rect contentBoundingRect; | ||
|
||
Size getContentSize() const; | ||
|
||
}; | ||
|
||
} | ||
} |
This file contains hidden or 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 hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
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.
any way to generate that with codegen or suggest the feature request?
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.
Right now, the codegen generates those files inside a build folder. We can suggest a feature request and request a comment from other developers, on what they think about it.