Skip to content

Commit

Permalink
feat: markdown lint for docs (#161)
Browse files Browse the repository at this point in the history
## 📜 Description

Added `markdownlint` to lint documentation markdown files.

## 💡 Motivation and Context
<!-- Why is this change required? What problem does it solve? -->
<!-- If it fixes an open issue, please link to the issue here. -->

To improve consistency of markdown.

## 📢 Changelog

<!-- High level overview of important changes -->
<!-- For example: fixed status bar manipulation; added new types
declarations; -->
<!-- If your changes don't affect one of platform/language below - then
remove this platform/language -->

### Docs
- align documentation to new linter standarts;

### CI
- added job checking `markdownlint`;

## 🤔 How Has This Been Tested?
<!-- Please describe in detail how you tested your changes. -->
<!-- Include details of your testing environment, and the tests you ran
to -->
<!-- see how your change affects other areas of the code, etc. -->

Tested locally (new docs) and on CI (`markdownlint`).

## 📝 Checklist

- [x] CI successfully passed
  • Loading branch information
kirillzyusko authored Jun 2, 2023
1 parent 264b2ec commit f1674b0
Show file tree
Hide file tree
Showing 53 changed files with 215 additions and 109 deletions.
16 changes: 16 additions & 0 deletions .github/workflows/verify-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,19 @@ jobs:
run: yarn install --frozen-lockfile
- name: Build website
run: yarn build
lint:
runs-on: ubuntu-latest
name: 🔎 Lint Markdown
defaults:
run:
working-directory: ./docs
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 16.x
cache: yarn
- name: Install dependencies
run: yarn install --frozen-lockfile
- name: Run Lint
run: yarn markdownlint-cli2 "**/*.md" "#node_modules"
5 changes: 5 additions & 0 deletions docs/.markdownlint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
default: true

# Disable checks for line length
MD013: false

28 changes: 14 additions & 14 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,40 +2,40 @@

This website is built using [Docusaurus 2](https://docusaurus.io/), a modern static website generator.

### Installation
## Installation

```
$ yarn
```bash
yarn
```

### Local Development
## Local Development

```
$ yarn start
```bash
yarn start
```

This command starts a local development server and opens up a browser window. Most changes are reflected live without having to restart the server.

### Build
## Build

```
$ yarn build
```bash
yarn build
```

This command generates static content into the `build` directory and can be served using any static contents hosting service.

### Deployment
## Deployment

Using SSH:

```
$ USE_SSH=true yarn deploy
```bash
USE_SSH=true yarn deploy
```

Not using SSH:

```
$ GIT_USER=<Your GitHub username> yarn deploy
```bash
GIT_USER=<Your GitHub username> yarn deploy
```

If you are using GitHub pages for hosting, this command is a convenient way to build the website and push to the `gh-pages` branch.
2 changes: 1 addition & 1 deletion docs/blog/2022-09-22-fabric/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ The decision to add support for a new architecture (to prioritize a new architec

Obviously, the migration process will take some time for other libraries, so future versions of this library will still support two architectures. When most other open source libraries will be migrated to the new architecture and the new architecture becomes the standard in the react native ecosystem, then support for the old architecture will be removed.

Stay tuned for future updates! 😊
Stay tuned for future updates! 😊
2 changes: 1 addition & 1 deletion docs/blog/2022-10-15-new-hook/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ New 1.4.0 release enhance API and adds new `useKeyboardHandler` hook. While keep

Also this hooks allow to track keyboard lifecycle and it's better suit for complex animations 😎

Check out the new documentation for this hook, upgrade library version to `1.4.0` and start using it today!
Check out the new documentation for this hook, upgrade library version to `1.4.0` and start using it today!
3 changes: 2 additions & 1 deletion docs/docs/api/hooks/use-keyboard-animation.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# useKeyboardAnimation

`useKeyboardAnimation` is a hook which gives access to two animated values:

- `height` - value which changes between **0** and **keyboardHeight**;
- `progress` - value which changes between **0** (keyboard closed) and **1** (keyboard opened).

Expand Down Expand Up @@ -44,4 +45,4 @@ class KeyboardAnimation extends React.PureComponent {
const { animated } = this.context;
}
}
```
```
3 changes: 2 additions & 1 deletion docs/docs/api/hooks/use-reanimated-keyboard-animation.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# useReanimatedKeyboardAnimation

`useReanimatedKeyboardAnimation` is a hook which gives access to two reanimated values:

- `height` - value which changes between **0** and **keyboardHeight**;
- `progress` - value which changes between **0** (keyboard closed) and **1** (keyboard opened).

Expand Down Expand Up @@ -44,4 +45,4 @@ class KeyboardAnimation extends React.PureComponent {
const { reanimated } = this.context;
}
}
```
```
12 changes: 6 additions & 6 deletions docs/docs/api/keyboard-controller-view.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,26 +8,26 @@ A plain react-native `View` with some additional methods and props. Used interna

## Props

#### `onKeyboardMoveStart`
### `onKeyboardMoveStart`

A callback function which is fired when keyboard starts a transition from one to another state (from closed to open, for example).

#### `onKeyboardMove`
### `onKeyboardMove`

A callback function which is fired every time, when keyboard changes its position on the screen.

#### `onKeyboardMoveInteractive`
### `onKeyboardMoveInteractive`

A callback function which is fired every time, when user drags keyboard.

#### `onKeyboardMoveEnd`
### `onKeyboardMoveEnd`

A callback function which is fired when keyboard finished a transition from one to another state (from closed to open, for example).

#### `statusBarTranslucent`
### `statusBarTranslucent`

A boolean prop to indicate whether `StatusBar` should be translucent on `Android` or not.

#### `navigationBarTranslucent`
### `navigationBarTranslucent`

A boolean prop to indicate whether [NavigationBar](https://m2.material.io/design/platform-guidance/android-bars.html#android-navigation-bar) should be translucent on `Android` or not.
3 changes: 2 additions & 1 deletion docs/docs/api/keyboard-controller.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ sidebar_position: 5
# KeyboardController

`KeyboardController` is an object which has two functions:

- `setInputMode` - used to change `windowSoftInputMode` in runtime;
- `setDefaultMode` - used to restore default `windowSoftInputMode` (which is declared in `AndroidManifest.xml`);

Expand All @@ -25,4 +26,4 @@ export const useResizeMode = () => {
return () => KeyboardController.setDefaultMode();
}, []);
};
```
```
2 changes: 1 addition & 1 deletion docs/docs/api/keyboard-events.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@ useEffect(() => {
}, []);
```

Also have a look on [example](https://github.com/kirillzyusko/react-native-keyboard-controller/tree/main/example) app for more comprehensive usage.
Also have a look on [example](https://github.com/kirillzyusko/react-native-keyboard-controller/tree/main/example) app for more comprehensive usage.
6 changes: 3 additions & 3 deletions docs/docs/api/keyboard-gesture-area.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,18 @@ This component is available only for Android >= 11. For iOS and Android < 11 it

## Props

#### `interpolator`
### `interpolator`

String with possible values `linear` and `ios`:

- **ios** - interactive keyboard dismissing will work as in iOS: swipes in non-keyboard area will not affect keyboard positioning, but if your swipe touches keyboard - keyboard will follow finger position.
- **linear** - gestures inside the component will linearly affect the position of the keyboard, i.e. if the user swipes down by 20 pixels, then the keyboard will also be moved down by 20 pixels, even if the gesture was not made over the keyboard area.

#### `showOnSwipeUp`
### `showOnSwipeUp`

A boolean prop which allows to customize interactive keyboard behavior. If set to `true` then it allows to show keyboard (if it's already closed) by swipe up gesture. `false` by default.

#### `enableSwipeToDismiss`
### `enableSwipeToDismiss`

A boolean prop which allows to customize interactive keyboard behavior. If set to `false`, then any gesture will not affect keyboard position if the keyboard is shown. `true` by default.

Expand Down
6 changes: 3 additions & 3 deletions docs/docs/api/keyboard-provider.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ sidebar_position: 2

## Props

#### `statusBarTranslucent`
### `statusBarTranslucent`

A boolean prop to indicate whether `StatusBar` should be translucent on `Android` or not.

:::caution Important defaults
By default this library stretches to full screen (`edge-to-edge` mode) and status bar becomes translucent. But the library tries to use standard RN app behavior and automatically applies padding from top to look like a standard RN app. If you use `translucent` prop for `StatusBar` component - it will not work anymore. You'll need to specify it on provider level. For more info [see](https://github.com/kirillzyusko/react-native-keyboard-controller/pull/30) this PR.
:::

#### `navigationBarTranslucent`
### `navigationBarTranslucent`

A boolean prop to indicate whether [NavigationBar](https://m2.material.io/design/platform-guidance/android-bars.html#android-navigation-bar) should be translucent on `Android` or not.

Expand All @@ -32,4 +32,4 @@ const App = () => {
</KeyboardProvider>
);
}
```
```
2 changes: 1 addition & 1 deletion docs/docs/guides/building-own-hook.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,4 @@ function useKeyboardAnimation() {
}
```

In this case when screen becomes invisible hook will restore default `softInputMode`, and `softInputMode` will be set to `adjustResize` only on the screen where it's used.
In this case when screen becomes invisible hook will restore default `softInputMode`, and `softInputMode` will be set to `adjustResize` only on the screen where it's used.
6 changes: 3 additions & 3 deletions docs/docs/guides/compatibility.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ Below you can find a table with supported versions:

|library version|react-native version|
|-------|--------------------|
|1.3.0+ | 0.70.0+ |
|1.2.0+ | 0.69.0+ |
|1.3.0+ | 0.70.0+ |
|1.2.0+ | 0.69.0+ |

:::info

Expand All @@ -29,4 +29,4 @@ For example `react-native-screens` [were](https://github.com/software-mansion/re

`StatusBar` component from `react-native` is also using deprecated API. In order to allow better compatibility - `react-native-keyboard-controller` [monkey-patches](https://github.com/kirillzyusko/react-native-keyboard-controller/pull/30) this component (hopefully soon they will change an approach and will rewrite this component to new API).

If you know other 3rd party libraries that may be using deprecated API, please open an [issue](https://github.com/kirillzyusko/react-native-keyboard-controller/issues/new?assignees=kirillzyusko&labels=bug&template=bug_report.md&title=) and we'll try to fix it.
If you know other 3rd party libraries that may be using deprecated API, please open an [issue](https://github.com/kirillzyusko/react-native-keyboard-controller/issues/new?assignees=kirillzyusko&labels=bug&template=bug_report.md&title=) and we'll try to fix it.
5 changes: 2 additions & 3 deletions docs/docs/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ This library has native code, so it does not work with _Expo Go_ but you can eas

## Adding provider

In order to use it you'll need to wrap your app with `KeyboardProvider` component.
In order to use it you'll need to wrap your app with `KeyboardProvider` component.

:::info Why it's needed?

Expand Down Expand Up @@ -58,7 +58,6 @@ Congratulations! 🎉 You've just finished installation process. Go to the [next

Sometimes you may see failed Android builds complaining that your version of kotlin is lower than expected version.


`error: module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.6.0, expected version is 1.4.1.`

To overcome this issue you will need to set higher version of the kotlin:
Expand Down Expand Up @@ -106,4 +105,4 @@ And add plugin inside of your `app.json` or `app.config.js` with following confi

### Swift support

Since part of this library is written using `swift` language - your project needs to support it. For that you can create empty `.swift` file with bridging header. See this [step-by-step](https://stackoverflow.com/a/56176956/9272042) guide if you have problems.
Since part of this library is written using `swift` language - your project needs to support it. For that you can create empty `.swift` file with bridging header. See this [step-by-step](https://stackoverflow.com/a/56176956/9272042) guide if you have problems.
1 change: 1 addition & 0 deletions docs/docs/recipes/architecture.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ The library was designed to use a `context` as a global store for animated value
## Why custom `KeyboardControllerView` is needed?

Initially I had a choice which approach to use in order to send events about keyboard frames: `EventEmitters` vs `View` with callbacks. I decided to use `View` with callbacks because of several reasons:

- `react-native` core team uses similar approach for `onScroll` event from `ScrollView` component (also I knew, that it's possible to map events from such callbacks to `Animated.Value` and thus reduce bridge usage);
- to track keyboard frames on Android we need to enter to [edge-to-edge](https://developer.android.com/training/gestures/edge-to-edge) mode and it changes view paddings. Since it's managed through `View` it's easier to change padding of this view.
- `reanimated` allows to intercept `view` events using theirs `useEvent` hook and move the event handling into worklet runtime. Thus sending events via `view` allows to make an integration with `reanimated` package and handle events/animate everything directly on the UI thread.
1 change: 1 addition & 0 deletions docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
"devDependencies": {
"@docusaurus/module-type-aliases": "2.4.0",
"@tsconfig/docusaurus": "^1.0.5",
"markdownlint-cli2": "^0.7.1",
"typescript": "^4.7.4"
},
"browserslist": {
Expand Down
7 changes: 0 additions & 7 deletions docs/src/pages/markdown-page.md

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# useKeyboardAnimation

`useKeyboardAnimation` is a hook which gives access to two animated values:

- `height` - value which changes between **0** and **keyboardHeight**;
- `progress` - value which changes between **0** (keyboard closed) and **1** (keyboard opened).

Expand Down Expand Up @@ -44,4 +45,4 @@ class KeyboardAnimation extends React.PureComponent {
const { animated } = this.context;
}
}
```
```
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# useReanimatedKeyboardAnimation

`useReanimatedKeyboardAnimation` is a hook which gives access to two reanimated values:

- `height` - value which changes between **0** and **keyboardHeight**;
- `progress` - value which changes between **0** (keyboard closed) and **1** (keyboard opened).

Expand Down Expand Up @@ -44,4 +45,4 @@ class KeyboardAnimation extends React.PureComponent {
const { reanimated } = this.context;
}
}
```
```
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ A plain react-native `View` with some additional methods and props. Used interna

## Props

#### `onKeyboardMove`
### `onKeyboardMove`

A callback function which is fired every time, when keyboard changes its position on the screen.

#### `statusBarTranslucent`
### `statusBarTranslucent`

A boolean prop to indicate whether `StatusBar` should be translucent on `Android` or not.
A boolean prop to indicate whether `StatusBar` should be translucent on `Android` or not.
3 changes: 2 additions & 1 deletion docs/versioned_docs/version-1.0.0/api/keyboard-controller.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# KeyboardController

`KeyboardController` is an object which has two functions:

- `setInputMode` - used to change `windowSoftInputMode` in runtime;
- `setDefaultMode` - used to restore default `windowSoftInputMode` (which is declared in `AndroidManifest.xml`);

Expand All @@ -21,4 +22,4 @@ export const useResizeMode = () => {
return () => KeyboardController.setDefaultMode();
}, []);
};
```
```
2 changes: 1 addition & 1 deletion docs/versioned_docs/version-1.0.0/api/keyboard-events.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ useEffect(() => {
}, []);
```

Also have a look on [example](https://github.com/kirillzyusko/react-native-keyboard-controller/tree/main/example) app for more comprehensive usage.
Also have a look on [example](https://github.com/kirillzyusko/react-native-keyboard-controller/tree/main/example) app for more comprehensive usage.
4 changes: 2 additions & 2 deletions docs/versioned_docs/version-1.0.0/api/keyboard-provider.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

## Props

#### `statusBarTranslucent`
### `statusBarTranslucent`

A boolean prop to indicate whether `StatusBar` should be translucent on `Android` or not.

Expand All @@ -24,4 +24,4 @@ const App = () => {
</KeyboardProvider>
);
}
```
```
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,4 @@ function useKeyboardAnimation() {
}
```

In this case when screen becomes invisible hook will restore default `softInputMode`, and `softInputMode` will be set to `adjustResize` only on the screen where it's used.
In this case when screen becomes invisible hook will restore default `softInputMode`, and `softInputMode` will be set to `adjustResize` only on the screen where it's used.
Loading

0 comments on commit f1674b0

Please sign in to comment.