-
Notifications
You must be signed in to change notification settings - Fork 120
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
<MotiPressable> box shadow not working on Android #149
Comments
try containerStyle? |
Tried using <MotiPressable
containerStyle={{
backgroundColor: "white",
shadowColor: "#1A2138",
shadowOffset: {
width: 0,
height: 28,
},
shadowOpacity: 0.16,
shadowRadius: 28,
elevation: 28,
padding: 20,
}}
>
<Text>Hello</Text>
</MotiPressable> |
is it a reanimated issue? did you wrap your app in the root gesture handler view? |
Not sure about it being a reanimated issue, though I'm wrapping all the contents in <GestureHandlerRootView style={{ flex: 1 }}>
{/* Rest of the components */}
</GestureHandlerRootView> |
not sure, maybe try wrapping moti pressable with a normal view and put the shadow there. or make sure it works on an Animated.View too |
Here's what I've tried till now: 1. Shadow on
|
I think I've got a fix for this, it seems to be happening because of the use of Updated Codeconst AnimatedTouchable = Animated.createAnimatedComponent(
TouchableWithoutFeedback
);
const App = () => {
return (
<GestureHandlerRootView style={{ flex: 1 }}>
<AnimatedTouchable
style={{
padding: 20,
overflow: "visible",
backgroundColor: "white",
shadowColor: "#1A2138",
shadowOffset: {
width: 0,
height: 28,
},
shadowOpacity: 0.16,
shadowRadius: 28,
elevation: 28,
}}
>
<MotiView>
<Text>Hello</Text>
</MotiView>
</AnimatedTouchable>
</GestureHandlerRootView>
);
}; OutputIOSAndroidFurther CommentsI'm skeptical about having the current implementation of const MotiTouchable = motify(TouchableWithoutFeedback)();
const MotiPressable = (props) => {
// ... methods and state management
return (
<MotiTouchable {...props}>
{props.children}
</MotiTouchable>
)
} Opened a PR for the same :) |
Issue
Shadows do not appear when using the
<MotiPressable />
component on Android (iOS works fine). However, when I use the originalPressable
component fromreact-native
, shows work fine.Configuration
44.0.4
0.17.1
Screenshots
MotiPressable
IOS
![](https://user-images.githubusercontent.com/29514438/148696142-7d0a7e8d-656f-46fc-907a-4a2891c5bf95.png)
Android
![](https://user-images.githubusercontent.com/29514438/148696316-745e7993-a29c-4219-85dc-bc9ecbfce0e5.png)
React Native Pressable
IOS
![](https://user-images.githubusercontent.com/29514438/148696267-9c8173bf-741d-4032-a641-90a505efaac2.png)
Android
![](https://user-images.githubusercontent.com/29514438/148696286-40e2c264-5e7a-4c3f-8f98-fdfc04b6c45d.png)
Code
The text was updated successfully, but these errors were encountered: