Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 35b85b0
Showing
56 changed files
with
1,835 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"presets": ["react-native"] | ||
} |
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,6 @@ | ||
|
||
[android] | ||
target = Google Inc.:Google APIs:23 | ||
|
||
[maven_repositories] | ||
central = https://repo1.maven.org/maven2 |
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 @@ | ||
*.pbxproj -text |
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,64 @@ | ||
# OSX | ||
# | ||
.DS_Store | ||
|
||
# Xcode | ||
# | ||
build/ | ||
*.pbxuser | ||
!default.pbxuser | ||
*.mode1v3 | ||
!default.mode1v3 | ||
*.mode2v3 | ||
!default.mode2v3 | ||
*.perspectivev3 | ||
!default.perspectivev3 | ||
xcuserdata | ||
*.xccheckout | ||
*.moved-aside | ||
DerivedData | ||
*.hmap | ||
*.ipa | ||
*.xcuserstate | ||
project.xcworkspace | ||
|
||
# Android/IntelliJ | ||
# | ||
build/ | ||
.idea | ||
.gradle | ||
local.properties | ||
*.iml | ||
|
||
# node.js | ||
# | ||
node_modules/ | ||
npm-debug.log | ||
yarn-error.log | ||
|
||
# BUCK | ||
buck-out/ | ||
\.buckd/ | ||
*.keystore | ||
|
||
# fastlane | ||
# | ||
# It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the | ||
# screenshots whenever they are needed. | ||
# For more information about the recommended setup visit: | ||
# https://github.com/fastlane/fastlane/blob/master/fastlane/docs/Gitignore.md | ||
|
||
fastlane/report.xml | ||
fastlane/Preview.html | ||
fastlane/screenshots | ||
android/.gradle | ||
android/.idea | ||
android/app | ||
android/gradle/* | ||
android/gradlew | ||
android/gradlew.bat | ||
android/loca.properties | ||
android/android.iml | ||
android/RNCollapsibleToolbar.iml | ||
android/app/libs | ||
android/keystores/debug.keystore |
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 @@ | ||
example |
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 @@ | ||
{} |
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,40 @@ | ||
apply plugin: "com.android.library" | ||
|
||
android { | ||
compileSdkVersion 25 | ||
buildToolsVersion "23.0.1" | ||
|
||
defaultConfig { | ||
minSdkVersion 16 | ||
targetSdkVersion 25 | ||
versionCode 1 | ||
versionName "1.0" | ||
} | ||
} | ||
|
||
buildscript { | ||
repositories { | ||
jcenter() | ||
} | ||
dependencies { | ||
classpath 'com.android.tools.build:gradle:2.2.3' | ||
} | ||
} | ||
|
||
allprojects { | ||
repositories { | ||
mavenLocal() | ||
jcenter() | ||
maven { | ||
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm | ||
url "$projectDir/../example/node_modules/react-native/android" | ||
} | ||
} | ||
} | ||
|
||
dependencies { | ||
// compile project(':react-native-nested-scroll-view') | ||
compile 'com.facebook.react:react-native:+' | ||
compile 'com.android.support:appcompat-v7:25.3.1' | ||
compile 'com.android.support:design:25.3.1' | ||
} |
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,3 @@ | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
package="com.rncollapsingtoolbarlayout"> | ||
</manifest> |
78 changes: 78 additions & 0 deletions
78
android/src/main/java/com/rncollapsingtoolbarlayout/AppBarLayoutManager.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
package com.rncollapsingtoolbarlayout; | ||
|
||
import android.support.annotation.Nullable; | ||
import android.support.design.widget.AppBarLayout; | ||
|
||
import com.facebook.react.bridge.Arguments; | ||
import com.facebook.react.bridge.ReactContext; | ||
import com.facebook.react.bridge.WritableMap; | ||
import com.facebook.react.common.MapBuilder; | ||
import com.facebook.react.uimanager.PixelUtil; | ||
import com.facebook.react.uimanager.ViewGroupManager; | ||
import com.facebook.react.uimanager.ThemedReactContext; | ||
import com.facebook.react.uimanager.annotations.ReactProp; | ||
import com.facebook.react.uimanager.events.RCTEventEmitter; | ||
|
||
import java.util.HashMap; | ||
import java.util.Map; | ||
|
||
public class AppBarLayoutManager extends ViewGroupManager<AppBarLayoutView> | ||
implements AppBarLayout.OnOffsetChangedListener { | ||
|
||
private final static String REACT_CLASS = "RCTAppBarLayout"; | ||
|
||
@Override | ||
public String getName() { | ||
return REACT_CLASS; | ||
} | ||
|
||
@Override | ||
public AppBarLayoutView createViewInstance(ThemedReactContext context) { | ||
AppBarLayoutView view = new AppBarLayoutView(context); | ||
view.addOnOffsetChangedListener(this); | ||
return view; | ||
} | ||
|
||
@ReactProp(name = "height") | ||
public void setHeight(AppBarLayoutView view, int height) { | ||
AppBarLayout.LayoutParams params = (AppBarLayout.LayoutParams) view.getLayoutParams(); | ||
params.height = (int) PixelUtil.toPixelFromDIP(height); | ||
view.setLayoutParams(params); | ||
} | ||
|
||
@Override | ||
public Map<String, Object> getExportedViewConstants() { | ||
final Map<String, Object> constants = new HashMap<>(); | ||
constants.put("SCROLL_FLAG_SNAP", AppBarLayout.LayoutParams.SCROLL_FLAG_SNAP); | ||
constants.put("SCROLL_FLAG_SCROLL", AppBarLayout.LayoutParams.SCROLL_FLAG_SCROLL); | ||
constants.put("SCROLL_FLAG_ENTER_ALWAYS", AppBarLayout.LayoutParams.SCROLL_FLAG_ENTER_ALWAYS); | ||
constants.put("SCROLL_FLAG_EXIT_UNTIL_COLLAPSED", AppBarLayout.LayoutParams.SCROLL_FLAG_EXIT_UNTIL_COLLAPSED); | ||
constants.put("SCROLL_FLAG_ENTER_ALWAYS_COLLAPSED", AppBarLayout.LayoutParams.SCROLL_FLAG_ENTER_ALWAYS_COLLAPSED); | ||
return constants; | ||
} | ||
|
||
@Nullable | ||
@Override | ||
public Map<String, Object> getExportedCustomBubblingEventTypeConstants() { | ||
return MapBuilder.<String, Object>builder() | ||
.put("topOffsetChanged", | ||
MapBuilder.of( | ||
"phasedRegistrationNames", | ||
MapBuilder.of( | ||
"bubbled", "onOffsetChanged", "captured", "onOffsetChangedCapture"))) | ||
.build(); | ||
} | ||
|
||
@Override | ||
public boolean needsCustomLayoutForChildren() { | ||
return true; | ||
} | ||
|
||
@Override | ||
public void onOffsetChanged(AppBarLayout appBarLayout, int verticalOffset) { | ||
WritableMap event = Arguments.createMap(); | ||
event.putDouble("offset", verticalOffset); | ||
ReactContext reactContext = (ReactContext) appBarLayout.getContext(); | ||
reactContext.getJSModule(RCTEventEmitter.class).receiveEvent(appBarLayout.getId(), "topOffsetChanged", event); | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
android/src/main/java/com/rncollapsingtoolbarlayout/AppBarLayoutView.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package com.rncollapsingtoolbarlayout; | ||
|
||
import android.content.Context; | ||
import android.support.design.widget.AppBarLayout; | ||
import android.view.ViewGroup; | ||
|
||
public class AppBarLayoutView extends AppBarLayout { | ||
public AppBarLayoutView(Context context) { | ||
super(context); | ||
|
||
int width = ViewGroup.LayoutParams.MATCH_PARENT; | ||
int height = ViewGroup.LayoutParams.WRAP_CONTENT; | ||
|
||
AppBarLayout.LayoutParams params = new AppBarLayout.LayoutParams(width, height); | ||
|
||
this.setLayoutParams(params); | ||
} | ||
} |
37 changes: 37 additions & 0 deletions
37
android/src/main/java/com/rncollapsingtoolbarlayout/CollapsingParallaxManager.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package com.rncollapsingtoolbarlayout; | ||
|
||
import android.support.design.widget.CollapsingToolbarLayout; | ||
import android.widget.FrameLayout; | ||
|
||
import com.facebook.react.uimanager.ThemedReactContext; | ||
import com.facebook.react.uimanager.ViewGroupManager; | ||
import com.facebook.react.uimanager.annotations.ReactProp; | ||
|
||
public class CollapsingParallaxManager extends ViewGroupManager<FrameLayout> { | ||
|
||
private final static String REACT_CLASS = "RCTCollapsingParallax"; | ||
|
||
@Override | ||
public String getName() { | ||
return REACT_CLASS; | ||
} | ||
|
||
@Override | ||
public FrameLayout createViewInstance(ThemedReactContext context) { | ||
FrameLayout view = new FrameLayout(context); | ||
CollapsingToolbarLayout.LayoutParams params = new CollapsingToolbarLayout.LayoutParams( | ||
CollapsingToolbarLayout.LayoutParams.MATCH_PARENT, | ||
CollapsingToolbarLayout.LayoutParams.WRAP_CONTENT | ||
); | ||
params.setCollapseMode(CollapsingToolbarLayout.LayoutParams.COLLAPSE_MODE_PARALLAX); | ||
view.setLayoutParams(params); | ||
return view; | ||
} | ||
|
||
@ReactProp(name = "parallaxMultiplier") | ||
public void setParallaxMultiplier(FrameLayout view, float multiplier) { | ||
CollapsingToolbarLayout.LayoutParams params = (CollapsingToolbarLayout.LayoutParams) view.getLayoutParams(); | ||
params.setParallaxMultiplier(multiplier); | ||
view.setLayoutParams(params); | ||
} | ||
} |
Oops, something went wrong.