From b0c36383a9a7304f94c2bb19f7cc4b37e0b4f637 Mon Sep 17 00:00:00 2001
From: Samuel Newman <mozzius@protonmail.com>
Date: Mon, 25 Nov 2024 20:30:15 +0000
Subject: Ensure react-native-keyboard-controller enabled state doesn't get
 overwritten (#6727)

* revert to prev state instead of false

* add dep array

* use ref counting approach

* patch keyboard controller to allow changing the enabled prop

* remove state from patch

* change patched prop name

* remove Math.max check, log if < 0

* use noop provider

* rm patch, use `useRef`

* Style nits

* Rm on web

---------

Co-authored-by: Dan Abramov <dan.abramov@gmail.com>
---
 src/App.native.tsx | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

(limited to 'src/App.native.tsx')

diff --git a/src/App.native.tsx b/src/App.native.tsx
index 9b2940aa9..69f7faf9e 100644
--- a/src/App.native.tsx
+++ b/src/App.native.tsx
@@ -4,7 +4,6 @@ import '#/view/icons'
 
 import React, {useEffect, useState} from 'react'
 import {GestureHandlerRootView} from 'react-native-gesture-handler'
-import {KeyboardProvider} from 'react-native-keyboard-controller'
 import {RootSiblingParent} from 'react-native-root-siblings'
 import {
   initialWindowMetrics,
@@ -70,6 +69,7 @@ import {Splash} from '#/Splash'
 import {BottomSheetProvider} from '../modules/bottom-sheet'
 import {BackgroundNotificationPreferencesProvider} from '../modules/expo-background-notification-handler/src/BackgroundNotificationHandlerProvider'
 import {AppProfiler} from './AppProfiler'
+import {KeyboardControllerProvider} from './lib/hooks/useEnableKeyboardController'
 
 SplashScreen.preventAutoHideAsync()
 
@@ -188,7 +188,7 @@ function App() {
     <AppProfiler>
       <GeolocationProvider>
         <A11yProvider>
-          <KeyboardProvider enabled={false} statusBarTranslucent={true}>
+          <KeyboardControllerProvider>
             <SessionProvider>
               <PrefsStateProvider>
                 <I18nProvider>
@@ -217,7 +217,7 @@ function App() {
                 </I18nProvider>
               </PrefsStateProvider>
             </SessionProvider>
-          </KeyboardProvider>
+          </KeyboardControllerProvider>
         </A11yProvider>
       </GeolocationProvider>
     </AppProfiler>
-- 
cgit 1.4.1

