-
Notifications
You must be signed in to change notification settings - Fork 423
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat(iOS): change Fabric implementation to UIScrollView (#672) * feat(iOS): change Fabric implementation to UIScrollView * fix: fix offset values in vertical orientation * feat: add initialPage props support * feat: add RTL language support * feat: add pageMargin prop support * fix: fix typescript error * feat: remove React.cloneElement * feat(ios): add getPageOffset method * fix: fix styles in old example * fix: behavior on page remove * chore: add GH actions (#680) Co-authored-by: Piotr Trocki <[email protected]> * feat(iOS): rewrite old arch to use UIScrollView (#681) * feat: rewrite old arch to use UIScrollView * feat: update example styles * fix: sending event on scrollViewDidEndDecelerating * feat: properly calculate width using orientation * fix: change way of disabing scroll * feat: rename to RNCPagerView * fix: removing last page * fix: remove unused properties, set animated * chore: update release script * Release 7.0.0-rc.0 * wip * wip * fabric example * nit: comment * make init consistent * fix: multiple updates of frame and contentSize * feat: add button to quickly switch layout direction * sync with master (#756) Co-authored-by: Piotr Trocki <[email protected]> * chore: upgrade RN (paper example) * chore: upgrade rn & fix issues (fabric example) * chore: bump versions in package.json * chore: fix eslint issue * chore: exclude example from tsc * feat(next): remove fabric example * chore: update README * fix broken overdrag on notch (#787) Co-authored-by: Kuba Juszczyk <[email protected]> * feat(iOS): Add a `useLegacy` flag to switch between the old/new iOS implementation (#783) * wip: unsuspicious changes * wip: unsuspicious changes v2 * FABRIC NEW IMPL -> OLD IMPL * wip: bring back useLegacy on the RN side * wip: bring back duplicate types to fix codegen issues * wip: remove #705 related code for now * wip: old/new impl division first draft * wip: old/new impl division continued * wip: old/new impl v3 * wip: add a `LEGACY_` prefix to all legacy implementation-related symbols * wip: fix styles for new implementation on Fabric * wip: move old/new impl into separate folders * wip: fix old impl fabric symbol names * wip: xcode changes * wip: clean up & unify the naming convention * wip: fix linter issues * wip: fix styles for new implementation on Paper * wip: make Fabric example run on another port by default to make it possible to run both examples in parallel * wip: implement an abstraction over native commands invocations to reduce branching * refactor: remove the unnecessary value for boolean props * fix: bump react-native-safe-area-context to a Fabric-enabled version * feat: bring back & adjust the `bootstrap-fabric` script * feat: adjust the home screen title depending on the used architecture * chore: update example/Podfile.lock * chore: update an Xcode project file after building * ci: make next branch events trigger ios/android build workflows * chore: remove commented-out code related to #705 for now * chore: add legacy implementation explanation comment * wip: Android fixes * fix: unnecessary comma in MainActivity.java * feat: readme makeover * chore: bump react-native-screens & react-native-gesture-handler in example * refactor(android): extract module name to shared variable, add comment for context * chore: remove unnecessary yarn.lock deps * chore(ios): bring back removed build flags * chore(ios): remove unnecessary concurrentRootEnabled method According to React Native Upgrade Helper, this method is to be removed when updating to RN 0.72: https://react-native-community.github.io/upgrade-helper/?from=0.71.14&to=0.72.0#RnDiffApp-ios-RnDiffApp-AppDelegate.mm * fix(android): adjust incorrect param type on Fabric * chore: remove unnecessary tsconfig.json comment * chore(ios): bring back (currently unused) code related to #712 and #705 * Release 7.0.0-rc.1 * fix(ios): fix freezing when navigating to same index (#804) * Release 7.0.0-rc.2 * fix iOS issue * Change Legacy basic example into the next basic example * revert documentatation --------- Co-authored-by: Kacper Rożniata <[email protected]> Co-authored-by: Piotr Trocki <[email protected]> Co-authored-by: Oskar Kwaśniewski <[email protected]> Co-authored-by: Nishan <[email protected]> Co-authored-by: Kuba Juszczyk <[email protected]> Co-authored-by: Kuba Juszczyk <[email protected]> Co-authored-by: Igor Bejnarowicz <[email protected]>
- Loading branch information
1 parent
0662c31
commit 280c3a3
Showing
48 changed files
with
1,943 additions
and
1,774 deletions.
There are no files selected for viewing
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
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
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
17 changes: 17 additions & 0 deletions
17
android/src/fabric/java/com/reactnativepagerview/LEGACY_PagerViewViewManager.kt
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,17 @@ | ||
package com.reactnativepagerview | ||
|
||
import com.facebook.react.uimanager.ViewGroupManager | ||
import android.widget.FrameLayout | ||
import com.facebook.react.module.annotations.ReactModule | ||
import com.facebook.react.uimanager.ThemedReactContext | ||
|
||
// Note: The LEGACY_ variant is an iOS-only feature and the related Android files | ||
// are only included because of and relevant to auxiliary processes, like Codegen. | ||
@ReactModule(name = LEGACY_PagerViewViewManagerImpl.NAME) | ||
class LEGACY_PagerViewViewManager : ViewGroupManager<FrameLayout>() { | ||
override fun getName() = LEGACY_PagerViewViewManagerImpl.NAME | ||
|
||
override fun createViewInstance(context: ThemedReactContext): FrameLayout { | ||
throw Error("LEGACY_RNCViewPager is an iOS-only feature") | ||
} | ||
} |
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
7 changes: 7 additions & 0 deletions
7
android/src/main/java/com/reactnativepagerview/LEGACY_PagerViewViewManagerImpl.kt
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,7 @@ | ||
package com.reactnativepagerview | ||
|
||
// Note: The LEGACY_ variant is an iOS-only feature and the related Android files | ||
// are only included because of and relevant to auxiliary processes, like Codegen. | ||
object LEGACY_PagerViewViewManagerImpl { | ||
const val NAME = "LEGACY_RNCViewPager" | ||
} |
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
17 changes: 17 additions & 0 deletions
17
android/src/paper/java/com/reactnativepagerview/LEGACY_PagerViewViewManager.kt
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,17 @@ | ||
package com.reactnativepagerview | ||
|
||
import com.facebook.react.uimanager.ViewGroupManager | ||
import android.widget.FrameLayout | ||
import com.facebook.react.module.annotations.ReactModule | ||
import com.facebook.react.uimanager.ThemedReactContext | ||
|
||
// Note: The LEGACY_ variant is an iOS-only feature and the related Android files | ||
// are only included because of and relevant to auxiliary processes, like Codegen. | ||
@ReactModule(name = LEGACY_PagerViewViewManagerImpl.NAME) | ||
class LEGACY_PagerViewViewManager : ViewGroupManager<FrameLayout>() { | ||
override fun getName() = LEGACY_PagerViewViewManagerImpl.NAME | ||
|
||
override fun createViewInstance(context: ThemedReactContext): FrameLayout { | ||
throw Error("LEGACY_RNCViewPager is an iOS-only feature") | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
common/cpp/react/renderer/components/RNCViewPager/RNCViewPagerComponentDescriptor.h
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,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 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 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 | ||
|
||
#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 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 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 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 |
6 changes: 6 additions & 0 deletions
6
example/android/app/src/main/java/com/pagerviewexample/MainActivity.java
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
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
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
Oops, something went wrong.