wix-incubator / react-native-keyboard-input

Use your own custom input component instead of the system keyboard
MIT License
818 stars 150 forks source link

Auto Linking #101

Closed schie closed 4 years ago

schie commented 4 years ago

Does this work react native's Auto Linking?

I didn't see anything in the documentation but manual installation.

ggunti commented 4 years ago

@schie Autolinking is not working. If you want to make it work on android with RN 0.60+:

  1. Update your dependencies in android/app/build.gradle:
    dependencies {
    // Add this dependency:
    compile project(":reactnativekeyboardinput")
    }
  2. Update your android/settings.gradle:
    include ':reactnativekeyboardinput'
    project(':reactnativekeyboardinput').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-keyboard-input/lib/android')
  3. In your MainApplication.java, add:
    import com.wix.reactnativekeyboardinput.KeyboardInputPackage;
  4. In your MainApplication.java, add to the following function:
    private MainApplication getThis() {
    return this;
    }
  5. In your MainApplication.java, inside getPackages() add:
    packages.add(new KeyboardInputPackage(getThis()));

See my MainApplication.java example:

Captură de ecran din 2020-04-06 la 12 13 27

I did not find a solution to make it work on iOS with RN 0.60+. Manual linking from README doesn't work for RN 0.60+.

EDIT: You can simply just skip STEP 4 and at STEP 5 just use packages.add(new KeyboardInputPackage(this.getApplication())); instead packages.add(new KeyboardInputPackage(getThis()));

M-i-k-e-l commented 4 years ago

Hi @schie,

We are in the process of migrating this library, it is not yet complete, but the auto linking works there.

Thanks @ggunti for the help, we're not going to fix this here, sorry.

react06 commented 1 year ago

@ggunti my issue is as I import the KeyboardInputPackage, it says the package does not exist even after syncing the project with the Gradle files. Any solutions regarding this will be appreciated. Thank you.