Skip to content

Commit

Permalink
fix(android): fix pageMargin prop (#256)
Browse files Browse the repository at this point in the history
Co-authored-by: Mateusz Wit <[email protected]>
  • Loading branch information
2 people authored and ptrocki committed Dec 2, 2020
1 parent 6530a1f commit 39ea012
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
3 changes: 1 addition & 2 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,5 @@ repositories {
dependencies {
//noinspection GradleDynamicVersion
api 'com.facebook.react:react-native:+'
implementation 'com.github.troZee:ViewPager2:v1.0.6'

implementation 'com.github.troZee:ViewPager2:v1.0.7'
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import com.facebook.react.uimanager.ViewGroupManager;
import com.facebook.react.uimanager.annotations.ReactProp;
import com.facebook.react.uimanager.events.EventDispatcher;
import com.reactnative.community.viewpager2.widget.MarginPageTransformer;
import com.reactnative.community.viewpager2.widget.ViewPager2;
import com.reactnativecommunity.viewpager.event.PageScrollEvent;
import com.reactnativecommunity.viewpager.event.PageScrollStateChangedEvent;
Expand Down Expand Up @@ -222,7 +223,8 @@ public void receiveCommand(@NonNull final ViewPager2 root, int commandId, @Nulla
@ReactProp(name = "pageMargin", defaultFloat = 0)
public void setPageMargin(ViewPager2 pager, float margin) {
int pageMargin = (int) PixelUtil.toPixelFromDIP(margin);
pager.setPadding(pageMargin, pageMargin, pageMargin, pageMargin);
pager.setPageTransformer(new MarginPageTransformer(pageMargin));
}

}

}
4 changes: 2 additions & 2 deletions example/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ PODS:
- React-cxxreact (= 0.63.2)
- React-jsi (= 0.63.2)
- React-jsinspector (0.63.2)
- react-native-viewpager (4.1.3):
- react-native-viewpager (5.0.2):
- React
- React-RCTActionSheet (0.63.2):
- React-Core/RCTActionSheetHeaders (= 0.63.2)
Expand Down Expand Up @@ -450,7 +450,7 @@ SPEC CHECKSUMS:
React-jsi: 54245e1d5f4b690dec614a73a3795964eeef13a8
React-jsiexecutor: 8ca588cc921e70590820ce72b8789b02c67cce38
React-jsinspector: b14e62ebe7a66e9231e9581279909f2fc3db6606
react-native-viewpager: fdf68386dfb6fc4e702f32d054e662ae9a7f11c2
react-native-viewpager: e91997277c539a1175c42b39cfe931e4e641b536
React-RCTActionSheet: 910163b6b09685a35c4ebbc52b66d1bfbbe39fc5
React-RCTAnimation: 9a883bbe1e9d2e158d4fb53765ed64c8dc2200c6
React-RCTBlob: 39cf0ece1927996c4466510e25d2105f67010e13
Expand Down

0 comments on commit 39ea012

Please sign in to comment.