diff --git a/.eslintrc.js b/.eslintrc.js index 40c6dcd..187894b 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -1,4 +1,4 @@ module.exports = { root: true, - extends: '@react-native-community', + extends: '@react-native', }; diff --git a/ReactNativeKeyboardManager.podspec b/ReactNativeKeyboardManager.podspec index 4fbdeff..e9251c1 100644 --- a/ReactNativeKeyboardManager.podspec +++ b/ReactNativeKeyboardManager.podspec @@ -14,7 +14,7 @@ Pod::Spec.new do |s| s.license = packageJson["license"] s.authors = packageJson["author"] s.source = { :git => repository, :tag => version } - s.platform = :ios, "9.0" + s.platform = :ios, "13.0" s.preserve_paths = 'README.md', 'package.json', '*.js' s.source_files = 'ios/ReactNativeKeyboardManager/**/*.{h,m}' diff --git a/Sample/.buckconfig b/Sample/.buckconfig deleted file mode 100644 index 934256c..0000000 --- a/Sample/.buckconfig +++ /dev/null @@ -1,6 +0,0 @@ - -[android] - target = Google Inc.:Google APIs:23 - -[maven_repositories] - central = https://repo1.maven.org/maven2 diff --git a/Sample/.eslintrc.js b/Sample/.eslintrc.js index dcf0be0..187894b 100644 --- a/Sample/.eslintrc.js +++ b/Sample/.eslintrc.js @@ -1,16 +1,4 @@ module.exports = { root: true, - extends: '@react-native-community', - parser: '@typescript-eslint/parser', - plugins: ['@typescript-eslint'], - overrides: [ - { - files: ['*.ts', '*.tsx'], - rules: { - '@typescript-eslint/no-shadow': ['error'], - 'no-shadow': 'off', - 'no-undef': 'off', - }, - }, - ], + extends: '@react-native', }; diff --git a/Sample/.gitignore b/Sample/.gitignore index 81570d9..d5ae456 100644 --- a/Sample/.gitignore +++ b/Sample/.gitignore @@ -20,6 +20,7 @@ DerivedData *.hmap *.ipa *.xcuserstate +**/.xcode.env.local # Android/IntelliJ # @@ -29,6 +30,9 @@ build/ local.properties *.iml *.hprof +.cxx/ +*.keystore +!debug.keystore # node.js # @@ -36,12 +40,6 @@ node_modules/ npm-debug.log yarn-error.log -# BUCK -buck-out/ -\.buckd/ -*.keystore -!debug.keystore - # fastlane # # It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the @@ -49,13 +47,28 @@ buck-out/ # For more information about the recommended setup visit: # https://docs.fastlane.tools/best-practices/source-control/ -*/fastlane/report.xml -*/fastlane/Preview.html -*/fastlane/screenshots +**/fastlane/report.xml +**/fastlane/Preview.html +**/fastlane/screenshots +**/fastlane/test_output # Bundle artifact *.jsbundle # Ruby / CocoaPods -/ios/Pods/ +**/Pods/ /vendor/bundle/ + +# Temporary files created by Metro to check the health of the file watcher +.metro-health-check* + +# testing +/coverage + +# Yarn +.yarn/* +!.yarn/patches +!.yarn/plugins +!.yarn/releases +!.yarn/sdks +!.yarn/versions diff --git a/Sample/.watchmanconfig b/Sample/.watchmanconfig index 9e26dfe..0967ef4 100644 --- a/Sample/.watchmanconfig +++ b/Sample/.watchmanconfig @@ -1 +1 @@ -{} \ No newline at end of file +{} diff --git a/Sample/App.tsx b/Sample/App.tsx index afabc6f..4a6ea78 100644 --- a/Sample/App.tsx +++ b/Sample/App.tsx @@ -32,6 +32,8 @@ import { Modal, SafeAreaView, Platform, + Keyboard, + Button, } from 'react-native'; import KeyboardManager, {PreviousNextView} from 'react-native-keyboard-manager'; @@ -43,14 +45,14 @@ if (Platform.OS === 'ios') { KeyboardManager.setLayoutIfNeededOnUpdate(true); KeyboardManager.setEnableAutoToolbar(true); KeyboardManager.setToolbarDoneBarButtonItemText('Done'); - KeyboardManager.setToolbarManageBehaviourBy('subviews'); // "subviews" | "tag" | "position" + KeyboardManager.setToolbarManageBehavior('subviews'); // "subviews" | "tag" | "position" KeyboardManager.setToolbarPreviousNextButtonEnable(true); KeyboardManager.setToolbarTintColor('#FF00FF'); // Only #000000 format is supported KeyboardManager.setToolbarBarTintColor('#FFFF00'); // Only #000000 format is supported - KeyboardManager.setShouldShowToolbarPlaceholder(true); - KeyboardManager.setOverrideKeyboardAppearance(false); + KeyboardManager.setToolbarShowPlaceholder(true); + KeyboardManager.setKeyboardOverrideAppearance(false); KeyboardManager.setKeyboardAppearance('default'); // "default" | "light" | "dark" - KeyboardManager.setShouldResignOnTouchOutside(true); + KeyboardManager.setResignOnTouchOutside(true); KeyboardManager.setShouldPlayInputClicks(true); } @@ -68,6 +70,7 @@ const INPUT_KEYS = [ ]; type StateType = { + modalVisible?: boolean; enableDisable?: boolean; inputsValues: { [key: string]: string; @@ -79,6 +82,7 @@ class App extends Component { super(props); this.state = { + modalVisible: false, enableDisable: true, inputsValues: {}, }; @@ -89,18 +93,28 @@ class App extends Component { } componentDidUpdate() { - KeyboardManager.isKeyboardShowing().then(isShowing => { - console.log('isKeyboardShowing: ' + isShowing); - }); + console.log('isKeyboardShowing: ' + Keyboard.isVisible()); } - onEnableDisable = (value: boolean) => { + handleEnableDisable = (value: boolean) => { KeyboardManager.setEnable(value); this.setState({ enableDisable: value, }); }; + handleShowModal = () => { + this.setState({ + modalVisible: true, + }); + }; + + handleCloseModal = () => { + this.setState({ + modalVisible: false, + }); + }; + getRef(key: string) { // eslint-disable-next-line react/no-string-refs return this.refs[key] as T; @@ -156,39 +170,50 @@ class App extends Component { ); }; + renderContent = () => { + return ( + + + + React-Native Keyboard Manager + + + Enable/Disable + + + + + {INPUT_KEYS.map(this.renderInput)} + + ); + }; + render() { return ( - {/* To try with Modal, uncomment the two following lines. */} - {/* */} - {/* */} - - {/* ScrollView is not required, but may be needed in some cases. */} - - - - React-Native Keyboard Manager - - - Enable/Disable - - - - - {INPUT_KEYS.map(this.renderInput)} - - - {/* */} - {/* */} +