Commit d6ad6759 authored by xwenliang's avatar xwenliang

New features for #102 #90 #29

parent cf30fbc6
...@@ -10,22 +10,24 @@ ...@@ -10,22 +10,24 @@
####Params ####Params
|Key | Type | Default| Description | |Key | Description | Type | Default|
| --- | ---- | ------ | ----------- | | --- | ----------- | ---- | ------ |
|pickerConfirmBtnText |string |确认 | | |pickerConfirmBtnText | |string |confirm |
|pickerCancelBtnText |string |取消 | | |pickerCancelBtnText | |string |cancel |
|pickerTitleText |string |请选择 | | |pickerTitleText | |string |pls select |
|pickerConfirmBtnColor |array |[1, 186, 245, 1] | | |pickerConfirmBtnColor | |array |[1, 186, 245, 1] |
|pickerCancelBtnColor |array |[1, 186, 245, 1] | | |pickerCancelBtnColor | |array |[1, 186, 245, 1] |
|pickerTitleColor |array |[20, 20, 20, 1]) | | |pickerTitleColor | |array |[20, 20, 20, 1]) |
|pickerToolBarBg |array |[232, 232, 232, 1] | | |pickerToolBarBg | |array |[232, 232, 232, 1] |
|pickerBg |array |[196, 199, 206, 1] | | |pickerBg | |array |[196, 199, 206, 1] |
|wheelFlex |array |[2, 1, 1] |set width of the three wheels to 2:1:1 | |pickerToolBarFontSize | |number |16 |
|pickerData |array | | | |pickerFontSize | |number |16 |
|selectedValue |array | | | |pickerFontColor | |array |[31, 31, 31, 1] |
|onPickerConfirm |function| | | |pickerData | |array | |
|onPickerCancel |function| | | |selectedValue | |string | |
|onPickerSelect |function| | | |onPickerConfirm | |function| |
|onPickerCancel | |function| |
|onPickerSelect | |function| |
####Methods ####Methods
...@@ -93,7 +95,7 @@ ...@@ -93,7 +95,7 @@
```javascript ```javascript
pickerData = [1,2,3,4]; pickerData = [1,2,3,4];
selectedValue = [3]; selectedValue = 3;
``` ```
- two or more wheel: - two or more wheel:
......
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.beefe.picker"> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.beefe.picker">
</manifest> </manifest>
\ No newline at end of file
...@@ -19,9 +19,13 @@ import java.util.concurrent.ScheduledFuture; ...@@ -19,9 +19,13 @@ import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
/** /**
* Edited by shexiaoheng on 2016/10/20 * Edited by <a href="https://github.com/shexiaoheng">heng</a> on 2016/10/20
* 1. Added method getY * 1. Added method getY
* 2. Changed line color 0xffc5c5c5 -> 0xffb8bbc2 * 2. Changed line color 0xffc5c5c5 -> 0xffb8bbc2
*
* Edited by heng on 2016/12/26
* 1. Added setTextColor
* 2. Added setTextSize
*/ */
public class LoopView extends View { public class LoopView extends View {
...@@ -50,10 +54,6 @@ public class LoopView extends View { ...@@ -50,10 +54,6 @@ public class LoopView extends View {
private int textSize; private int textSize;
int maxTextHeight; int maxTextHeight;
private int colorGray;
private int colorBlack;
private int colorLightGray;
// 条目间距倍数 // 条目间距倍数
float lineSpacingMultiplier; float lineSpacingMultiplier;
boolean isLoop; boolean isLoop;
...@@ -109,37 +109,30 @@ public class LoopView extends View { ...@@ -109,37 +109,30 @@ public class LoopView extends View {
lineSpacingMultiplier = 2.0F; lineSpacingMultiplier = 2.0F;
isLoop = true; isLoop = true;
itemsVisible = 9; itemsVisible = 9;
textSize = 0; textSize = (int) (context.getResources().getDisplayMetrics().density * 16);
colorGray = 0xffafafaf;
colorBlack = 0xff313131;
colorLightGray = 0xffb8bbc2;
// colorLightGray = 0xffc5c5c5;
totalScrollY = 0; totalScrollY = 0;
initPosition = -1; initPosition = -1;
initPaints(); initPaints();
setTextSize(20F);
} }
private void initPaints() { private void initPaints() {
paintOuterText = new Paint(); paintOuterText = new Paint();
paintOuterText.setColor(colorGray); paintOuterText.setColor(0xffafafaf);
paintOuterText.setAntiAlias(true); paintOuterText.setAntiAlias(true);
paintOuterText.setTypeface(Typeface.MONOSPACE); paintOuterText.setTypeface(Typeface.MONOSPACE);
paintOuterText.setTextSize(textSize); paintOuterText.setTextSize(textSize);
paintCenterText = new Paint(); paintCenterText = new Paint();
paintCenterText.setColor(colorBlack); paintCenterText.setColor(0xff000000);
paintCenterText.setAntiAlias(true); paintCenterText.setAntiAlias(true);
paintCenterText.setTextScaleX(scaleX); paintCenterText.setTextScaleX(scaleX);
paintCenterText.setTypeface(Typeface.MONOSPACE); paintCenterText.setTypeface(Typeface.MONOSPACE);
paintCenterText.setTextSize(textSize); paintCenterText.setTextSize(textSize);
paintIndicator = new Paint(); paintIndicator = new Paint();
paintIndicator.setColor(colorLightGray); paintIndicator.setColor(0xffb8bbc2);
paintIndicator.setAntiAlias(true); paintIndicator.setAntiAlias(true);
if (android.os.Build.VERSION.SDK_INT >= 11) { if (android.os.Build.VERSION.SDK_INT >= 11) {
...@@ -204,15 +197,22 @@ public class LoopView extends View { ...@@ -204,15 +197,22 @@ public class LoopView extends View {
} }
} }
public void setTextColor(int color){
paintCenterText.setColor(color);
invalidate();
}
public final void setNotLoop() { public final void setNotLoop() {
isLoop = false; isLoop = false;
} }
public final void setTextSize(float size) { public final void setTextSize(float size) {
if (size > 0.0F) { if (size > 0.0F) {
textSize = (int) (context.getResources().getDisplayMetrics().density * size); this.textSize = (int) (context.getResources().getDisplayMetrics().density * size);
paintOuterText.setTextSize(textSize); paintOuterText.setTextSize(textSize);
paintCenterText.setTextSize(textSize); paintCenterText.setTextSize(textSize);
remeasure();
invalidate();
} }
} }
...@@ -242,6 +242,7 @@ public class LoopView extends View { ...@@ -242,6 +242,7 @@ public class LoopView extends View {
this.initPosition = initPosition; this.initPosition = initPosition;
} }
} }
selectedIndex = initPosition;
totalScrollY = 0; totalScrollY = 0;
cancelFuture(); cancelFuture();
invalidate(); invalidate();
...@@ -450,4 +451,4 @@ public class LoopView extends View { ...@@ -450,4 +451,4 @@ public class LoopView extends View {
invalidate(); invalidate();
return true; return true;
} }
} }
\ No newline at end of file
...@@ -8,6 +8,6 @@ import java.util.ArrayList; ...@@ -8,6 +8,6 @@ import java.util.ArrayList;
public interface OnSelectedListener { public interface OnSelectedListener {
void onSelected(ArrayList<String> selectedList); void onSelected(ArrayList<ReturnData> selectedList);
} }
...@@ -13,10 +13,14 @@ import java.util.ArrayList; ...@@ -13,10 +13,14 @@ import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
/** /**
* Created by heng on 16/9/6. * Created by <a href="https://github.com/shexiaoheng">heng</a> on 16/9/6.
* <p> * <p>
* Edited by heng on 16/10/09: * Edited by heng on 16/10/09:
* 修复滚动后返回值错误的bug * 修复滚动后返回值错误的bug
*
* Edited by heng on 2016/12/26
* 1. Fixed returnData bug
* 2. Added LoopView TextColor and TextSize support
*/ */
public class PickerViewAlone extends LinearLayout { public class PickerViewAlone extends LinearLayout {
...@@ -25,7 +29,7 @@ public class PickerViewAlone extends LinearLayout { ...@@ -25,7 +29,7 @@ public class PickerViewAlone extends LinearLayout {
private OnSelectedListener onSelectedListener; private OnSelectedListener onSelectedListener;
private ArrayList<String> curSelectedList; private ArrayList<ReturnData> curSelectedList;
public PickerViewAlone(Context context) { public PickerViewAlone(Context context) {
super(context); super(context);
...@@ -46,23 +50,23 @@ public class PickerViewAlone extends LinearLayout { ...@@ -46,23 +50,23 @@ public class PickerViewAlone extends LinearLayout {
this.onSelectedListener = listener; this.onSelectedListener = listener;
} }
public void setPickerData(ReadableArray array, double[] weights) { public void setPickerData(ReadableArray array, double[] weights) {
curSelectedList = new ArrayList<>(); curSelectedList = new ArrayList<>();
switch (array.getType(0).name()) { switch (array.getType(0).name()) {
case "Array": case "Array":
setMultipleData(array, curSelectedList, weights); setMultipleData(array, weights);
break; break;
default: default:
setAloneData(array, curSelectedList); setAloneData(array);
break; break;
} }
} }
public ArrayList<String> getSelectedData(){ public ArrayList<ReturnData> getSelectedData() {
return this.curSelectedList; return this.curSelectedList;
} }
private void setAloneData(ReadableArray array, final ArrayList<String> curSelectedList) { private void setAloneData(ReadableArray array) {
ArrayList<String> values = arrayToList(array); ArrayList<String> values = arrayToList(array);
final LoopView loopView = new LoopView(getContext()); final LoopView loopView = new LoopView(getContext());
LayoutParams params = new LayoutParams( LayoutParams params = new LayoutParams(
...@@ -71,16 +75,22 @@ public class PickerViewAlone extends LinearLayout { ...@@ -71,16 +75,22 @@ public class PickerViewAlone extends LinearLayout {
loopView.setLayoutParams(params); loopView.setLayoutParams(params);
loopView.setItems(values); loopView.setItems(values);
loopView.setSelectedPosition(0); loopView.setSelectedPosition(0);
ReturnData returnData = new ReturnData();
returnData.setItem(values.get(0));
returnData.setIndex(loopView.getSelectedIndex());
if (curSelectedList.size() > 0) { if (curSelectedList.size() > 0) {
curSelectedList.set(0, values.get(0)); curSelectedList.set(0, returnData);
} else { } else {
curSelectedList.add(0, values.get(0)); curSelectedList.add(0, returnData);
} }
loopView.setListener(new OnItemSelectedListener() { loopView.setListener(new OnItemSelectedListener() {
@Override @Override
public void onItemSelected(String item, int index) { public void onItemSelected(String item, int index) {
if (onSelectedListener != null) { if (onSelectedListener != null) {
curSelectedList.set(0, item); ReturnData returnData1 = new ReturnData();
returnData1.setItem(item);
returnData1.setIndex(index);
curSelectedList.set(0, returnData1);
onSelectedListener.onSelected(curSelectedList); onSelectedListener.onSelected(curSelectedList);
} }
} }
...@@ -88,8 +98,9 @@ public class PickerViewAlone extends LinearLayout { ...@@ -88,8 +98,9 @@ public class PickerViewAlone extends LinearLayout {
pickerViewAloneLayout.addView(loopView); pickerViewAloneLayout.addView(loopView);
} }
private void setMultipleData(ReadableArray array, final ArrayList<String> curSelectedList, double[] weights) { private void setMultipleData(ReadableArray array, double[] weights) {
final String[] selectedItems = new String[array.size()]; final String[] selectedItems = new String[array.size()];
final int[] selectedIndexes = new int[array.size()];
for (int i = 0; i < array.size(); i++) { for (int i = 0; i < array.size(); i++) {
switch (array.getType(i).name()) { switch (array.getType(i).name()) {
case "Array": case "Array":
...@@ -110,10 +121,14 @@ public class PickerViewAlone extends LinearLayout { ...@@ -110,10 +121,14 @@ public class PickerViewAlone extends LinearLayout {
loopView.setItems(values); loopView.setItems(values);
loopView.setTag(i); loopView.setTag(i);
loopView.setSelectedPosition(0); loopView.setSelectedPosition(0);
ReturnData returnData = new ReturnData();
returnData.setItem(values.get(0));
returnData.setIndex(loopView.getSelectedIndex());
if (curSelectedList.size() > i) { if (curSelectedList.size() > i) {
curSelectedList.set(i, values.get(0)); curSelectedList.set(i, returnData);
} else { } else {
curSelectedList.add(i, values.get(0)); curSelectedList.add(i, returnData);
} }
selectedItems[i] = values.get(0); selectedItems[i] = values.get(0);
loopView.setListener(new OnItemSelectedListener() { loopView.setListener(new OnItemSelectedListener() {
...@@ -125,12 +140,16 @@ public class PickerViewAlone extends LinearLayout { ...@@ -125,12 +140,16 @@ public class PickerViewAlone extends LinearLayout {
if (view instanceof LoopView) { if (view instanceof LoopView) {
LoopView loop = (LoopView) view; LoopView loop = (LoopView) view;
selectedItems[k] = loop.getSelectedItem(); selectedItems[k] = loop.getSelectedItem();
selectedIndexes[k] = loop.getSelectedIndex();
} }
} }
if (onSelectedListener != null) { if (onSelectedListener != null) {
for (int i = 0; i < selectedItems.length; i++) { for (int i = 0; i < selectedItems.length; i++) {
curSelectedList.set(i, selectedItems[i]); ReturnData returnData1 = new ReturnData();
returnData1.setItem(selectedItems[i]);
returnData1.setIndex(selectedIndexes[i]);
curSelectedList.set(i, returnData1);
} }
onSelectedListener.onSelected(curSelectedList); onSelectedListener.onSelected(curSelectedList);
} }
...@@ -155,19 +174,44 @@ public class PickerViewAlone extends LinearLayout { ...@@ -155,19 +174,44 @@ public class PickerViewAlone extends LinearLayout {
} }
} }
private void setSelect(int size, String[] values, ArrayList<String> curSelectedList) { private void setSelect(int size, String[] values, ArrayList<ReturnData> curSelectedList) {
for (int i = 0; i < size; i++) { for (int i = 0; i < size; i++) {
View view = pickerViewAloneLayout.getChildAt(i); View view = pickerViewAloneLayout.getChildAt(i);
if (view instanceof LoopView) { if (view instanceof LoopView) {
LoopView loop = (LoopView) view; LoopView loop = (LoopView) view;
if (loop.hasItem(values[i])) { if (loop.hasItem(values[i])) {
loop.setSelectedItem(values[i]); loop.setSelectedItem(values[i]);
curSelectedList.set(i, values[i]); ReturnData returnData = new ReturnData();
returnData.setItem(values[i]);
returnData.setIndex(loop.getSelectedIndex());
curSelectedList.set(i, returnData);
} }
} }
} }
} }
public void setTextColor(int color){
int viewCount = pickerViewAloneLayout.getChildCount();
for (int i = 0; i < viewCount; i++) {
View view = pickerViewAloneLayout.getChildAt(i);
if (view instanceof LoopView) {
LoopView loopView = (LoopView) view;
loopView.setTextColor(color);
}
}
}
public void setTextSize(float size){
int viewCount = pickerViewAloneLayout.getChildCount();
for (int i = 0; i < viewCount; i++) {
View view = pickerViewAloneLayout.getChildAt(i);
if (view instanceof LoopView) {
LoopView loopView = (LoopView) view;
loopView.setTextSize(size);
}
}
}
public void setIsLoop(boolean isLoop) { public void setIsLoop(boolean isLoop) {
if (!isLoop) { if (!isLoop) {
int viewCount = pickerViewAloneLayout.getChildCount(); int viewCount = pickerViewAloneLayout.getChildCount();
...@@ -215,4 +259,4 @@ public class PickerViewAlone extends LinearLayout { ...@@ -215,4 +259,4 @@ public class PickerViewAlone extends LinearLayout {
return values; return values;
} }
} }
\ No newline at end of file
package com.beefe.picker.view;
/**
* Created by shexiaoheng on 2016/12/23.
*/
public class ReturnData {
private String item;
private int index;
public String getItem() {
return item;
}
public void setItem(String item) {
this.item = item;
}
public int getIndex() {
return index;
}
public void setIndex(int index) {
this.index = index;
}
}
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<resources> <resources>
<style name="Dialog_Full_Screen"> <style name="Dialog_Full_Screen">
<item name="android:windowIsFloating">true</item> <item name="android:windowIsFloating">true</item>
<item name="android:windowFullscreen">true</item> <item name="android:windowFullscreen">true</item>
<item name="android:windowNoTitle">true</item> <item name="android:windowNoTitle">true</item>
......
...@@ -19,6 +19,7 @@ class PickerTest extends Component { ...@@ -19,6 +19,7 @@ class PickerTest extends Component {
constructor(props, context) { constructor(props, context) {
super(props, context); super(props, context);
this._showDatePicker();
} }
_createDateData() { _createDateData() {
...@@ -78,15 +79,17 @@ class PickerTest extends Component { ...@@ -78,15 +79,17 @@ class PickerTest extends Component {
_showDatePicker() { _showDatePicker() {
Picker.init({ Picker.init({
pickerData: this._createDateData(), pickerData: this._createDateData(),
selectedValue: ['2015年', '12月', '12日'], pickerToolBarFontSize: 16,
onPickerConfirm: pickedValue => { pickerFontSize: 16,
console.log('date', pickedValue); pickerFontColor: [255, 0 ,0, 1],
onPickerConfirm: (pickedValue, pickedIndex) => {
console.log('date', pickedValue, pickedIndex);
}, },
onPickerCancel: pickedValue => { onPickerCancel: (pickedValue, pickedIndex) => {
console.log('date', pickedValue); console.log('date', pickedValue, pickedIndex);
}, },
onPickerSelect: pickedValue => { onPickerSelect: (pickedValue, pickedIndex) => {
console.log('date', pickedValue); console.log('date', pickedValue, pickedIndex);
} }
}); });
Picker.show(); Picker.show();
......
...@@ -13,17 +13,24 @@ export default { ...@@ -13,17 +13,24 @@ export default {
init(options){ init(options){
let opt = { let opt = {
isLoop: false, isLoop: false,
pickerConfirmBtnText: '确认', pickerConfirmBtnText: 'confirm',
pickerCancelBtnText: '取消', pickerCancelBtnText: 'cancel',
pickerTitleText: '请选择', pickerTitleText: 'pls select',
pickerBg: [196, 199, 206, 1],
pickerToolBarBg: [232, 232, 232, 1],
pickerTitleColor: [20, 20, 20, 1],
pickerCancelBtnColor: [1, 186, 245, 1],
pickerConfirmBtnColor: [1, 186, 245, 1], pickerConfirmBtnColor: [1, 186, 245, 1],
pickerCancelBtnColor: [1, 186, 245, 1],
pickerTitleColor: [20, 20, 20, 1],
pickerToolBarBg: [232, 232, 232, 1],
pickerBg: [196, 199, 206, 1],
wheelFlex: [1, 1, 1],
pickerData: [],
selectedValue: [],
onPickerConfirm(){}, onPickerConfirm(){},
onPickerCancel(){}, onPickerCancel(){},
onPickerSelect(){}, onPickerSelect(){},
//4.0.12 add
pickerToolBarFontSize: 16,
pickerFontSize: 16,
pickerFontColor: [31, 31 ,31, 1],
...options ...options
}; };
let fnConf = { let fnConf = {
...@@ -36,14 +43,7 @@ export default { ...@@ -36,14 +43,7 @@ export default {
//there are no `removeListener` for NativeAppEventEmitter & DeviceEventEmitter //there are no `removeListener` for NativeAppEventEmitter & DeviceEventEmitter
this.listener && this.listener.remove(); this.listener && this.listener.remove();
this.listener = NativeAppEventEmitter.addListener('pickerEvent', event => { this.listener = NativeAppEventEmitter.addListener('pickerEvent', event => {
if(ios){ fnConf[event['type']](event['selectedValue'], event['selectedIndex']);
fnConf[event['type']](event['selectedValue']);
}
else if(android){
for (let i in event){
typeof fnConf[i] === 'function' && fnConf[i](event[i]);
}
}
}); });
}, },
......
...@@ -39,6 +39,9 @@ typedef void(^backBolock)(NSDictionary * ); ...@@ -39,6 +39,9 @@ typedef void(^backBolock)(NSDictionary * );
@property(strong,nonatomic)NSString *leftStr; @property(strong,nonatomic)NSString *leftStr;
@property(strong,nonatomic)NSString *centStr; @property(strong,nonatomic)NSString *centStr;
@property(strong,nonatomic)NSString *rightStr; @property(strong,nonatomic)NSString *rightStr;
@property(strong,nonatomic)NSString *pickerToolBarFontSize;
@property(strong,nonatomic)NSString *pickerFontSize;
@property(strong,nonatomic)NSArray*pickerFontColor;
...@@ -61,6 +64,7 @@ typedef void(^backBolock)(NSDictionary * ); ...@@ -61,6 +64,7 @@ typedef void(^backBolock)(NSDictionary * );
@property(strong,nonatomic)NSArray *weightArry; @property(strong,nonatomic)NSArray *weightArry;
@property(assign,nonatomic)CGFloat lineWith;
//创建一个下角标记录是第几行 来一进来判断第一行被选中 当进来的是关联两行的逻辑的时候 或者三行关联的时候取第二行做记录 //创建一个下角标记录是第几行 来一进来判断第一行被选中 当进来的是关联两行的逻辑的时候 或者三行关联的时候取第二行做记录
@property(assign,nonatomic)NSInteger num; @property(assign,nonatomic)NSInteger num;
...@@ -69,9 +73,12 @@ typedef void(^backBolock)(NSDictionary * ); ...@@ -69,9 +73,12 @@ typedef void(^backBolock)(NSDictionary * );
@property(assign,nonatomic)NSInteger threenum; @property(assign,nonatomic)NSInteger threenum;
@property(assign,nonatomic)NSInteger seleNum;//用来做索引下标用
-(instancetype)initWithFrame:(CGRect)frame dic:(NSDictionary *)dic leftStr:(NSString *)leftStr centerStr:(NSString *)centerStr rightStr:(NSString *)rightStr topbgColor:(NSArray *)topbgColor bottombgColor:(NSArray *)bottombgColor leftbtnbgColor:(NSArray *)leftbtnbgColor rightbtnbgColor:(NSArray *)rightbtnbgColor centerbtnColor:(NSArray *)centerbtnColor selectValueArry:(NSArray *)selectValueArry weightArry:(NSArray *)weightArry;
-(instancetype)initWithFrame:(CGRect)frame dic:(NSDictionary *)dic leftStr:(NSString *)leftStr centerStr:(NSString *)centerStr rightStr:(NSString *)rightStr topbgColor:(NSArray *)topbgColor bottombgColor:(NSArray *)bottombgColor leftbtnbgColor:(NSArray *)leftbtnbgColor rightbtnbgColor:(NSArray *)rightbtnbgColor centerbtnColor:(NSArray *)centerbtnColor selectValueArry:(NSArray *)selectValueArry weightArry:(NSArray *)weightArry
pickerToolBarFontSize:(NSString *)pickerToolBarFontSize pickerFontSize:(NSString *)pickerFontSize pickerFontColor:(NSArray *)pickerFontColor;
@end @end
This diff is collapsed.
...@@ -26,7 +26,11 @@ RCT_EXPORT_MODULE(); ...@@ -26,7 +26,11 @@ RCT_EXPORT_MODULE();
RCT_EXPORT_METHOD(_init:(NSDictionary *)indic){ RCT_EXPORT_METHOD(_init:(NSDictionary *)indic){
self.window = [[UIApplication sharedApplication].windows lastObject]; dispatch_async(dispatch_get_main_queue(), ^{
[[UIApplication sharedApplication].keyWindow endEditing:YES];
});
self.window = [UIApplication sharedApplication].keyWindow;
NSString *pickerConfirmBtnText=indic[@"pickerConfirmBtnText"]; NSString *pickerConfirmBtnText=indic[@"pickerConfirmBtnText"];
NSString *pickerCancelBtnText=indic[@"pickerCancelBtnText"]; NSString *pickerCancelBtnText=indic[@"pickerCancelBtnText"];
...@@ -38,6 +42,9 @@ RCT_EXPORT_METHOD(_init:(NSDictionary *)indic){ ...@@ -38,6 +42,9 @@ RCT_EXPORT_METHOD(_init:(NSDictionary *)indic){
NSArray *pickerBg=indic[@"pickerBg"]; NSArray *pickerBg=indic[@"pickerBg"];
NSArray *selectArry=indic[@"selectedValue"]; NSArray *selectArry=indic[@"selectedValue"];
NSArray *weightArry=indic[@"wheelFlex"]; NSArray *weightArry=indic[@"wheelFlex"];
NSString *pickerToolBarFontSize=[NSString stringWithFormat:@"%@",indic[@"pickerToolBarFontSize"]];
NSString *pickerFontSize=[NSString stringWithFormat:@"%@",indic[@"pickerFontSize"]];
NSArray *pickerFontColor=indic[@"pickerFontColor"];
id pickerData=indic[@"pickerData"]; id pickerData=indic[@"pickerData"];
...@@ -62,7 +69,8 @@ RCT_EXPORT_METHOD(_init:(NSDictionary *)indic){ ...@@ -62,7 +69,8 @@ RCT_EXPORT_METHOD(_init:(NSDictionary *)indic){
self.height=220; self.height=220;
} }
self.pick=[[BzwPicker alloc]initWithFrame:CGRectMake(0, SCREEN_HEIGHT, SCREEN_WIDTH, self.height) dic:dataDic leftStr:pickerCancelBtnText centerStr:pickerTitleText rightStr:pickerConfirmBtnText topbgColor:pickerToolBarBg bottombgColor:pickerBg leftbtnbgColor:pickerCancelBtnColor rightbtnbgColor:pickerConfirmBtnColor centerbtnColor:pickerTitleColor selectValueArry:selectArry weightArry:weightArry]; self.pick=[[BzwPicker alloc]initWithFrame:CGRectMake(0, SCREEN_HEIGHT, SCREEN_WIDTH, self.height) dic:dataDic leftStr:pickerCancelBtnText centerStr:pickerTitleText rightStr:pickerConfirmBtnText topbgColor:pickerToolBarBg bottombgColor:pickerBg leftbtnbgColor:pickerCancelBtnColor rightbtnbgColor:pickerConfirmBtnColor centerbtnColor:pickerTitleColor selectValueArry:selectArry weightArry:weightArry pickerToolBarFontSize:pickerToolBarFontSize pickerFontSize:pickerFontSize pickerFontColor:pickerFontColor];
_pick.bolock=^(NSDictionary *backinfoArry){ _pick.bolock=^(NSDictionary *backinfoArry){
...@@ -74,7 +82,7 @@ RCT_EXPORT_METHOD(_init:(NSDictionary *)indic){ ...@@ -74,7 +82,7 @@ RCT_EXPORT_METHOD(_init:(NSDictionary *)indic){
dispatch_async(dispatch_get_main_queue(), ^{ dispatch_async(dispatch_get_main_queue(), ^{
[self.window addSubview:_pick]; [self.window addSubview:_pick];
[UIView animateWithDuration:.3 animations:^{ [UIView animateWithDuration:.3 animations:^{
......
{ {
"name": "react-native-picker", "name": "react-native-picker",
"version": "4.0.11", "version": "4.0.12",
"description": "", "description": "",
"main": "index.js", "main": "index.js",
"scripts": { "scripts": {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment