Skip to content

Commit

Permalink
Add data and data display.
Browse files Browse the repository at this point in the history
  • Loading branch information
jaywcjlove committed Oct 3, 2018
1 parent 0cd0dca commit c1331fd
Show file tree
Hide file tree
Showing 8 changed files with 5,863 additions and 241 deletions.
2 changes: 1 addition & 1 deletion src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export default class App extends Component<Props> {
key: 'a',
callback: () => Linking.openURL('https://github.com/jaywcjlove/awesome-mac'),
}
])
]);
}
render() {
return (
Expand Down
Binary file added src/assets/icon/github.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
58 changes: 58 additions & 0 deletions src/components/ButtonGroup/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
import React, { Component } from 'react';
import ReactNative from 'react-native-macos';
const { View, Text, Image, Linking, StyleSheet, TouchableOpacity, ScrollView } = ReactNative;

type Props = {
dataSource: Array,
};

export default class ButtonGroup extends React.Component<Props> {
static defaultProps = {
dataSource: [],
}
onPressLearnMore(item) {
if (item && item.openURL) {
Linking.openURL(item.openURL);
}
}
render() {
const { dataSource } = this.props;
return (
<View style={styles.btnGroup}>
{dataSource.map((item, idx) => {
return (
<TouchableOpacity style={styles.item} key={idx} onPress={this.onPressLearnMore.bind(this, item)}>
{item.label && <Text>{item.label}</Text>}
{item.source && (
<View style={styles.imgWarpper}>
<Image style={styles.img} source={item.source} />
</View>
)}
</TouchableOpacity>
);
})}
</View>
);
}
}

const styles = StyleSheet.create({
btnGroup: {
flexDirection: 'row',
justifyContent: 'flex-end',
},
item: {
flexDirection: 'row',
justifyContent: 'flex-end',
marginLeft: 5,
},
imgWarpper: {
// width: 18,
// height: 18,
// padding: 1,
},
img: {
width: 16,
height: 16,
}
});
4 changes: 2 additions & 2 deletions src/components/Menu/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ const { View, Text, StyleSheet, TouchableOpacity, ScrollView } = ReactNative;

class ListView extends React.Component {
render() {
var componentRow = []
for (var a in this.props.dataSource) {
const componentRow = []
for (const a in this.props.dataSource) {
componentRow.push(this.props.renderRow(a, this.props.dataSource[a]))
}
return (
Expand Down
Loading

0 comments on commit c1331fd

Please sign in to comment.