Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: null is not an object (evaluating 'CustomKeyboardKit.install') #18

Open
samgermain opened this issue Apr 11, 2020 · 5 comments

Comments

@samgermain
Copy link

samgermain commented Apr 11, 2020

This happens when I use the example verbatim on Android.

import React, {Component} from 'react';
import {
  Platform,
  StyleSheet,
  Text,
  View,
  NativeModules,
  TouchableOpacity,
  Keyboard,
} from 'react-native';

import { 
  CustomTextInput,
  register,
  insertText,
  backSpace,
  uninstall,
  hideKeyboard,
} from 'react-native-custom-keyboard-kit';

class MyKeyboard extends Component {
  onPress1 = () => {
    insertText(this.props.tag, '1');
  }

  onPress2 = () => {
    insertText(this.props.tag, '2');
  }

  onPress3 = () => {
    insertText(this.props.tag, '3');
  }
  
  onPress4 = () => {
    insertText(this.props.tag, '4');
  }

  onPress5 = () => {
    insertText(this.props.tag, '5');
  }
  
  onPress6 = () => {
    insertText(this.props.tag, '6');
  }

  onPress7 = () => {
    insertText(this.props.tag, '7');
  }

  onPress8 = () => {
    insertText(this.props.tag, '8');
  }

  onPress9 = () => {
    insertText(this.props.tag, '9');
  }
  
  onPressBackSpace = () => {
    backSpace(this.props.tag);
  }
  
  onPress0= () => {
    insertText(this.props.tag, '0');
  }
  
  onPressHideKeyboard = () => {
    hideKeyboard(this.props.tag);
  }

  render() {
    return (
      <View>
        <View style={{flexDirection: "row"}}>
          <View style={styles.button}>
            <TouchableOpacity onPress={this.onPress1}>
              <Text style={styles.buttonLabel}>
                1
              </Text>
            </TouchableOpacity>
          </View>
          <View style={styles.button}>
            <TouchableOpacity onPress={this.onPress2}>
              <Text style={styles.buttonLabel}>
                2
              </Text>
            </TouchableOpacity>
          </View>
          <View style={styles.button}>
            <TouchableOpacity onPress={this.onPress3}>
              <Text style={styles.buttonLabel}>
                3
              </Text>
            </TouchableOpacity>
          </View>
        </View>
        <View style={{flexDirection: "row"}}>
          <View style={styles.button}>
            <TouchableOpacity onPress={this.onPress4}>
              <Text style={styles.buttonLabel}>
                4
              </Text>
            </TouchableOpacity>
          </View>
          <View style={styles.button}>
            <TouchableOpacity onPress={this.onPress5}>
              <Text style={styles.buttonLabel}>
                5
              </Text>
            </TouchableOpacity>
          </View>
          <View style={styles.button}>
            <TouchableOpacity onPress={this.onPress6}>
              <Text style={styles.buttonLabel}>
                6
              </Text>
            </TouchableOpacity>
          </View>
        </View>
        <View style={{flexDirection: "row"}}>
          <View style={styles.button}>
            <TouchableOpacity onPress={this.onPress7}>
              <Text style={styles.buttonLabel}>
                7
              </Text>
            </TouchableOpacity>
          </View>
          <View style={styles.button}>
            <TouchableOpacity onPress={this.onPress8}>
              <Text style={styles.buttonLabel}>
                8
              </Text>
            </TouchableOpacity>
          </View>
          <View style={styles.button}>
            <TouchableOpacity onPress={this.onPress9}>
              <Text style={styles.buttonLabel}>
                9
              </Text>
            </TouchableOpacity>
          </View>
        </View>
        <View style={{flexDirection: "row"}}>
          <View style={styles.button}>
            <TouchableOpacity onPress={this.onPressBackSpace}>
              <Text style={styles.buttonLabel}>
                &larr;
              </Text>
            </TouchableOpacity>
          </View>
          <View style={styles.button}>
            <TouchableOpacity onPress={this.onPress0}>
              <Text style={styles.buttonLabel}>
                0
              </Text>
            </TouchableOpacity>
          </View>
          <View style={styles.button}>
            <TouchableOpacity onPress={this.onPressHideKeyboard}>
              <Text style={styles.buttonLabel}>
                &crarr;
              </Text>
            </TouchableOpacity>
          </View>
        </View>
      </View>
    );
  }
}

