react-native-gizwits-scroll-ruler 1.0.13 → 1.0.14-heater

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -414,7 +414,8 @@
414
414
  -(void)setRealValue:(int)realValue animated:(BOOL)animated{
415
415
  _realValue = realValue;
416
416
  float totalValue = _realValue*_step +_minValue;
417
- _valueLab.text = [NSString stringWithFormat:@"%.1f", totalValue];
417
+ // _valueLab.text = [NSString stringWithFormat:@"%.1f", totalValue];
418
+ [self setValueToValueLabel:totalValue];
418
419
  [_collectionView setContentOffset:CGPointMake(_realValue*RulerGap, 0) animated:animated];
419
420
  }
420
421
 
@@ -422,6 +423,14 @@
422
423
  return 30+20+CollectionHeight;
423
424
  }
424
425
 
426
+ -(void)setValueToValueLabel:(float)value{
427
+ if(_step < 1.0){
428
+ _valueLab.text = [NSString stringWithFormat:@"%.1f",value];
429
+ } else{
430
+ _valueLab.text = [NSString stringWithFormat:@"%d",(int)roundf(value)];
431
+ }
432
+ }
433
+
425
434
  #pragma mark UICollectionViewDataSource & Delegate
426
435
  - (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section
427
436
  {
@@ -509,15 +518,19 @@
509
518
 
510
519
  if (_scrollByHand) {
511
520
  if (totalValue >= _maxValue) {
512
- _valueLab.text = [NSString stringWithFormat:@"%.1f",(float)_maxValue];
521
+ // _valueLab.text = [NSString stringWithFormat:@"%.1f",(float)_maxValue];
522
+ [self setValueToValueLabel:(float)_maxValue];
513
523
  }else if(totalValue <= _minValue){
514
524
  if(_minValue == 0) {
515
- _valueLab.text = @"0.0";
525
+ // _valueLab.text = @"0.0";
526
+ [self setValueToValueLabel:0.0];
516
527
  } else {
517
- _valueLab.text = [NSString stringWithFormat:@"%.1f",(float)_minValue];
528
+ // _valueLab.text = [NSString stringWithFormat:@"%.1f",(float)_minValue];
529
+ [self setValueToValueLabel:(float)_minValue];
518
530
  }
519
531
  }else{
520
- _valueLab.text = [NSString stringWithFormat:@"%.1f",(value*_step) +_minValue];
532
+ // _valueLab.text = [NSString stringWithFormat:@"%.1f",(value*_step) +_minValue];
533
+ [self setValueToValueLabel:(value*_step) +_minValue];
521
534
  }
522
535
  }
523
536
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "react-native-gizwits-scroll-ruler",
3
- "version": "1.0.13",
4
- "description": "修复安卓 step更新 没有更新min max的问题",
3
+ "version": "1.0.14-heater",
4
+ "description": "iOS按step显示小数和整数",
5
5
  "main": "index.js",
6
6
  "scripts": {
7
7
  "test": "echo \"Error: no test specified\" && exit 1"