remove all inline styles

This commit is contained in:
austinried
2021-08-23 13:29:25 +09:00
parent e32d0a7e04
commit 0ec0d4a725
7 changed files with 46 additions and 19 deletions

View File

@@ -1,5 +1,5 @@
import React, { useCallback, useEffect, useState } from 'react'
import { GestureResponderEvent, LayoutRectangle, Pressable, PressableProps, ViewStyle } from 'react-native'
import { GestureResponderEvent, LayoutRectangle, Pressable, PressableProps, ViewStyle, StyleSheet } from 'react-native'
type PressableOpacityProps = PressableProps & {
ripple?: boolean
@@ -55,7 +55,7 @@ const PressableOpacity: React.FC<PressableOpacityProps> = props => {
return (
<Pressable
{...props}
style={[{ justifyContent: 'center', alignItems: 'center' }, props.style as any, { opacity }, disabledStyle]}
style={[styles.pressable, props.style as any, { opacity }, disabledStyle]}
android_ripple={
props.ripple
? {
@@ -74,4 +74,11 @@ const PressableOpacity: React.FC<PressableOpacityProps> = props => {
)
}
const styles = StyleSheet.create({
pressable: {
justifyContent: 'center',
alignItems: 'center',
},
})
export default React.memo(PressableOpacity)