Skip to content

Commit

Permalink
rollback to Charts4.1, fix stockExample
Browse files Browse the repository at this point in the history
  • Loading branch information
wuxudong committed Oct 8, 2018
1 parent e8515cc commit abc2cd8
Show file tree
Hide file tree
Showing 7 changed files with 43 additions and 28 deletions.
6 changes: 3 additions & 3 deletions Example/app/StockChartScreen.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import moment from 'moment'
import {BarChart, CombinedChart} from 'react-native-charts-wrapper';


const era = moment('1970-1-1')
const era = moment('1970-01-01', 'YYYY-MM-DD')
const distanceToLoadMore = 10
const pageSize = 60

Expand Down Expand Up @@ -53,7 +53,7 @@ class StockChartScreen extends React.Component {
}

getIndexOfDay(day) {
return moment(day).diff(era, 'days')
return moment(day, 'YYYY-MM-DD').diff(era, 'days')
}

generateNewData(from, to, data) {
Expand Down Expand Up @@ -201,7 +201,7 @@ class StockChartScreen extends React.Component {
let start = moment().add(-2 * pageSize, 'days').format('YYYY-MM-DD')

// for example, this company ipo at 2017-1-1, you can get this information from your server
let axisMinimum = this.getIndexOfDay(moment('2017-01-01').format('YYYY-MM-DD')) - 0.5;
let axisMinimum = this.getIndexOfDay('2017-01-01') - 0.5;
let axisMaximum = this.getIndexOfDay(today) + 0.5;


Expand Down
7 changes: 4 additions & 3 deletions Example/index.android.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import React from 'react';
import React, {Component} from 'react';
import {
AppRegistry,
BackAndroid,
Navigator,
StyleSheet,
Text,
View
} from 'react-native';
Expand All @@ -19,4 +18,6 @@ class Example extends React.Component {
}
}

export default Example;

AppRegistry.registerComponent('Example', () => Example);
2 changes: 2 additions & 0 deletions Example/index.ios.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,7 @@ class Example extends React.Component {
}
}

export default Example;

AppRegistry.registerComponent('Example', () => Example);

2 changes: 2 additions & 0 deletions Example/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,7 @@ class Example extends React.Component {
}
}

export default Example;

AppRegistry.registerComponent('Example', () => Example);

9 changes: 6 additions & 3 deletions Example/ios/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,14 @@ target 'Example' do
pod 'RNCharts', :path => '../../'
end

swift4 = ['Charts']

post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['SWIFT_VERSION'] = '4.1'
if swift4.include?(target.name)
config.build_settings['SWIFT_VERSION'] = '4.1'
end
end
end
end

end
43 changes: 25 additions & 18 deletions installation_guide/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ $ pod --version
Xcode 10.0
swift 4.1
swift 4.1/4.2
```

Expand Down Expand Up @@ -259,15 +259,17 @@ react-native run-android, that is it.
pod 'RNCharts', :path => '../node_modules/react-native-charts-wrapper'
end

post_install do |installer|
installer.pods_project.targets.each do |target|
if target.name == 'RNCharts'
target.build_configurations.each do |config|
config.build_settings['SWIFT_VERSION'] = '4.1'
end
end
end
end
swift4 = ['Charts']

post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
if swift4.include?(target.name)
config.build_settings['SWIFT_VERSION'] = '4.1'
end
end
end
end

```

Expand Down Expand Up @@ -332,13 +334,18 @@ react-native run-android, that is it.
pod 'SwiftyJSON', '4.0.0'
pod 'Charts', '3.1.1'
end
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['SWIFT_VERSION'] = '4.1'
end
end
end

swift4 = ['Charts']

post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
if swift4.include?(target.name)
config.build_settings['SWIFT_VERSION'] = '4.1'
end
end
end
end
```

* manual install
Expand All @@ -351,7 +358,7 @@ react-native run-android, that is it.
* update project setting
update `Swift Language Version` in `Build Settings` to 4.1
update `Swift Language Version` in `Build Settings` to 4.1/4.2
* run it from XCode or run `react-native run-ios`, that is it.
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"type": "git",
"url": "https://github.com/wuxudong/react-native-charts-wrapper.git"
},
"version": "0.4.8",
"version": "0.5.0",
"description": "A react-native charts support both android and ios.",
"author": "wuxudong",
"license": "MIT",
Expand Down

0 comments on commit abc2cd8

Please sign in to comment.