Skip to content

Commit bbfef6e

Browse files
committed
Update IQKeyboardManager to 7.0.2
1 parent 8b13527 commit bbfef6e

32 files changed

+6548
-6315
lines changed

.eslintrc.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
module.exports = {
22
root: true,
3-
extends: '@react-native-community',
3+
extends: '@react-native',
44
};

ReactNativeKeyboardManager.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Pod::Spec.new do |s|
1414
s.license = packageJson["license"]
1515
s.authors = packageJson["author"]
1616
s.source = { :git => repository, :tag => version }
17-
s.platform = :ios, "9.0"
17+
s.platform = :ios, "13.0"
1818
s.preserve_paths = 'README.md', 'package.json', '*.js'
1919
s.source_files = 'ios/ReactNativeKeyboardManager/**/*.{h,m}'
2020

Sample/.buckconfig

Lines changed: 0 additions & 6 deletions
This file was deleted.

Sample/.eslintrc.js

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,4 @@
11
module.exports = {
22
root: true,
3-
extends: '@react-native-community',
4-
parser: '@typescript-eslint/parser',
5-
plugins: ['@typescript-eslint'],
6-
overrides: [
7-
{
8-
files: ['*.ts', '*.tsx'],
9-
rules: {
10-
'@typescript-eslint/no-shadow': ['error'],
11-
'no-shadow': 'off',
12-
'no-undef': 'off',
13-
},
14-
},
15-
],
3+
extends: '@react-native',
164
};

Sample/.gitignore

Lines changed: 23 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ DerivedData
2020
*.hmap
2121
*.ipa
2222
*.xcuserstate
23+
**/.xcode.env.local
2324

2425
# Android/IntelliJ
2526
#
@@ -29,33 +30,45 @@ build/
2930
local.properties
3031
*.iml
3132
*.hprof
33+
.cxx/
34+
*.keystore
35+
!debug.keystore
3236

3337
# node.js
3438
#
3539
node_modules/
3640
npm-debug.log
3741
yarn-error.log
3842

39-
# BUCK
40-
buck-out/
41-
\.buckd/
42-
*.keystore
43-
!debug.keystore
44-
4543
# fastlane
4644
#
4745
# It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the
4846
# screenshots whenever they are needed.
4947
# For more information about the recommended setup visit:
5048
# https://docs.fastlane.tools/best-practices/source-control/
5149

52-
*/fastlane/report.xml
53-
*/fastlane/Preview.html
54-
*/fastlane/screenshots
50+
**/fastlane/report.xml
51+
**/fastlane/Preview.html
52+
**/fastlane/screenshots
53+
**/fastlane/test_output
5554

5655
# Bundle artifact
5756
*.jsbundle
5857

5958
# Ruby / CocoaPods
60-
/ios/Pods/
59+
**/Pods/
6160
/vendor/bundle/
61+
62+
# Temporary files created by Metro to check the health of the file watcher
63+
.metro-health-check*
64+
65+
# testing
66+
/coverage
67+
68+
# Yarn
69+
.yarn/*
70+
!.yarn/patches
71+
!.yarn/plugins
72+
!.yarn/releases
73+
!.yarn/sdks
74+
!.yarn/versions

Sample/.watchmanconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{}
1+
{}

Sample/App.tsx

Lines changed: 62 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ import {
3232
Modal,
3333
SafeAreaView,
3434
Platform,
35+
Keyboard,
36+
Button,
3537
} from 'react-native';
3638

3739
import KeyboardManager, {PreviousNextView} from 'react-native-keyboard-manager';
@@ -43,14 +45,14 @@ if (Platform.OS === 'ios') {
4345
KeyboardManager.setLayoutIfNeededOnUpdate(true);
4446
KeyboardManager.setEnableAutoToolbar(true);
4547
KeyboardManager.setToolbarDoneBarButtonItemText('Done');
46-
KeyboardManager.setToolbarManageBehaviourBy('subviews'); // "subviews" | "tag" | "position"
48+
KeyboardManager.setToolbarManageBehavior('subviews'); // "subviews" | "tag" | "position"
4749
KeyboardManager.setToolbarPreviousNextButtonEnable(true);
4850
KeyboardManager.setToolbarTintColor('#FF00FF'); // Only #000000 format is supported
4951
KeyboardManager.setToolbarBarTintColor('#FFFF00'); // Only #000000 format is supported
50-
KeyboardManager.setShouldShowToolbarPlaceholder(true);
51-
KeyboardManager.setOverrideKeyboardAppearance(false);
52+
KeyboardManager.setToolbarShowPlaceholder(true);
53+
KeyboardManager.setKeyboardOverrideAppearance(false);
5254
KeyboardManager.setKeyboardAppearance('default'); // "default" | "light" | "dark"
53-
KeyboardManager.setShouldResignOnTouchOutside(true);
55+
KeyboardManager.setResignOnTouchOutside(true);
5456
KeyboardManager.setShouldPlayInputClicks(true);
5557
}
5658

@@ -68,6 +70,7 @@ const INPUT_KEYS = [
6870
];
6971

7072
type StateType = {
73+
modalVisible?: boolean;
7174
enableDisable?: boolean;
7275
inputsValues: {
7376
[key: string]: string;
@@ -79,6 +82,7 @@ class App extends Component<any, StateType> {
7982
super(props);
8083

8184
this.state = {
85+
modalVisible: false,
8286
enableDisable: true,
8387
inputsValues: {},
8488
};
@@ -89,18 +93,28 @@ class App extends Component<any, StateType> {
8993
}
9094

9195
componentDidUpdate() {
92-
KeyboardManager.isKeyboardShowing().then(isShowing => {
93-
console.log('isKeyboardShowing: ' + isShowing);
94-
});
96+
console.log('isKeyboardShowing: ' + Keyboard.isVisible());
9597
}
9698

97-
onEnableDisable = (value: boolean) => {
99+
handleEnableDisable = (value: boolean) => {
98100
KeyboardManager.setEnable(value);
99101
this.setState({
100102
enableDisable: value,
101103
});
102104
};
103105

106+
handleShowModal = () => {
107+
this.setState({
108+
modalVisible: true,
109+
});
110+
};
111+
112+
handleCloseModal = () => {
113+
this.setState({
114+
modalVisible: false,
115+
});
116+
};
117+
104118
getRef<T>(key: string) {
105119
// eslint-disable-next-line react/no-string-refs
106120
return this.refs[key] as T;
@@ -156,39 +170,50 @@ class App extends Component<any, StateType> {
156170
);
157171
};
158172

173+
renderContent = () => {
174+
return (
175+
<ScrollView>
176+
<View style={{alignItems: 'center'}}>
177+
<Text style={{marginTop: 10, textAlign: 'center'}}>
178+
React-Native Keyboard Manager
179+
</Text>
180+
<View
181+
style={{
182+
marginTop: 10,
183+
flexDirection: 'row',
184+
alignItems: 'center',
185+
}}>
186+
<Text>Enable/Disable </Text>
187+
<Switch
188+
onValueChange={this.handleEnableDisable}
189+
value={this.state.enableDisable}
190+
/>
191+
</View>
192+
</View>
193+
194+
<View>{INPUT_KEYS.map(this.renderInput)}</View>
195+
</ScrollView>
196+
);
197+
};
198+
159199
render() {
160200
return (
161201
<View style={{flex: 1}}>
162202
<SafeAreaView style={{flex: 1}}>
163-
{/* To try with Modal, uncomment the two following lines. */}
164-
{/* <Modal visible={true}> */}
165-
{/* <PreviousNextView style={{flex: 1}}> */}
166-
167-
{/* ScrollView is not required, but may be needed in some cases. */}
168-
<ScrollView>
169-
<View style={{alignItems: 'center'}}>
170-
<Text style={{marginTop: 10, textAlign: 'center'}}>
171-
React-Native Keyboard Manager
172-
</Text>
173-
<View
174-
style={{
175-
marginTop: 10,
176-
flexDirection: 'row',
177-
alignItems: 'center',
178-
}}>
179-
<Text>Enable/Disable </Text>
180-
<Switch
181-
onValueChange={this.onEnableDisable}
182-
value={this.state.enableDisable}
183-
/>
184-
</View>
185-
</View>
186-
187-
<View>{INPUT_KEYS.map(this.renderInput)}</View>
188-
</ScrollView>
189-
190-
{/* </PreviousNextView> */}
191-
{/* </Modal> */}
203+
<Button onPress={this.handleShowModal} title="Show in modal" />
204+
{this.renderContent()}
205+
206+
<Modal
207+
onRequestClose={this.handleCloseModal}
208+
visible={this.state.modalVisible}>
209+
<SafeAreaView style={{flex: 1, backgroundColor: '#e1e1e1'}}>
210+
<Button onPress={this.handleCloseModal} title="Close modal" />
211+
{/* Inside a native modal the inputs need to be wrapped inside PreviousNextView */}
212+
<PreviousNextView style={{flex: 1}}>
213+
{this.renderContent()}
214+
</PreviousNextView>
215+
</SafeAreaView>
216+
</Modal>
192217
</SafeAreaView>
193218
</View>
194219
);

