Skip to content

Commit

Permalink
second attempt
Browse files Browse the repository at this point in the history
  • Loading branch information
vonovak committed Apr 6, 2020
1 parent 33d16d0 commit 3e343db
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions Libraries/Components/Pressable/useAndroidRippleForView.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,10 @@ export default function useAndroidRippleForView(
|}>,
|}> {
const {color, borderless, radius} = rippleConfig ?? {};
const normalizedBorderless = borderless === true;

return useMemo(() => {
if (
Platform.OS === 'android' &&
Platform.Version >= 21 &&
(color != null || borderless != null || radius != null)
) {
if (Platform.OS === 'android' && Platform.Version >= 21) {
const processedColor = processColor(color);
invariant(
processedColor == null || typeof processedColor === 'number',
Expand All @@ -66,7 +63,7 @@ export default function useAndroidRippleForView(
nativeBackgroundAndroid: {
type: 'RippleAndroid',
color: processedColor,
borderless: borderless === true,
borderless: normalizedBorderless,
rippleRadius: radius,
},
},
Expand Down Expand Up @@ -100,5 +97,5 @@ export default function useAndroidRippleForView(
};
}
return null;
}, [color, borderless, radius, viewRef]);
}, [color, normalizedBorderless, radius, viewRef]);
}

0 comments on commit 3e343db

Please sign in to comment.