Skip to content

Commit f39947e

Browse files
authored
docs: improve method swizzling warning & markdown lint fixes (#2)
1 parent 9e8fe18 commit f39947e

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

README.md

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,18 @@ or
1414
yarn add react-native-override-color-scheme
1515
```
1616

17-
#### RN >= 0.60
17+
### RN >= 0.60
18+
1819
If you are using RN >= 0.60, only run `npx pod-install`. Then rebuild your project.
1920

20-
#### iOS
21-
##### Optional support for alerts on iOS
22-
> :warning: By default, overriding the interface style (light or dark) using this package doesn't work for alerts on iOS. We use [method swizzling](https://medium.com/rocknnull/ios-to-swizzle-or-not-to-swizzle-f8b0ed4a1ce6) for the `viewWillAppear` method of `UIAlertController` class which might create problems in some cases (for example, if another package is also swizzling the same class method). That's why we have made this step optional.
21+
### iOS
22+
23+
#### Optional support for alerts on iOS
24+
25+
> :warning: We use [method swizzling](https://medium.com/rocknnull/ios-to-swizzle-or-not-to-swizzle-f8b0ed4a1ce6) to enable support for alerts on iOS. Method swizzling is used by [Firebase iOS SDK](https://firebase.google.com/docs/cloud-messaging/ios/client#method_swizzling_in) as well, but it can be problematic in some cases, especially when another library is also swizzling the same method. That’s why we have made this step optional.
26+
27+
To enable support for alerts on iOS, please follow the steps below:
2328

24-
To enable this, please follow the steps below:
2529
1. Open your `/ios/{projectName}/AppDelegate.m` file
2630
1. At the top of the file, import the OverrideColorScheme module: `#import <OverrideColorScheme.h>`
2731
1. And then, within your existing `didFinishLaunchingWithOptions` method, add `[OverrideColorScheme enableAlertSupport];` to the top of the method (see below).
@@ -39,7 +43,8 @@ To enable this, please follow the steps below:
3943
}
4044
```
4145
42-
#### Android
46+
### Android
47+
4348
No additional step is required.
4449
4550
## Usage
@@ -53,6 +58,7 @@ overrideColorScheme.setScheme('dark'); // or `light` or `undefined` for system d
5358
```
5459

5560
See the [example](example) for advanced use cases.
61+
5662
## Contributing
5763

5864
See the [contributing guide](CONTRIBUTING.md) to learn how to contribute to the repository and the development workflow.

0 commit comments

Comments
 (0)