File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ import { FABRIC_ENABLED, MAX_VALUE } from '../constants';
1010 */
1111export const useLayout = ( { enterFrom } : Notification ) => {
1212 const [ isLayoutReady , setLayoutReady ] = useState ( false ) ;
13+ const isLayoutReadyRef = useRef ( false ) ;
1314 const ref = useRef < View > ( null ) ;
1415 // store current direction to handle the case when component dimensions changes (trigger onLayout)
1516 // while active direction != enterFrom (e.g. when exitTo is different than enterFrom, and notification started hiding animation).
@@ -66,7 +67,13 @@ export const useLayout = ({ enterFrom }: Notification) => {
6667 componentWidth . setValue ( width ) ;
6768
6869 updateHiddenValueByDirection ( currentDirection . current ) ;
69- setLayoutReady ( true ) ;
70+
71+ // use ref to store the "isLayoutReady" value because calling setLayoutReady(true) more than once
72+ // in the new architecture triggers render more than once.
73+ if ( ! isLayoutReadyRef . current ) {
74+ setLayoutReady ( true ) ;
75+ isLayoutReadyRef . current = true ;
76+ }
7077 } ,
7178 [ componentHeight , componentWidth , updateHiddenValueByDirection ]
7279 ) ;
You can’t perform that action at this time.
0 commit comments