Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: enabled #227

Merged
merged 17 commits into from
Sep 18, 2023
Merged

feat: enabled #227

merged 17 commits into from
Sep 18, 2023

Conversation

kirillzyusko
Copy link
Owner

@kirillzyusko kirillzyusko commented Aug 29, 2023

📜 Description

Added useKeyboardController hook that returns setEnabled + enabled (which allows to disable and enable module on demand).

💡 Motivation and Context

Fixes #233 #198 #241

📢 Changelog

JS

  • added useKeyboardController hook that gives an access to setEnabled method and enabled variable (that indicates current state);
  • added enabled property to specs;
  • manage enabled property via state (from react) and passing methods via context to change the value of this variable;
  • apply and revert monkey patch depending on enabled value.

iOS

  • paper: added property setter that calls mount/unmount depends on the value that comes;
  • fabric: detect prop changes in updateProps method and call mount/unmount depends on the value that comes;

Android

  • go to edge-to-edge when prop is set (before we did it in onAttachedToWindow method);
  • enable edge-to-edge mode if onAttachedToWindow is called more than one time;
  • consume insets from a root view if statusBarTranslucent props is set;
  • keep a single listener on a rootView to consume and propagate insets accordingly;
  • removed async setting up setupWindowInsets;
  • moved setting up/removing keyboard callbacks into separate functions;
  • added code regions and logical blocks for better navigation in code.

Docs

  • added a documentation about new useKeyboardController hook;
  • divided hooks in 2 categories: keyboard and module;
  • added emojis to hook groups.

🤔 How Has This Been Tested?

Tested on:

  • Pixel 3a (Android 13, emulator)
  • Pixel 6 Pro (Android 9, emulator)
  • Pixel 7 Pro (Android 13, real device);
  • Xiaomi Redmi Note 5 Pro (Android 9, real device);
  • iPhone 14 Pro (iOS 16.4, iOS 17, simulator);
  • iPhone 6S (iOS 15.6, real device).

📸 Screenshots (if appropriate):

Android iOS
Screen.Recording.2023-09-11.at.13.21.05.mov
enabled-disabled-trimmed.mp4

📝 Checklist

  • CI successfully passed

@kirillzyusko kirillzyusko added the enhancement New feature or request label Aug 29, 2023
@kirillzyusko kirillzyusko self-assigned this Aug 29, 2023
@github-actions
Copy link
Contributor

github-actions bot commented Aug 29, 2023

PR Preview Action v1.4.4
Preview removed because the pull request was closed.
2023-09-18 10:06 UTC

@kirillzyusko kirillzyusko mentioned this pull request Aug 29, 2023
@kirillzyusko kirillzyusko linked an issue Aug 29, 2023 that may be closed by this pull request
@github-actions
Copy link
Contributor

github-actions bot commented Sep 5, 2023

📊 Package size report

Current size Target Size Difference
73323 bytes 71043 bytes 2280 bytes 📈

@kirillzyusko kirillzyusko marked this pull request as ready for review September 14, 2023 20:30
src/animated.tsx Outdated Show resolved Hide resolved
@kirillzyusko kirillzyusko merged commit ef0f625 into main Sep 18, 2023
20 checks passed
@kirillzyusko kirillzyusko deleted the feat/enabled-prop branch September 18, 2023 10:04
@kirillzyusko kirillzyusko linked an issue Sep 29, 2023 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
2 participants