Skip to content

Commit 969be10

Browse files
committed
修复primaryColor出错的问题
1 parent 9d09c24 commit 969be10

File tree

2 files changed

+7
-12
lines changed

2 files changed

+7
-12
lines changed

SmartRefreshControl.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ import {
1212
} from 'react-native';
1313
import {ViewPropTypes} from './Util'
1414
import DefaultHeader from "./DefaultHeader";
15-
import PropTypes from 'prop-types'
15+
import PropTypes from 'prop-types';
16+
import processColor from 'react-native/Libraries/StyleSheet/processColor';
1617

1718
const SPModule =Platform.OS === 'android' ? NativeModules.SpinnerStyleModule : {};
1819

@@ -113,7 +114,8 @@ class SmartRefreshControl extends Component {
113114
onSmartRefresh:this._onSmartRefresh,
114115
onHeaderPulling:this._onHeaderPulling,
115116
onHeaderReleasing:this._onHeaderReleasing,
116-
onFooterMoving:this._onFooterMoving
117+
onFooterMoving:this._onFooterMoving,
118+
primaryColor: processColor(this.props.primaryColor),
117119
}}
118120
return (
119121
<SmartRefreshLayout

android/src/main/java/com/lmy/smartrefreshlayout/SmartRefreshLayoutManager.java

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
package com.lmy.smartrefreshlayout;
22

33
import android.graphics.Color;
4-
import android.support.annotation.NonNull;
5-
import android.view.Display;
64
import android.view.View;
75

86
import com.facebook.react.bridge.Arguments;
@@ -13,17 +11,12 @@
1311
import com.facebook.react.uimanager.ThemedReactContext;
1412
import com.facebook.react.uimanager.ViewGroupManager;
1513
import com.facebook.react.uimanager.annotations.ReactProp;
16-
import com.facebook.react.uimanager.annotations.ReactPropGroup;
1714
import com.facebook.react.uimanager.events.RCTEventEmitter;
1815
import com.lmy.header.AnyHeader;
19-
import com.scwang.smartrefresh.header.waveswipe.DisplayUtil;
2016
import com.scwang.smartrefresh.layout.api.RefreshFooter;
2117
import com.scwang.smartrefresh.layout.api.RefreshHeader;
22-
import com.scwang.smartrefresh.layout.api.RefreshInternal;
2318
import com.scwang.smartrefresh.layout.api.RefreshLayout;
2419
import com.scwang.smartrefresh.layout.constant.RefreshState;
25-
import com.scwang.smartrefresh.layout.listener.OnLoadMoreListener;
26-
import com.scwang.smartrefresh.layout.listener.OnMultiPurposeListener;
2720
import com.scwang.smartrefresh.layout.listener.OnRefreshListener;
2821
import com.scwang.smartrefresh.layout.listener.SimpleMultiPurposeListener;
2922
import com.scwang.smartrefresh.layout.util.DensityUtil;
@@ -130,9 +123,9 @@ public void setPureScroll(ReactSmartRefreshLayout view,boolean pureScroll){
130123
* @param view
131124
* @param primaryColor
132125
*/
133-
@ReactProp(name = "primaryColor")
134-
public void setPrimaryColor(ReactSmartRefreshLayout view,String primaryColor){
135-
view.setPrimaryColors(Color.parseColor(primaryColor));
126+
@ReactProp(name = "primaryColor",defaultInt = Color.TRANSPARENT)
127+
public void setPrimaryColor(ReactSmartRefreshLayout view, int primaryColor){
128+
view.setPrimaryColors(primaryColor);
136129
}
137130
/**
138131
* 设置headerHeight

0 commit comments

Comments
 (0)