$ npm install react-native-allmax-keyboard --save
$ react-native link react-native-allmax-keyboard
- In XCode, in the project navigator, right click
Libraries➜Add Files to [your project's name] - Go to
node_modules➜react-native-allmax-keyboardand addRNAllmaxKeyboard.xcodeproj - In XCode, in the project navigator, select your project. Add
libRNAllmaxKeyboard.ato your project'sBuild Phases➜Link Binary With Libraries - Run your project (
Cmd+R)<
- Open up
android/app/src/main/java/[...]/MainActivity.java
- Add
import com.reactlibrary.RNAllmaxKeyboardPackage;to the imports at the top of the file - Add
new RNAllmaxKeyboardPackage()to the list returned by thegetPackages()method
- Append the following lines to
android/settings.gradle:include ':react-native-allmax-keyboard' project(':react-native-allmax-keyboard').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-allmax-keyboard/android') - Insert the following lines inside the dependencies block in
android/app/build.gradle:compile project(':react-native-allmax-keyboard')
import { TextField, setHeight } from 'react-native-allmax-keyboard';
...
<TextField
ref={(ref) => {
this.scoutInput = ref;
}}
onSuccessInstall={() => {
this.setState({ androidPreloader: false });
}}
keyboardHeight={keyboardHeight}
mountInterval={80}
customKeyboardType={'NumPad'}
placeholder="Barcode"
returnKeyType="done"
selectionColor={'rgba(0, 0, 0, .5)'}
spellCheck={false}
onSubmitEditing={() => {
setHeight(findNodeHandle(this.scoutInput.textInputRef()), 0);
if (isFetched !== 1) {
return fetchByBarcode();
} else if (isFetched === 1) {
return setBarcode('');
}
return null;
}}
onChangeText={(newBarcode) => {
setBarcode(newBarcode);
}}
value={newBarcode}
style={styles.scan_textInput}
touchOnFocus={() => {
if (keyboardHeight === 0 && !this.state.androidPreloader) {
setKeyboardHeight(this.keyboardHeight);
}
}}
onChangeKeyboardHeight={(height) => {
if (keyboardHeight !== height) {
setKeyboardHeight(height);
}
}}
underlineColorAndroid="transparent"
blurOnSubmit={!externalScanner}
dismissKeyboardAction={setKeyboardHeight}
/>
...touchOnFocus: () => {}, // Input is touched
onSuccessInstall: () => {}, // Callback when keyboard is mounted
mountInterval: 80, // Interval to mount keyboard, only for iOS
keyboardHeight: 0, // Keyboard height, default is 0
registerKeyboard, // Register in root container
TextField, // TextInput
backSpace, // Delete action
insertText, // Insert action
done, // Done action
clear, // Clear all nodes, only for Android
installKeyboard, // Don't use it
switchSystemKeyboard, // Switch to system keyboard action
setHeight // Set keyboard height