You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This lets consumers get the insets and frame without using the hooks.
So it's possible to minimize re-renders by controlling when state needs
to be updated.
Component that lets you listen to safe area insets and frame changes at the position where it is rendered.
8
+
9
+
This is an alternative to using the `useSafeAreaInsets` and `useSafeAreaFrame` hooks in combinations with `SafeAreaProvider`. Unlike the hooks, this notifies about changes with the `onChange` prop and doesn't trigger re-renders when the insets or frame change.
console.log('Safe area changed:', { insets, frame });
21
+
}}
22
+
>
23
+
{/* Your content here */}
24
+
</SafeAreaListener>
25
+
);
26
+
}
27
+
```
28
+
29
+
### Props
30
+
31
+
Accepts all [View](https://reactnative.dev/view#props) props.
32
+
33
+
#### `onChange`
34
+
35
+
Required, a function that receives an object with `insets` and `frame` properties. The `insets` property contains the safe area insets, and the `frame` property contains the frame of the component.
0 commit comments