react-native-code-sync
Version:
React-native plugin for the code-sync functionality on live via OTA (Over-the-air)
50 lines (46 loc) • 1.22 kB
JavaScript
import { TouchableOpacity, ActivityIndicator, StyleSheet, Text } from "react-native"
import { Colors } from "../utils"
import { isIOS } from "../utils/Utility"
export const MyActivityIndicator = ({
size = 'small',
color = Colors.PRIMARY,
style = {},
containerStyle
}) => {
return (
<View style={containerStyle}>
<ActivityIndicator size={size} color={color} style={style} />
</View>
)
}
export const PrimaryButton = ({
indicator = false,
style,
label = '',
onPress = () => { },
labelStyle
}) => {
if (!label) return null
return (
<TouchableOpacity
style={[styles.primaryButton, style]}
onPress={onPress}
>
{indicator ? <MyActivityIndicator /> : <Text style={[styles.primaryButtonText, labelStyle]}>{label}</Text>}
</TouchableOpacity>
)
}
const styles = StyleSheet.create({
primaryButton: {
paddingVertical: isIOS ? 15 : 13,
width: '100%',
borderRadius: 10,
backgroundColor: Colors.PRIMARY,
alignItems:'center',
justifyContent:'center'
},
primaryButtonText: {
color: Colors.WHITE,
fontSize: 13
}
})