Skip to content

Commit e5a7071

Browse files
authored
fix: status bar manager on fabric (#200)
1 parent 6321477 commit e5a7071

File tree

7 files changed

+57
-96
lines changed

7 files changed

+57
-96
lines changed

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,10 @@
3131
yarn add react-native-notificated
3232
```
3333

34+
## 🔥 New Architecture
35+
36+
React-native-notificated is fully compatible with React new architecture on both Android and iOS.
37+
3438
## 📖 Documentation
3539

3640
Check the docs here [Click](https://thewidlarzgroup.github.io/react-native-notificated/)

docs/docs/intro/intro.md

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,11 @@ id: intro
1919
yarn add react-native-notificated
2020
```
2121

22-
:::info
23-
Starting from the latest beta version, you are expected to manually tell the library whether a device has notch or not. Use the `isNotch` prop in the config for it (you can use the `react-native-device-info` for instance).
22+
## 🔥 New Architecture
2423

25-
We are currently working on improving this part of our API 💪
26-
:::
24+
React-native-notificated is fully compatible with React new architecture on both Android and iOS.
2725

28-
### 🛸 Dependencies
26+
## 🛸 Dependencies
2927

3028
This library requires these dependencies to be installed in your project:
3129

@@ -41,7 +39,7 @@ yarn add react-native-reanimated react-native-gesture-handler
4139
**react-native-gesture-handler** requires additional installation steps: [guide here](https://docs.swmansion.com/react-native-gesture-handler/docs/) 👈
4240
:::
4341

44-
## ❤️ Built With[](https://gorhom.github.io/react-native-bottom-sheet/#built-with-%EF%B8%8F)
42+
## ❤️ Built With
4543

4644
- [react-native-reanimated](https://github.com/software-mansion/react-native-reanimated)
4745
- [react-native-gesture-handler](https://github.com/software-mansion/react-native-gesture-handler)

docs/docusaurus.config.js

Lines changed: 0 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,9 @@ const config = {
2424
docs: {
2525
sidebarCollapsible: false,
2626
sidebarPath: require.resolve('./sidebars.js'),
27-
// Please change this to your repo.
28-
editUrl:
29-
'https://github.com/facebook/docusaurus/tree/main/packages/create-docusaurus/templates/shared/',
3027
},
3128
blog: {
3229
showReadingTime: true,
33-
// Please change this to your repo.
34-
editUrl:
35-
'https://github.com/facebook/docusaurus/tree/main/packages/create-docusaurus/templates/shared/',
3630
},
3731
theme: {
3832
customCss: require.resolve('./src/css/custom.css'),
@@ -63,59 +57,13 @@ const config = {
6357
position: 'left',
6458
label: 'API Reference',
6559
},
66-
// {to: '/blog', label: 'Blog', position: 'left'},
6760
{
6861
href: 'https://github.com/TheWidlarzGroup/react-native-notificated',
6962
label: 'GitHub',
7063
position: 'right',
7164
},
7265
],
7366
},
74-
// footer: {
75-
// style: 'dark',
76-
// links: [
77-
// {
78-
// title: 'Docs',
79-
// items: [
80-
// {
81-
// label: 'Tutorial',
82-
// to: '/docs/intro',
83-
// },
84-
// ],
85-
// },
86-
// {
87-
// title: 'Community',
88-
// items: [
89-
// {
90-
// label: 'Stack Overflow',
91-
// href: 'https://stackoverflow.com/questions/tagged/docusaurus',
92-
// },
93-
// {
94-
// label: 'Discord',
95-
// href: 'https://discordapp.com/invite/docusaurus',
96-
// },
97-
// {
98-
// label: 'Twitter',
99-
// href: 'https://twitter.com/docusaurus',
100-
// },
101-
// ],
102-
// },
103-
// {
104-
// title: 'More',
105-
// items: [
106-
// {
107-
// label: 'Blog',
108-
// to: '/blog',
109-
// },
110-
// {
111-
// label: 'GitHub',
112-
// href: 'https://github.com/facebook/docusaurus',
113-
// },
114-
// ],
115-
// },
116-
// ],
117-
// copyright: `Copyright © ${new Date().getFullYear()} My Project, Inc. Built with Docusaurus.`,
118-
// },
11967
prism: {
12068
theme: lightCodeTheme,
12169
darkTheme: darkCodeTheme,

docs/src/pages/index.tsx

Lines changed: 27 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
1-
import React from 'react';
2-
import Layout from '@theme/Layout';
3-
import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
4-
import styles from './index.module.css';
5-
import githubBlackIcon from '../../static/img/githubBlack.png';
6-
import githubWhiteIcon from '../../static/img/githubWhite.png';
7-
import isDarkTheme from '@docusaurus/theme-common';
1+
import React from 'react'
2+
import Layout from '@theme/Layout'
3+
import useDocusaurusContext from '@docusaurus/useDocusaurusContext'
4+
import styles from './index.module.css'
5+
import githubBlackIcon from '../../static/img/githubBlack.png'
6+
import githubWhiteIcon from '../../static/img/githubWhite.png'
7+
import { useColorMode } from '@docusaurus/theme-common'
88

99
function HomepageHero() {
10+
const themeData = useColorMode()
11+
const isDarkTheme = themeData.colorMode === 'dark'
12+
1013
const buttonStyle = isDarkTheme ? styles.heroButtonWhite : styles.heroButtonBlack
1114
const iconColor = isDarkTheme ? githubWhiteIcon : githubBlackIcon
1215
const leftLightningColor = isDarkTheme ? styles.whiteLightningLeft : styles.blackLightningLeft
@@ -20,35 +23,39 @@ function HomepageHero() {
2023
<div className={styles.heroText}>
2124
<h1 className={styles.heroTitle}>Blazingly super fast RN notification library</h1>
2225
<h2 className={styles.heroDescription}>Better than your delivery man!</h2>
23-
<div className={styles.underline}/>
26+
<div className={styles.underline} />
2427
</div>
2528
<div className={styles.heroButtons}>
26-
<a href='docs/intro' className={buttonStyle}>OK, let's go</a>
27-
<a href='https://github.com/TheWidlarzGroup/react-native-notificated' className={buttonStyle}>
28-
<img src={iconColor} alt="github icon" className={styles.githubIcon}/>
29+
<a href="docs/intro" className={buttonStyle}>
30+
OK, let's go
31+
</a>
32+
<a
33+
href="https://github.com/TheWidlarzGroup/react-native-notificated"
34+
className={buttonStyle}>
35+
<img src={iconColor} alt="github icon" className={styles.githubIcon} />
2936
Github
3037
</a>
3138
</div>
3239
</div>
3340
<div className={styles.heroLogo}>
34-
<div className={leftLightningColor}/>
35-
<div className={leftLineColor}/>
36-
<div className={styles.blueLineLeft}/>
37-
<div className={styles.blueLineRight}/>
38-
<div className={rightLineColor}/>
39-
<div className={rightLightningColor}/>
41+
<div className={leftLightningColor} />
42+
<div className={leftLineColor} />
43+
<div className={styles.blueLineLeft} />
44+
<div className={styles.blueLineRight} />
45+
<div className={rightLineColor} />
46+
<div className={rightLightningColor} />
4047
</div>
4148
</div>
42-
);
49+
)
4350
}
4451

4552
export default function Home(): JSX.Element {
46-
const {siteConfig} = useDocusaurusContext();
53+
const { siteConfig } = useDocusaurusContext()
4754
return (
4855
<Layout
4956
title={`Hello from ${siteConfig.title}`}
5057
description="Description will go into a meta tag in <head />">
5158
<HomepageHero />
5259
</Layout>
53-
);
60+
)
5461
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
"@twgdev/prettier-config": "^1.0.2",
5656
"@types/jest": "^26.0.0",
5757
"@types/react": "^16.9.19",
58-
"@types/react-native": "0.66.9",
58+
"@types/react-native": "0.68.4",
5959
"babel-plugin-module-resolver": "^4.1.0",
6060
"commitlint": "^11.0.0",
6161
"eslint": "^7.32.0",

src/core/hooks/useStatusBarHeightDetector.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,18 @@ type Props = {
55
isPortraitMode: boolean
66
}
77

8+
const NativeStatusBarManager = require('react-native/Libraries/Components/StatusBar/NativeStatusBarManagerIOS')
9+
810
export const useStatusBarHeightDetector = ({ isPortraitMode }: Props) => {
911
const { StatusBarManager } = NativeModules
1012
const [barHeight, setBarHeight] = useState(0)
1113

1214
useEffect(() => {
1315
if (Platform.OS !== 'ios') return setBarHeight(StatusBar.currentHeight ?? 0)
1416
// handling edge case when app is opened in landscape mode and barHeight = 0
15-
StatusBarManager.getHeight(({ height }: { height: number }) =>
17+
const StatusBarManagerModule = NativeStatusBarManager || StatusBarManager
18+
19+
StatusBarManagerModule.getHeight(({ height }: { height: number }) =>
1620
setBarHeight(isPortraitMode && height !== 0 ? height : 50)
1721
)
1822
}, [StatusBarManager, isPortraitMode])

yarn.lock

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2482,26 +2482,26 @@
24822482
resolved "https://registry.yarnpkg.com/@types/prop-types/-/prop-types-15.7.4.tgz#fcf7205c25dff795ee79af1e30da2c9790808f11"
24832483
integrity sha512-rZ5drC/jWjrArrS8BR6SIr4cWpW09RNTYt9AMZo3Jwwif+iacXAqgVjm0B0Bv/S1jhDXKHqRVNCbACkJ89RAnQ==
24842484

2485-
"@types/react-native@0.66.9":
2486-
version "0.66.9"
2487-
resolved "https://registry.yarnpkg.com/@types/react-native/-/react-native-0.66.9.tgz#a051d1f1f3cd03df4b4870e91e416b71377a8b7a"
2488-
integrity sha512-lve1rgQadbOM82ZRiw6CvvManUeidDhlFtiXA+dErI7a7/NNxLM7kZVYDNKd/QQc5FgLlQ0Uof2QInup7OwsBg==
2485+
"@types/react-native@0.68.4":
2486+
version "0.68.4"
2487+
resolved "https://registry.yarnpkg.com/@types/react-native/-/react-native-0.68.4.tgz#2495a94ae5949511e85beb64792ebeb722c56ce6"
2488+
integrity sha512-rPz7HRMNhwPMrzaMtG5QtFpKuIH4XlBkrVSZICqCtHTbaixdtStSyAp9GxkBJAQmmK2McO28mmqDiyqKOoOL5Q==
24892489
dependencies:
2490-
"@types/react" "*"
2490+
"@types/react" "^17"
24912491

2492-
"@types/react@*":
2493-
version "17.0.38"
2494-
resolved "https://registry.yarnpkg.com/@types/react/-/react-17.0.38.tgz#f24249fefd89357d5fa71f739a686b8d7c7202bd"
2495-
integrity sha512-SI92X1IA+FMnP3qM5m4QReluXzhcmovhZnLNm3pyeQlooi02qI7sLiepEYqT678uNiyc25XfCqxREFpy3W7YhQ==
2492+
"@types/react@^16.9.19":
2493+
version "16.14.21"
2494+
resolved "https://registry.yarnpkg.com/@types/react/-/react-16.14.21.tgz#35199b21a278355ec7a3c40003bd6a334bd4ae4a"
2495+
integrity sha512-rY4DzPKK/4aohyWiDRHS2fotN5rhBSK6/rz1X37KzNna9HJyqtaGAbq9fVttrEPWF5ywpfIP1ITL8Xi2QZn6Eg==
24962496
dependencies:
24972497
"@types/prop-types" "*"
24982498
"@types/scheduler" "*"
24992499
csstype "^3.0.2"
25002500

2501-
"@types/react@^16.9.19":
2502-
version "16.14.21"
2503-
resolved "https://registry.yarnpkg.com/@types/react/-/react-16.14.21.tgz#35199b21a278355ec7a3c40003bd6a334bd4ae4a"
2504-
integrity sha512-rY4DzPKK/4aohyWiDRHS2fotN5rhBSK6/rz1X37KzNna9HJyqtaGAbq9fVttrEPWF5ywpfIP1ITL8Xi2QZn6Eg==
2501+
"@types/react@^17":
2502+
version "17.0.53"
2503+
resolved "https://registry.yarnpkg.com/@types/react/-/react-17.0.53.tgz#10d4d5999b8af3d6bc6a9369d7eb953da82442ab"
2504+
integrity sha512-1yIpQR2zdYu1Z/dc1OxC+MA6GR240u3gcnP4l6mvj/PJiVaqHsQPmWttsvHsfnhfPbU2FuGmo0wSITPygjBmsw==
25052505
dependencies:
25062506
"@types/prop-types" "*"
25072507
"@types/scheduler" "*"
@@ -9974,9 +9974,9 @@ typedarray@^0.0.6:
99749974
integrity sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=
99759975

99769976
typescript@^4.1.3:
9977-
version "4.5.4"
9978-
resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.5.4.tgz#a17d3a0263bf5c8723b9c52f43c5084edf13c2e8"
9979-
integrity sha512-VgYs2A2QIRuGphtzFV7aQJduJ2gyfTljngLzjpfW9FoYZF6xuw1W0vW9ghCKLfcWrCFxK81CSGRAvS1pn4fIUg==
9977+
version "4.9.5"
9978+
resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.9.5.tgz#095979f9bcc0d09da324d58d03ce8f8374cbe65a"
9979+
integrity sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g==
99809980

99819981
ua-parser-js@^0.7.30:
99829982
version "0.7.33"

0 commit comments

Comments
 (0)