rajsuvariya / autocompletetextview

2 stars 5 forks source link

roots not found #3

Closed Noitidart closed 6 years ago

Noitidart commented 6 years ago

Hi there,

I'm not sure how to get this to work. I did npm i rajsuvariya/autocompletetextview so it install from Github instead of npm, as i saw the warning in the readme.

I then did react-native link autocompletetextview however when I do react-native run-android I get this error:

:autocompletetextview:mergeReleaseResources
:autocompletetextview:bundleReleaseJsAndAssets
Scanning 36 folders for symlinks in C:\Users\x1\Documents\GitHub\autocomp\node_modules\autocompletetextview\node_modules (0ms)
                                                                                                                 Scanning 36 folders for symlinks in C:\Users\x1\Documents\GitHub\autocomp\node_modules\autocompletetextview\node_modules (0ms)
Loading dependency graph, done.

Cannot find entry file index.android.js in any of the roots: ["C:\\Users\\x1\\Documents\\GitHub\\autocomp\\node_modules\\autocompletetextview"]

:autocompletetextview:bundleReleaseJsAndAssets FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':autocompletetextview:bundleReleaseJsAndAssets'.

May you please advise, I have been long lookig for this module and so have others:

https://www.reddit.com/r/reactnative/comments/76ztf5/android_native_autocompletetextview_on_rn/

I have no java experience, I'm just a javascrpt guy. May you please elaborate on how to copy the files as you suggested in the readme?

Noitidart commented 6 years ago

May you please elaborate on how to copy the files as you suggested in the readme. I can't figure out how to copy the files correctly :(

rajsuvariya commented 6 years ago

Step 1: go to autocompletetextview/android/app/src/main/java/com/autocompletetextview/ and copy all three files and paste it inside /android/app/src/main/java/com//

Step 2: go to MyReactActivity.java in your project and add this .addPackage(new AutoCompleteTextViewPackager()) like below

        mReactRootView = new ReactRootView(this);
        mReactInstanceManager = ReactInstanceManager.builder()
                .setApplication(getApplication())
                .setBundleAssetName("index.android.bundle")
                .setJSMainModuleName("index.android")
                .addPackage(new MainReactPackage())
                .addPackage(new AutoCompleteTextViewPackager())
                .setUseDeveloperSupport(BuildConfig.DEBUG)
                .setInitialLifecycleState(LifecycleState.RESUMED)
                .build();

Step 3: now copy src/AutoCompleteTextView.js in your project and that should be it.

Let me know in case of any issues

Noitidart commented 6 years ago

Thank you sir very much! Will test now! Especially for asking for me to share how it goes! Much appreciated sir will let you know.

Noitidart commented 6 years ago

Hi @rajsuvariya - the copying was a bit different for latest RN, im submitting a PR for it right now.

I got it imported succesfully but I'm not able to figure out how to use the component. When I do the following:

import React, { Component } from 'react';
import { Text, View } from 'react-native';

import AutoCompleteTextView from './AutoCompleteTextView'

export default class App extends Component {
  state = {
    value: ''
  }
  render() {
    const { value } = this.state;

    return (
      <View style={{ flex:1, justifyContent:'center', alignItems:'center'}}>
        <AutoCompleteTextView dataSource={['cat', 'dog', 'tiger']} value={value} onTextChange={this.handleTextChange} />
      </View>
    );
  }

  handleTextChange = value => console.log('value:', value);
}

I get red box error of:

"Error while updating property 'value' of a view managed by: RCTAutoCompleteTextView

null

android.support.v7.internal.widget.TintContextWrapper cannot be cast to com.facebook.react.bridge.ReactContext
Noitidart commented 6 years ago

I totally failed. I tried again at fixing this all up. I gave up for now and posted asking for help - https://www.reddit.com/r/reactnative/comments/82wobr/help_complete_native_android_autocompletetextview/

rajsuvariya commented 6 years ago

I understand your situation. If you are able to use it via copy paste method then leave the fixing part of this repo. As already stated I am not getting time from my usual routine to fix this repo. Once I will get some free time I will look into this repo on priority.

Noitidart commented 6 years ago

Oh wow does this repo work if copy pasted? That would be so awesome. I'm in dire need of this. Would you be available to take a screen record of copying? Or I am comfortable with teamviewer remote session if you are, you can connect to me, if you are ok with it?

rajsuvariya commented 6 years ago

Hi @Noitidart check out this branch. https://github.com/rajsuvariya/autocompletetextview/tree/development

I have solved almost all the issues. Follow the installation guide and let me know in case of any issues.

Noitidart commented 6 years ago

No way!!! Thank you sir! Trying right away!

rajsuvariya commented 6 years ago

This is fixed now so I am closing it