-
-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0cd0dca
commit c1331fd
Showing
8 changed files
with
5,863 additions
and
241 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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,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, | ||
} | ||
}); |
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
Oops, something went wrong.