Skip to content

Commit

Permalink
AnimatedComponent [nfc]: Initialize animatedValue based on visible.
Browse files Browse the repository at this point in the history
Currently, AnimatedComponent has only one caller, and it always
starts by passing `false` for `visible`. Since it never passes
`true` initially, the new path isn't exercised. But we should make
it so future callers that pass `true` initially will actually see
the element start as visible. So, do that.

See more discussion at
  #4914 (comment).
  • Loading branch information
chrisbobbe committed Jul 28, 2021
1 parent 9daafd2 commit f92460c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/animation/AnimatedComponent.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export default function AnimatedComponent(props: Props) {
style,
} = props;

const animatedValue = useRef(new Animated.Value(0));
const animatedValue = useRef(new Animated.Value(visible === true ? fullValue : 0));

const animate = useCallback(() => {
Animated.timing(animatedValue.current, {
Expand Down

0 comments on commit f92460c

Please sign in to comment.