Gathering detailed insights and metrics for react-native-safe-area
Gathering detailed insights and metrics for react-native-safe-area
Gathering detailed insights and metrics for react-native-safe-area
Gathering detailed insights and metrics for react-native-safe-area
react-native-safe-area-context
A flexible way to handle safe area, also works on Android and web.
react-native-safe-area-view
Add padding to your views to account for notches, home indicators, status bar, and possibly other future things.
@react-native-oh-tpl/react-native-safe-area-context
A flexible way to handle safe area, also works on Android and web.
primeton-react-native-safe-area-context
React Native module to retrieve safe area insets for iOS 11 or later.
npm install react-native-safe-area
Typescript
Module System
Node Version
NPM Version
JavaScript (61.55%)
Objective-C (34.42%)
Ruby (4.04%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
112 Stars
82 Commits
23 Forks
3 Watchers
16 Branches
8 Contributors
Updated on Jun 10, 2025
Latest Version
0.5.1
Package Id
react-native-safe-area@0.5.1
Unpacked Size
37.42 kB
Size
10.23 kB
File Count
18
NPM Version
6.4.1
Node Version
8.12.0
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
React Native module to handle safe area insets natively for iOS 11 or later.
npm
1npm install --save react-native-safe-area
You can link native code in the way you prefer:
Add line to your project target section in your Podfile:
1target 'YourProjectTarget' do 2 3+ pod 'react-native-safe-area', path: '../node_modules/react-native-safe-area' 4 5end
If you received error jest-haste-map: Haste module naming collision: Duplicate module name: react-native
, add lines below to your Podfile and reinstall pods.
1target 'YourProjectTarget' do 2 3+ rn_path = '../node_modules/react-native' 4+ pod 'yoga', path: "#{rn_path}/ReactCommon/yoga/yoga.podspec" 5+ pod 'React', path: rn_path 6 7 pod 'react-native-safe-area', path: '../node_modules/react-native-safe-area' 8 9end 10 11+ post_install do |installer| 12+ installer.pods_project.targets.each do |target| 13+ if target.name == "React" 14+ target.remove_from_project 15+ end 16+ end 17+ end
Run command below:
1react-native link react-native-safe-area
Use withSafeArea
to apply safe area insets to views automatically.
1import { withSafeArea } from 'react-native-safe-area'
A higher-order component which applies safe area insets automatically to the wrapped component.
component
: Component - Wrapped component.applyTo
: string - (Optional) Specify property to apply safe area insets.
margin
- style.margin
. (Default)padding
- style.padding
.absolutePosition
- style.top
, style.bottom
, style.left
and style.right
.contentInset
- contentInset
and contentOffset
for scroll views.direction
: string - (Optional) Specify direction to apply safe area insets.
top
- Apply to top.bottom
- Apply to bottom.left
- Apply to left.right
- Apply to right.topAndLeft
- top
+ left
.topAndRight
- top
+ right
.bottomAndLeft
- bottom
+ left
.bottomAndRight
- bottom
+ right
.horizontal
- left
+ right
.horizontalAndTop
- horizontal
+ top
.horizontalAndBottom
- horizontal
+ bottom
.vertical
- top
+ bottom
.verticalAndLeft
- vertical
+ left
.verticalAndRight
- vertical
+ right
.all
- horizontal
+ vertical
. (Default)1const SafeAreaView = withSafeArea(View, 'margin', 'all') 2 3class App extends Component<{}> { 4 render() { 5 return ( 6 <SafeAreaView> 7 <View /> 8 </SafeAreaView> 9 ) 10 } 11}
1const SafeAreaScrollView = withSafeArea(ScrollView, 'contentInset', 'vertical') 2 3class App extends Component<{}> { 4 render() { 5 return ( 6 <SafeAreaScrollView> 7 <View /> 8 </SafeAreaScrollView> 9 ) 10 } 11}
You can also apply safe area insets to FlatList and SectionList.
wrappedRef
: refReturns wrapped component's ref.
currentSafeAreaInsets
: SafeAreaInsetsReturns current safe area insets.
1import SafeArea from 'react-native-safe-area'
If you want to use SafeAreaInsets
type, you can import it like below:
1import SafeArea, { type SafeAreaInsets } from 'react-native-safe-area'
1SafeArea.getSafeAreaInsetsForRootView() 2 .then((result) => { 3 console.log(result) 4 // { safeAreaInsets: { top: 44, left: 0, bottom: 34, right: 0 } } 5 })
1class App extends Component<{}> { 2 // To keep the context of 'this' 3 onSafeAreaInsetsForRootViewChange = this.onSafeAreaInsetsForRootViewChange.bind(this) 4 5 componentDidMount() { 6 // Add event listener 7 SafeArea.addEventListener('safeAreaInsetsForRootViewDidChange', this.onSafeAreaInsetsForRootViewChange) 8 } 9 10 componentWillUnmount() { 11 // Remove event listener 12 SafeArea.removeEventListener('safeAreaInsetsForRootViewDidChange', this.onSafeAreaInsetsForRootViewChange) 13 } 14 15 onSafeAreaInsetsForRootViewChange(result) { 16 // Called every time that safe area insets changed 17 console.log(result) 18 // { safeAreaInsets: { top: 0, left: 44, bottom: 21, right: 44 } } 19 } 20}
A simple example project is here.
No vulnerabilities found.
Reason
license file detected
Details
Reason
binaries present in source code
Details
Reason
Found 5/23 approved changesets -- score normalized to 2
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
94 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-07-07
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More