beefe / react-native-picker

A Native Picker with high performance.
1.75k stars 784 forks source link

undefined is not an object (evaluating '_reactNativePicker.Picker.init') #340

Open yuensunn opened 6 years ago

yuensunn commented 6 years ago

Im currently on "react-native": "0.57.0", "react-native-picker": "^4.3.7". The error still exists even when I have added these codes

  1. MainApplication.java

    import com.beefe.picker.PickerViewPackage;
    ....
    protected List<ReactPackage> getPackages() {
    return Arrays.<ReactPackage>asList(
       new PickerViewPackage()
       ....
    }
  2. settings.gradle

    include :'react-native-picker'
    project(':react-native-picker').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-picker/android')
  3. app/build.gradle

    dependencies {  
    implementation project(':react-native-picker')
    ....
    }
Complete Error Message ``` undefined is not an object (evaluating '_reactNativePicker.Picker.init') showPicker D:\Projects\advcoin\js\components\Wallet.js:44:11 touchableHandlePress D:\Projects\advcoin\node_modules\react-native\Libraries\Components\Touchable\TouchableNativeFeedback.android.js:187:45 _performSideEffectsForTransition D:\Projects\advcoin\node_modules\react-native\Libraries\Components\Touchable\Touchable.js:803:34 _receiveSignal D:\Projects\advcoin\node_modules\react-native\Libraries\Components\Touchable\Touchable.js:717:44 touchableHandleResponderRelease D:\Projects\advcoin\node_modules\react-native\Libraries\Components\Touchable\Touchable.js:435:24 invokeGuardedCallbackImpl D:\Projects\advcoin\node_modules\react-native\Libraries\Renderer\oss\ReactNativeRenderer-dev.js:92:15 invokeGuardedCallback D:\Projects\advcoin\node_modules\react-native\Libraries\Renderer\oss\ReactNativeRenderer-dev.js:306:36 invokeGuardedCallbackAndCatchFirstError D:\Projects\advcoin\node_modules\react-native\Libraries\Renderer\oss\ReactNativeRenderer-dev.js:330:30 executeDispatch D:\Projects\advcoin\node_modules\react-native\Libraries\Renderer\oss\ReactNativeRenderer-dev.js:699:42 executeDispatchesInOrder D:\Projects\advcoin\node_modules\react-native\Libraries\Renderer\oss\ReactNativeRenderer-dev.js:726:20 executeDispatchesAndRelease D:\Projects\advcoin\node_modules\react-native\Libraries\Renderer\oss\ReactNativeRenderer-dev.js:884:29 executeDispatchesAndReleaseTopLevel D:\Projects\advcoin\node_modules\react-native\Libraries\Renderer\oss\ReactNativeRenderer-dev.js:895:37 forEachAccumulated D:\Projects\advcoin\node_modules\react-native\Libraries\Renderer\oss\ReactNativeRenderer-dev.js:863:16 runEventsInBatch D:\Projects\advcoin\node_modules\react-native\Libraries\Renderer\oss\ReactNativeRenderer-dev.js:1050:6 runExtractedEventsInBatch D:\Projects\advcoin\node_modules\react-native\Libraries\Renderer\oss\ReactNativeRenderer-dev.js:1075:19 D:\Projects\advcoin\node_modules\react-native\Libraries\Renderer\oss\ReactNativeRenderer-dev.js:2713:6 batchedUpdates$1 D:\Projects\advcoin\node_modules\react-native\Libraries\Renderer\oss\ReactNativeRenderer-dev.js:15311:14 batchedUpdates D:\Projects\advcoin\node_modules\react-native\Libraries\Renderer\oss\ReactNativeRenderer-dev.js:2616:31 _receiveRootNodeIDEvent D:\Projects\advcoin\node_modules\react-native\Libraries\Renderer\oss\ReactNativeRenderer-dev.js:2711:17 receiveTouches D:\Projects\advcoin\node_modules\react-native\Libraries\Renderer\oss\ReactNativeRenderer-dev.js:2787:28 __callFunction D:\Projects\advcoin\node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:349:47 D:\Projects\advcoin\node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:106:26 __guard D:\Projects\advcoin\node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:297:10 callFunctionReturnFlushedQueue D:\Projects\advcoin\node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:105:17```

`

chunipo commented 6 years ago

me too

suretarget commented 5 years ago

You have to restart react-native run-android after install and link. I'm using "react-native": "0.57.5", and "react-native-picker": "^4.3.7" working perfectly.

lequangtuananh commented 5 years ago

Im currently on "react-native": "0.57.0", "react-native-picker": "^4.3.7". The error still exists even when I have added these codes

  1. MainApplication.java
    import com.beefe.picker.PickerViewPackage;
    ....
    protected List<ReactPackage> getPackages() {
    return Arrays.<ReactPackage>asList(
       new PickerViewPackage()
       ....
    }
  2. settings.gradle
    include :'react-native-picker'
    project(':react-native-picker').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-picker/android')
  3. app/build.gradle
    dependencies {  
    implementation project(':react-native-picker')
    ....
    }

Complete Error Message

thank you for your support 👍

but

include ':react-native-picker' not include :'react-native-picker'

💃