Skip to content

Commit

Permalink
fix(core): fix disabled not applying style + fix disabled not removin…
Browse files Browse the repository at this point in the history
…g events
  • Loading branch information
natew committed Nov 5, 2022
1 parent af57854 commit a4c82c8
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions packages/core/src/createComponent.tsx
Expand Up @@ -199,6 +199,8 @@ export function createComponent<

const languageContext = isRSC ? null : useContext(FontLanguageContext)

const isDisabled = props.disabled ?? props.accessibilityState?.disabled

const useAnimations = tamaguiConfig.animations?.useAnimations as UseAnimationHook | undefined
const nextIsAnimated = !!(useAnimations && props.animation)
// conditional but if ever true stays true
Expand Down Expand Up @@ -722,7 +724,7 @@ export function createComponent<
)

const events =
shouldAttach && !isRSC
shouldAttach && !isRSC && !isDisabled
? {
onPressOut: attachPress
? (e) => {
Expand Down Expand Up @@ -793,7 +795,7 @@ export function createComponent<
// replicating TouchableWithoutFeedback
...(!isWeb && {
cancelable: !props.rejectResponderTermination,
disabled: props.disabled ?? props.accessibilityState?.disabled,
disabled: isDisabled,
hitSlop: props.hitSlop,
delayLongPress: props.delayLongPress,
delayPressIn: props.delayPressIn,
Expand Down

0 comments on commit a4c82c8

Please sign in to comment.