-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Property 'fill' was whitelisted both as UI and native prop. Please remove it from one of the lists. #5989
Comments
Hey! 👋 The issue doesn't seem to contain a minimal reproduction. Could you provide a snack or a link to a GitHub repository under your username that reproduces the problem? |
Hey! 👋 It looks like you've omitted a few important sections from the issue template. Please complete Snack or a link to a repository section. |
Hey @valeriavodianchuk I have just created a similar example that doesn't throw an error (and in general wasn't able to reproduce the problem), please take a look, maybe you forgot something or redundantly used import { StyleSheet, View } from 'react-native';
import Animated, {
useAnimatedProps,
interpolateColor,
useScrollViewOffset,
useAnimatedRef,
createAnimatedPropAdapter,
processColor,
} from 'react-native-reanimated';
import React from 'react';
import { Circle, Svg } from 'react-native-svg';
const AnimatedCircle = Animated.createAnimatedComponent(Circle);
export default function EmptyExample() {
const ref = useAnimatedRef<Animated.ScrollView>();
const scrollOffset = useScrollViewOffset(ref);
const animatedProps = useAnimatedProps(
() => {
const fill = interpolateColor(
scrollOffset.value % 300,
[0, 300],
['#ffffff', '#000000']
);
return {
fill,
};
},
[scrollOffset.value],
createAnimatedPropAdapter(
(props) => {
if (Object.keys(props).includes('fill')) {
props.fill = { type: 0, payload: processColor(props.fill) };
}
},
['fill']
)
);
return (
<View style={styles.container}>
<Animated.ScrollView ref={ref} contentContainerStyle={styles.scroll}>
<View style={styles.box} />
<View style={styles.box} />
<View style={styles.box} />
</Animated.ScrollView>
<Svg height="200" width="200">
<AnimatedCircle
cx="50%"
cy="50%"
fill="none"
r="50%"
animatedProps={animatedProps}
/>
</Svg>
</View>
);
}
const styles = StyleSheet.create({
container: {
flex: 1,
alignItems: 'center',
justifyContent: 'center',
flexDirection: 'row',
},
scroll: {
justifyContent: 'center',
alignItems: 'center',
},
box: {
width: 300,
height: 700,
backgroundColor: 'pink',
margin: 40,
},
}); |
same issue |
@danieldav2 @chandrucrayond could any of you guys give me a repro for the problem? Just as I mentioned above, the problem occurs because |
For me this was happening because 'processColor' was imported from react-native rather than reanimated. |
It's still a valid issue. Strangely it is happening when you try to interpolate colors of a svg path.
BUT !!!! On me personally, this is happening only if i navigate to this screen where i used this code above. Lets say i used this in dashbard component and if i give my dashboard to navigator as initialRoute, then everything is working fine. Only if i navigate from somewhere then this error getting thrown. BTW you can reproduce this issue simply by trying to apply dynamic interpolation to fill and stroke properties of a Animated SVG path. |
I just spotted something, if your custom component is being rendered immediately on did mount, you are most likely getting this crash... but if you add a slight delay like
no errors ... at least on me :) |
@Bayramito yeah, too bad |
Hey, it seems that one of your dependencies utilizing Reanimated (and potentially SVG) is invoking the without any reproduction it is hard to us to tell more :/ |
Description
There is some piece of code that uses animated props
` const animatedProps = useAnimatedProps(
() => {
if (!scrollOffsetAnimatedValue) return { fill: '#ffffff' };
And animated SVG
const AnimatedPath = Animated.createAnimatedComponent(Path);
<Svg width='21' height='21' viewBox='0 0 21 21' fill='none'> <AnimatedPath fillRule='evenodd' clipRule='evenodd' d='...' animatedProps={animatedProps} /> </Svg>
Finally, we have this error - Property 'fill' was whitelisted both as UI and native prop. Please remove it from one of the lists.
Version of react-native-reanimated - 3.9.0, react-native-svg - 13.10.0
Steps to reproduce
Snack or a link to a repository
Reanimated version
3.9.0
React Native version
0.72.1
Platforms
Android, iOS
JavaScript runtime
None
Workflow
React Native
Architecture
None
Build type
None
Device
None
Device model
No response
Acknowledgements
Yes
The text was updated successfully, but these errors were encountered: