Last active
December 29, 2017 08:06
-
-
Save abinashpanda/920bcddcbd7a488d37f4873b6da57a3a to your computer and use it in GitHub Desktop.
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
import React from 'react'; | |
import { | |
StyleSheet, | |
View, | |
Platform, | |
TouchableOpacity, | |
TouchableNativeFeedback, | |
} from 'react-native'; | |
const FAB_SIZE = 56; | |
const ICON_SIZE = 24; | |
const Touchable = | |
Platform.OS === 'ios' ? TouchableOpacity : TouchableNativeFeedback; | |
const background = Platform.OS === 'ios' ? null : TouchableNativeFeedback.Ripple('#fff', true); // set borderLess true to make the ripple border less | |
const Fab = () => { | |
return ( | |
<View style={styles.fab}> | |
<Touchable background={background}> | |
<View style={styles.iconContainer}> | |
<MaterialIcons name="share" size={ICON_SIZE} color="#fff" /> | |
</View> | |
</Touchable> | |
</View> | |
); | |
}; | |
const styles = StyleSheet.create({ | |
fab: { | |
width: FAB_SIZE, | |
height: FAB_SIZE, | |
borderRadius: FAB_SIZE / 2, | |
backgroundColor: '#2196F3', | |
elevation: 6, | |
}, | |
iconContainer: { | |
width: FAB_SIZE, | |
height: FAB_SIZE, | |
alignItems: 'center', | |
justifyContent: 'center', | |
}, | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment