-
Notifications
You must be signed in to change notification settings - Fork 726
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of github.com:wix/react-native-ui-lib into release
- Loading branch information
Showing
20 changed files
with
374 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
import React from 'react'; | ||
import {ScrollView} from 'react-native'; | ||
import {View, PieChart, Card, Text, Badge, PieChartSegmentProps, Colors} from 'react-native-ui-lib'; | ||
|
||
const SEGMENTS: PieChartSegmentProps[] = [ | ||
{ | ||
percentage: 40, | ||
color: Colors.blue30 | ||
}, | ||
{ | ||
percentage: 30, | ||
color: Colors.red30 | ||
}, | ||
{ | ||
percentage: 20, | ||
color: Colors.green30 | ||
}, | ||
{ | ||
percentage: 10, | ||
color: Colors.purple30 | ||
} | ||
]; | ||
|
||
const MONOCHROME_SEGMENTS: PieChartSegmentProps[] = [ | ||
{ | ||
percentage: 40, | ||
color: Colors.blue70 | ||
}, | ||
{ | ||
percentage: 30, | ||
color: Colors.blue50 | ||
}, | ||
{ | ||
percentage: 20, | ||
color: Colors.blue30 | ||
}, | ||
{ | ||
percentage: 10, | ||
color: Colors.blue10 | ||
} | ||
]; | ||
|
||
const NOT_FULL_PIECHART: PieChartSegmentProps[] = [ | ||
{ | ||
percentage: 30, | ||
color: Colors.blue30 | ||
}, | ||
{ | ||
percentage: 40, | ||
color: Colors.red30 | ||
} | ||
]; | ||
|
||
const PieChartScreen = () => { | ||
const renderSegmentLabel = (segment: PieChartSegmentProps, text: string) => { | ||
const {percentage, color} = segment; | ||
return ( | ||
<View row gap-s1 marginB-s1 key={text}> | ||
<Badge size={10} containerStyle={{justifyContent: 'center'}} backgroundColor={color}/> | ||
<View> | ||
<Text>{text}</Text> | ||
<Text marginL-s1>{percentage}%</Text> | ||
</View> | ||
</View> | ||
); | ||
}; | ||
|
||
const renderPieChartCard = (segments: PieChartSegmentProps[]) => { | ||
return ( | ||
<Card row spread paddingL-s2 paddingR-s10 paddingV-s2> | ||
<View centerV> | ||
<PieChart segments={segments} diameter={150}/> | ||
</View> | ||
<View height={'100%'} gap-s1> | ||
{segments.map((segment, index) => renderSegmentLabel(segment, `Value ${index + 1}`))} | ||
</View> | ||
</Card> | ||
); | ||
}; | ||
|
||
return ( | ||
<ScrollView> | ||
<View padding-page gap-s2> | ||
<Text text50L marginB-s2> | ||
PieChart | ||
</Text> | ||
{renderPieChartCard(SEGMENTS)} | ||
<Text text50L marginV-s2> | ||
Monochrome colors | ||
</Text> | ||
{renderPieChartCard(MONOCHROME_SEGMENTS)} | ||
<Text text50L marginV-s2> | ||
Not Full PieChart | ||
</Text> | ||
{renderPieChartCard(NOT_FULL_PIECHART)} | ||
</View> | ||
</ScrollView> | ||
); | ||
}; | ||
|
||
export default PieChartScreen; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"name": "uilib-native", | ||
"version": "4.5.0", | ||
"version": "4.5.1", | ||
"homepage": "https://github.com/wix/react-native-ui-lib", | ||
"description": "uilib native components (separated from js components)", | ||
"main": "components/index", | ||
|
@@ -10,14 +10,14 @@ | |
"author": "Ethan Sharabi <[email protected]>", | ||
"license": "MIT", | ||
"dependencies": { | ||
"lodash": "^4.0.0", | ||
"lodash": "^4.17.21", | ||
"prop-types": "^15.5.10" | ||
}, | ||
"devDependencies": { | ||
"shell-utils": "^1.0.10" | ||
}, | ||
"peerDependencies": { | ||
"react": "^16.0.0", | ||
"react-native": "^0.51.0" | ||
"react": ">=17.0.1", | ||
"react-native": ">=0.64.1" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"name": "PieChart", | ||
"category": "charts", | ||
"description": "Pie Chart", | ||
"example": "https://github.com/wix/react-native-ui-lib/blob/master/demo/src/screens/componentScreens/PieChartScreen.tsx", | ||
"props": [ | ||
{"name": "segments", "type": "PieChartSegmentProps[]", "description": "Pie chart segments array"}, | ||
{"name": "diameter", "type": "number", "description": "Pie chart diameter"}, | ||
{"name": "dividerWidth", "type": "number", "description": "The width of the divider between the segments"}, | ||
{"name": "dividerColor", "type": "ColorValue", "description": "The color of the divider between the segments"} | ||
], | ||
"snippet": [ | ||
"<PieChart segments={[{percentage: 50, color: Colors.blue30}, {percentage: 30, color: Colors.red30}, {percentage: 20, color: Colors.green30}]} diameter={144}/>" | ||
] | ||
} |
Oops, something went wrong.