Sample/README.md

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
This is a new [**React Native**](https://reactnative.dev) project, bootstrapped using [`@react-native-community/cli`](https://github.com/react-native-community/cli).
2+
3+
# Getting Started
4+
5+
>**Note**: Make sure you have completed the [React Native - Environment Setup](https://reactnative.dev/docs/environment-setup) instructions till "Creating a new application" step, before proceeding.
6+
7+
## Step 1: Start the Metro Server
8+
9+
First, you will need to start **Metro**, the JavaScript _bundler_ that ships _with_ React Native.
10+
11+
To start Metro, run the following command from the _root_ of your React Native project:
12+
13+
```bash
14+
# using npm
15+
npm start
16+
17+
# OR using Yarn
18+
yarn start
19+
```
20+
21+
## Step 2: Start your Application
22+
23+
Let Metro Bundler run in its _own_ terminal. Open a _new_ terminal from the _root_ of your React Native project. Run the following command to start your _Android_ or _iOS_ app:
24+
25+
### For Android
26+
27+
```bash
28+
# using npm
29+
npm run android
30+
31+
# OR using Yarn
32+
yarn android
33+
```
34+
35+
### For iOS
36+
37+
```bash
38+
# using npm
39+
npm run ios
40+
41+
# OR using Yarn
42+
yarn ios
43+
```
44+
45+
If everything is set up _correctly_, you should see your new app running in your _Android Emulator_ or _iOS Simulator_ shortly provided you have set up your emulator/simulator correctly.
46+
47+
This is one way to run your app — you can also run it directly from within Android Studio and Xcode respectively.
48+
49+
## Step 3: Modifying your App
50+
51+
Now that you have successfully run the app, let's modify it.
52+
53+
1. Open `App.tsx` in your text editor of choice and edit some lines.
54+
2. For **Android**: Press the <kbd>R</kbd> key twice or select **"Reload"** from the **Developer Menu** (<kbd>Ctrl</kbd> + <kbd>M</kbd> (on Window and Linux) or <kbd>Cmd ⌘</kbd> + <kbd>M</kbd> (on macOS)) to see your changes!
55+
56+
For **iOS**: Hit <kbd>Cmd ⌘</kbd> + <kbd>R</kbd> in your iOS Simulator to reload the app and see your changes!
57+
58+
## Congratulations! :tada:
59+
60+
You've successfully run and modified your React Native App. :partying_face:
61+
62+
### Now what?
63+
64+
- If you want to add this new React Native code to an existing application, check out the [Integration guide](https://reactnative.dev/docs/integration-with-existing-apps).
65+
- If you're curious to learn more about React Native, check out the [Introduction to React Native](https://reactnative.dev/docs/getting-started).
66+
67+
# Troubleshooting
68+
69+
If you can't get this to work, see the [Troubleshooting](https://reactnative.dev/docs/troubleshooting) page.
70+
71+
# Learn More
72+
73+
To learn more about React Native, take a look at the following resources:
74+
75+
- [React Native Website](https://reactnative.dev) - learn more about React Native.
76+
- [Getting Started](https://reactnative.dev/docs/environment-setup) - an **overview** of React Native and how setup your environment.
77+
- [Learn the Basics](https://reactnative.dev/docs/getting-started) - a **guided tour** of the React Native **basics**.
78+
- [Blog](https://reactnative.dev/blog) - read the latest official React Native **Blog** posts.
79+
- [`@facebook/react-native`](https://github.com/facebook/react-native) - the Open Source; GitHub **repository** for React Native.

Sample/__tests__/App-test.tsx renamed to Sample/__tests__/App.test.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ import 'react-native';
66
import React from 'react';
77
import App from '../App';
88

9+
// Note: import explicitly to use the types shipped with jest.
10+
import {it} from '@jest/globals';
11+
912
// Note: test renderer must be required after react-native.
1013
import renderer from 'react-test-renderer';
1114

Sample/app.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
22
"name": "ReactNativeKeyboardManagerSample",
33
"displayName": "ReactNativeKeyboardManagerSample"
4-
}
4+
}

0 commit comments

Comments
 (0)