Skip to content

Commit

Permalink
Continued work
Browse files Browse the repository at this point in the history
  • Loading branch information
M-i-k-e-l committed Nov 10, 2019
1 parent 6250d76 commit bb655bc
Show file tree
Hide file tree
Showing 8 changed files with 56 additions and 51 deletions.
2 changes: 1 addition & 1 deletion ReactNativeKeyboardInput.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Pod::Spec.new do |s|
s.module_name = 'ReactNativeKeyboardInput'

s.source = { :git => "https://github.com/wix/react-native-autogrow-textinput", :tag => "#{s.version}" }
s.source_files = "./ios/**/*.{h,m}"
s.source_files = "lib/ios/**/*.{h,m}"

s.dependency 'React'
s.frameworks = 'UIKit'
Expand Down
19 changes: 12 additions & 7 deletions demo/demoScreen.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ export default class KeyboardInput extends Component {
this.setState({receivedKeyboardData});
}

onKeyboardResigned() {
this.resetKeyboardView();
}

getToolbarButtons() {
return [
{
Expand All @@ -63,10 +67,6 @@ export default class KeyboardInput extends Component {
this.setState({customKeyboard: {}});
}

onKeyboardResigned() {
this.resetKeyboardView();
}

showKeyboardView(component, title) {
this.setState({
customKeyboard: {
Expand All @@ -78,7 +78,7 @@ export default class KeyboardInput extends Component {

keyboardAccessoryViewContent() {
return (
<View style={styles.container}>
<View style={styles.keyboardContainer}>
<View style={{borderTopWidth: StyleSheet.hairlineWidth, borderColor: '#bbb'}}/>

<View style={styles.inputContainer}>
Expand All @@ -101,7 +101,12 @@ export default class KeyboardInput extends Component {
<View style={{flexDirection: 'row'}}>
{
this.getToolbarButtons().map((button, index) =>
<TouchableOpacity onPress={button.onPress} style={{paddingLeft: 15, paddingBottom: 10}} key={index} testID={button.testID}>
<TouchableOpacity
onPress={button.onPress}
style={{paddingLeft: 15, paddingBottom: 10}}
key={index}
testID={button.testID}
>
<Text>{button.text}</Text>
</TouchableOpacity>)
}
Expand Down Expand Up @@ -161,7 +166,7 @@ const styles = StyleSheet.create({
justifyContent: 'space-between',
marginBottom: 25,
},
container: {
keyboardContainer: {
...Platform.select({
ios: {
flex: 1,
Expand Down
4 changes: 2 additions & 2 deletions index.android.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import KeyboardAppScreen from './demo/demoScreen';
import DemoRootScreen from './demo/demoRoot';
import KeyboardInput from './demo/demoRoot';

import {Navigation} from 'react-native-navigation';

Navigation.registerComponent('screens.star', () => KeyboardAppScreen);
Navigation.registerComponent('screens.settings', () => DemoRootScreen);
Navigation.registerComponent('screens.settings', () => KeyboardInput);
Navigation.registerComponent('screens.innerScreen', () => KeyboardAppScreen);

Navigation.setRoot({
Expand Down
42 changes: 21 additions & 21 deletions ios/KeyboardInput.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,23 +11,23 @@
13B07FBD1A68108700A75B9A /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB11A68108700A75B9A /* LaunchScreen.xib */; };
13B07FBF1A68108700A75B9A /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB51A68108700A75B9A /* Images.xcassets */; };
13B07FC11A68108700A75B9A /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB71A68108700A75B9A /* main.m */; };
53C4780C66EBB40DB2312842 /* libPods-KeyboardInput.a in Frameworks */ = {isa = PBXBuildFile; fileRef = CC88A9944F45531433CE1C5F /* libPods-KeyboardInput.a */; };
B448D18CD0E3A5A854B4EFEA /* libPods-KeyboardInput.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 486362B1597F739CB9579E98 /* libPods-KeyboardInput.a */; };
/* End PBXBuildFile section */

/* Begin PBXFileReference section */
008F07F21AC5B25A0029DE68 /* main.jsbundle */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = main.jsbundle; sourceTree = "<group>"; };
00E356F11AD99517003FC87E /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
00E356F21AD99517003FC87E /* KeyboardInputTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = KeyboardInputTests.m; sourceTree = "<group>"; };
0FE52B025889EDA2F96D65B9 /* Pods-KeyboardInput.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-KeyboardInput.release.xcconfig"; path = "Target Support Files/Pods-KeyboardInput/Pods-KeyboardInput.release.xcconfig"; sourceTree = "<group>"; };
13B07F961A680F5B00A75B9A /* KeyboardInput.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = KeyboardInput.app; sourceTree = BUILT_PRODUCTS_DIR; };
13B07FAF1A68108700A75B9A /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AppDelegate.h; path = KeyboardInput/AppDelegate.h; sourceTree = "<group>"; };
13B07FB01A68108700A75B9A /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = AppDelegate.m; path = KeyboardInput/AppDelegate.m; sourceTree = "<group>"; };
13B07FB21A68108700A75B9A /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/LaunchScreen.xib; sourceTree = "<group>"; };
13B07FB51A68108700A75B9A /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Images.xcassets; path = KeyboardInput/Images.xcassets; sourceTree = "<group>"; };
13B07FB61A68108700A75B9A /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Info.plist; path = KeyboardInput/Info.plist; sourceTree = "<group>"; };
13B07FB71A68108700A75B9A /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = main.m; path = KeyboardInput/main.m; sourceTree = "<group>"; };
CC88A9944F45531433CE1C5F /* libPods-KeyboardInput.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-KeyboardInput.a"; sourceTree = BUILT_PRODUCTS_DIR; };
CE4235D8C87FE4F972E3E31D /* Pods-KeyboardInput.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-KeyboardInput.debug.xcconfig"; path = "Target Support Files/Pods-KeyboardInput/Pods-KeyboardInput.debug.xcconfig"; sourceTree = "<group>"; };
CEB96D8AC9F65FE1AA658D26 /* Pods-KeyboardInput.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-KeyboardInput.release.xcconfig"; path = "Target Support Files/Pods-KeyboardInput/Pods-KeyboardInput.release.xcconfig"; sourceTree = "<group>"; };
486362B1597F739CB9579E98 /* libPods-KeyboardInput.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-KeyboardInput.a"; sourceTree = BUILT_PRODUCTS_DIR; };
68B048D43CC8B1F2D00CA23B /* Pods-KeyboardInput.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-KeyboardInput.debug.xcconfig"; path = "Target Support Files/Pods-KeyboardInput/Pods-KeyboardInput.debug.xcconfig"; sourceTree = "<group>"; };
ED297162215061F000B7C4FE /* JavaScriptCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = JavaScriptCore.framework; path = System/Library/Frameworks/JavaScriptCore.framework; sourceTree = SDKROOT; };
ED2971642150620600B7C4FE /* JavaScriptCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = JavaScriptCore.framework; path = Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS12.0.sdk/System/Library/Frameworks/JavaScriptCore.framework; sourceTree = DEVELOPER_DIR; };
/* End PBXFileReference section */
Expand All @@ -37,7 +37,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
53C4780C66EBB40DB2312842 /* libPods-KeyboardInput.a in Frameworks */,
B448D18CD0E3A5A854B4EFEA /* libPods-KeyboardInput.a in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand All @@ -61,16 +61,6 @@
name = "Supporting Files";
sourceTree = "<group>";
};
08CD67E86537B03993EEC466 /* Pods */ = {
isa = PBXGroup;
children = (
CE4235D8C87FE4F972E3E31D /* Pods-KeyboardInput.debug.xcconfig */,
CEB96D8AC9F65FE1AA658D26 /* Pods-KeyboardInput.release.xcconfig */,
);
name = Pods;
path = Pods;
sourceTree = "<group>";
};
13B07FAE1A68108700A75B9A /* KeyboardInput */ = {
isa = PBXGroup;
children = (
Expand All @@ -90,11 +80,21 @@
children = (
ED297162215061F000B7C4FE /* JavaScriptCore.framework */,
ED2971642150620600B7C4FE /* JavaScriptCore.framework */,
CC88A9944F45531433CE1C5F /* libPods-KeyboardInput.a */,
486362B1597F739CB9579E98 /* libPods-KeyboardInput.a */,
);
name = Frameworks;
sourceTree = "<group>";
};
82915480058AB947730EA4D6 /* Pods */ = {
isa = PBXGroup;
children = (
68B048D43CC8B1F2D00CA23B /* Pods-KeyboardInput.debug.xcconfig */,
0FE52B025889EDA2F96D65B9 /* Pods-KeyboardInput.release.xcconfig */,
);
name = Pods;
path = Pods;
sourceTree = "<group>";
};
832341AE1AAA6A7D00B99B32 /* Libraries */ = {
isa = PBXGroup;
children = (
Expand All @@ -110,7 +110,7 @@
00E356EF1AD99517003FC87E /* KeyboardInputTests */,
83CBBA001A601CBA00E9B192 /* Products */,
2D16E6871FA4F8E400B85C8A /* Frameworks */,
08CD67E86537B03993EEC466 /* Pods */,
82915480058AB947730EA4D6 /* Pods */,
);
indentWidth = 2;
sourceTree = "<group>";
Expand All @@ -132,7 +132,7 @@
isa = PBXNativeTarget;
buildConfigurationList = 13B07F931A680F5B00A75B9A /* Build configuration list for PBXNativeTarget "KeyboardInput" */;
buildPhases = (
FB0BAED22105916219E341B1 /* [CP] Check Pods Manifest.lock */,
29D00AD4016CD200055315F7 /* [CP] Check Pods Manifest.lock */,
FD10A7F022414F080027D42C /* Start Packager */,
13B07F871A680F5B00A75B9A /* Sources */,
13B07F8C1A680F5B00A75B9A /* Frameworks */,
Expand Down Expand Up @@ -202,7 +202,7 @@
shellPath = /bin/sh;
shellScript = "export NODE_BINARY=node\n../node_modules/react-native/scripts/react-native-xcode.sh";
};
FB0BAED22105916219E341B1 /* [CP] Check Pods Manifest.lock */ = {
29D00AD4016CD200055315F7 /* [CP] Check Pods Manifest.lock */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
Expand Down Expand Up @@ -272,7 +272,7 @@
/* Begin XCBuildConfiguration section */
13B07F941A680F5B00A75B9A /* Debug */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = CE4235D8C87FE4F972E3E31D /* Pods-KeyboardInput.debug.xcconfig */;
baseConfigurationReference = 68B048D43CC8B1F2D00CA23B /* Pods-KeyboardInput.debug.xcconfig */;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CURRENT_PROJECT_VERSION = 1;
Expand All @@ -292,7 +292,7 @@
};
13B07F951A680F5B00A75B9A /* Release */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = CEB96D8AC9F65FE1AA658D26 /* Pods-KeyboardInput.release.xcconfig */;
baseConfigurationReference = 0FE52B025889EDA2F96D65B9 /* Pods-KeyboardInput.release.xcconfig */;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CURRENT_PROJECT_VERSION = 1;
Expand Down
2 changes: 1 addition & 1 deletion ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ SPEC CHECKSUMS:
React-RCTText: 21934e0a51d522abcd0a275407e80af45d6fd9ec
React-RCTVibration: 0f76400ee3cec6edb9c125da49fed279340d145a
ReactCommon: a6a294e7028ed67b926d29551aa9394fd989c24c
ReactNativeKeyboardInput: cae48fd8ae5bc017f6ee5a5f346c4ae59a838dee
ReactNativeKeyboardInput: a7e007a56d2f3c831341eec14e632ab5615f12ac
ReactNativeKeyboardTrackingView: a240a6a0dba852bb107109a7ec7e98b884055977
ReactNativeNavigation: 3fad99b3843e8840affd70577aaa30bf14b272d5
Yoga: ba3d99dbee6c15ea6bbe3783d1f0cb1ffb79af0f
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,7 @@
},
"peerDependencies": {
"react": "16.9.0",
"react-native": "0.61.4",
"prop-types": "^15.7.2"
"react-native": "0.61.4"
},
"devDependencies": {
"@babel/core": "7.7.2",
Expand All @@ -61,7 +60,8 @@
"react-test-renderer": "16.9.0",
"react-native-autogrow-textinput": "^5.0.0",
"react-native-navigation": "^3.4.0",
"metro-react-native-babel-preset": "0.56.3"
"metro-react-native-babel-preset": "0.56.3",
"prop-types": "^15.7.2"
},
"jest": {
"preset": "react-native",
Expand Down
30 changes: 15 additions & 15 deletions src/KeyboardAccessoryView.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,14 @@ export default class KeyboardAccessoryView extends Component {
}
}

onAndroidBackPressed() {
if (this.props.kbComponent) {
KeyboardUtils.dismiss();
return true;
}
return false;
}

getIOSTrackingScrollBehavior() {
let scrollBehavior = this.props.iOSScrollBehavior;
if (IsIOS && NativeModules.KeyboardTrackingViewManager && scrollBehavior === -1) {
Expand All @@ -70,6 +78,13 @@ export default class KeyboardAccessoryView extends Component {
return scrollBehavior;
}

async getNativeProps() {
if (this.trackingViewRef) {
return await this.trackingViewRef.getNativeProps();
}
return {};
}

registerForKeyboardResignedEvent() {
let eventEmitter = null;
if (IsIOS) {
Expand All @@ -95,14 +110,6 @@ export default class KeyboardAccessoryView extends Component {
}
}

onAndroidBackPressed() {
if (this.props.kbComponent) {
KeyboardUtils.dismiss();
return true;
}
return false;
}

processInitialProps() {
if (IsIOS && this.props.kbInitialProps && this.props.kbInitialProps.backgroundColor) {
const processedProps = Object.assign({}, this.props.kbInitialProps);
Expand All @@ -112,13 +119,6 @@ export default class KeyboardAccessoryView extends Component {
return this.props.kbInitialProps;
}

async getNativeProps() {
if (this.trackingViewRef) {
return await this.trackingViewRef.getNativeProps();
}
return {};
}

scrollToStart() {
if (this.trackingViewRef) {
this.trackingViewRef.scrollToStart();
Expand Down
2 changes: 1 addition & 1 deletion src/utils/KeyboardUtils.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {Keyboard, Platform,} from 'react-native';
import {Keyboard, Platform} from 'react-native';
import TextInputKeyboardMangerIOS from '../TextInputKeyboardMangerIOS';
import TextInputKeyboardManagerAndroid from '../TextInputKeyboardManagerAndroid';

Expand Down

0 comments on commit bb655bc

Please sign in to comment.