Skip to content

Commit 0f613c4

Browse files
committed
add primaryColor属性
1 parent 2a35d2a commit 0f613c4

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

android/src/main/java/com/lmy/header/AnyHeaderManager.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
package com.lmy.header;
22

3+
import android.graphics.Color;
4+
import android.support.annotation.ColorInt;
5+
36
import com.facebook.react.uimanager.ThemedReactContext;
47
import com.facebook.react.uimanager.ViewGroupManager;
8+
import com.facebook.react.uimanager.annotations.ReactProp;
59

610
/**
711
* Created by painter.g on 2018/3/12.
@@ -17,4 +21,16 @@ public String getName() {
1721
protected AnyHeader createViewInstance(ThemedReactContext reactContext) {
1822
return new AnyHeader(reactContext);
1923
}
24+
25+
/**
26+
* 设置主调色
27+
* @param view
28+
* @param primaryColor
29+
*/
30+
@ReactProp(name = "primaryColor")
31+
public void setPrimaryColor(AnyHeader view, String primaryColor){
32+
if(primaryColor!=null && !"".equals(primaryColor)){
33+
view.setPrimaryColor(Color.parseColor(primaryColor));
34+
}
35+
}
2036
}

0 commit comments

Comments
 (0)