register('price', () => MyKeyboard);

type Props = {};
export default class App extends Component<Props> {
  state = {
    value: ''
  }

  onChangeText = text => {
    this.setState({value: text});
  }

  render() {
    return (
      <View style={styles.container}>
        <CustomTextInput
          customKeyboardType="price"
          value={this.state.value}
          onChangeText={this.onChangeText}
          style={styles.input}
        />
      </View>
    );
  }
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    justifyContent: 'center',
    alignItems: 'center',
    backgroundColor: '#F5FCFF',
  },
  input: {
    backgroundColor: "#ffffff",
    borderWidth: 1,
    borderColor: "grey",
    width: 270,
    fontSize: 19,
  },
  buttonLabel: {
    borderWidth: 0.5,
    borderColor: "#d6d7da",
    padding: 10,
    textAlign: "center",
    justifyContent: 'center',
    alignItems: 'center',
    paddingTop: 13,
    paddingBottom: 13,
    fontSize: 20,
  },
  button: {
    width: "33.333333333%",
  },
});
@kennedy0527
Copy link

I'm also facing this issue with RN 0.62

@samgermain Do you have any solution for that?

@fliip92
Copy link
Contributor

fliip92 commented Jun 10, 2020

@kennedy0527 @samgermain I created a fork and fixed some issues. works on android. still not seeing the keyboard on ios

@452MJ
Copy link

452MJ commented Nov 24, 2020

I fix this problem. Follow the steps

Step 1

Copy RNCustomKeyboardKit.h and RNCustomKeyboardKit.m from ../node_modules/react-native-custom-keyboard-kit/ios, then paste to YOUR_RN_PROJECT/ios/IOS_PROJECT/

Step 2

In XCode, in the project navigator, right click YOUR_PROJECT ➜ Add Files to [your project's name]
Go to YOUR_RN_PROJECT/ios/IOS_PROJECT/and add RNCustomKeyboardKit.h and RNCustomKeyboardKit.m

Step 3

Modify YOUR_RN_PROJECT/ios/IOS_PROJECT/RNCustomKeyboardKit.m

- #import "RCTBridge+Private.h"
- #import "RCTUIManager.h"
+ #import "React/RCTBridge.h"
+ #import "React/RCTUIManager.h"

@tudiantuan
Copy link

tudiantuan commented Nov 26, 2020

I fix this problem. Follow the steps

Step 1

Copy RNCustomKeyboardKit.h and RNCustomKeyboardKit.m from ../node_modules/react-native-custom-keyboard-kit/ios, then paste to YOUR_RN_PROJECT/ios/IOS_PROJECT/

Step 2

In XCode, in the project navigator, right click YOUR_PROJECT ➜ Add Files to [your project's name]
Go to YOUR_RN_PROJECT/ios/IOS_PROJECT/and add RNCustomKeyboardKit.h and RNCustomKeyboardKit.m

Step 3

Modify YOUR_RN_PROJECT/ios/IOS_PROJECT/RNCustomKeyboardKit.m

- #import "RCTBridge+Private.h"
- #import "RCTUIManager.h"
+ #import "React/RCTBridge.h"
+ #import "React/RCTUIManager.h"

I do 3 step but compile failed. what is your project RN version ?

@452MJ
Copy link

452MJ commented Nov 30, 2020

I fix this problem. Follow the steps

Step 1

Copy RNCustomKeyboardKit.h and RNCustomKeyboardKit.m from ../node_modules/react-native-custom-keyboard-kit/ios, then paste to YOUR_RN_PROJECT/ios/IOS_PROJECT/

Step 2

In XCode, in the project navigator, right click YOUR_PROJECT ➜ Add Files to [your project's name]
Go to YOUR_RN_PROJECT/ios/IOS_PROJECT/and add RNCustomKeyboardKit.h and RNCustomKeyboardKit.m

Step 3

Modify YOUR_RN_PROJECT/ios/IOS_PROJECT/RNCustomKeyboardKit.m

- #import "RCTBridge+Private.h"
- #import "RCTUIManager.h"
+ #import "React/RCTBridge.h"
+ #import "React/RCTUIManager.h"

I do 3 step but compile failed. what is your project RN version ?

0.63.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants