question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Not returning anything with "react-native": "0.60.5"

See original GitHub issue

Idk whether this is because of the react native version or something else make this happen. So I’ve just integrating my android app with react native and migrating to AndroidX. Before I did the integration and migration, this code is perfectly fine, I get the result and everything. But, after the integration and migration, I only can see and click the photo from the picker, there’s no result, console.log(res) does not working, and even I don’t get any error.

Please help

This is the code that I’m using: `try { const res = await DocumentPicker.pick({ type: [DocumentPicker.types.images], });

	  	console.log(res)

	  	if (res.size <= 3145728) {// 3 MB 
	  		dispatch({
				type: ACTION_TYPE_PICK_PHOTO_PROFILE_SUCCESS,
				payload: res,
			});
	  	} else {
	  		dispatch({
				type: ACTION_TYPE_PICK_PHOTO_PROFILE_EXCEED,
				payload: res
			});
	  	}
	} catch (err) {

		console.log(err)

		if (DocumentPicker.isCancel(err)) {
		    // User cancelled the picker, exit any dialogs or menus and move on
		}
	}`

Thanks in advance

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
arthurbachtiarcommented, Sep 17, 2019

Solved. Turns out I forgot to add the function for onActivityResult. This is the code that I used.

`private final int OVERLAY_PERMISSION_REQ_CODE = 1;

@Override
protected void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);

	SoLoader.init(this,false);
	mReactRootView = new RNGestureHandlerEnabledRootView(this);
	mReactInstanceManager = ReactInstanceManager.builder()
			.setApplication(getApplication())
			.setCurrentActivity(this)
			.setBundleAssetName("index.android.bundle")
			.setJSMainModulePath("index")
			.addPackage(new MainReactPackage())
			.setUseDeveloperSupport(BuildConfig.DEBUG)
			.setInitialLifecycleState(LifecycleState.RESUMED)
			.build();

	if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && !Settings.canDrawOverlays(this)) {
		Intent intent = new Intent(Settings.ACTION_MANAGE_OVERLAY_PERMISSION,
				Uri.parse("package:" + getPackageName()));
		startActivityForResult(intent, OVERLAY_PERMISSION_REQ_CODE);
	} else {
		startReactNative();
	}
}

private void startReactNative() {
	// The string here (e.g. "MyReactNativeApp") has to match
	// the string in AppRegistry.registerComponent() in index.js
	mReactRootView.startReactApplication(mReactInstanceManager, "NusaTalent", null);

	setContentView(mReactRootView);
}

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
	super.onActivityResult(requestCode, resultCode, data);

	if (requestCode == OVERLAY_PERMISSION_REQ_CODE) {
		if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
			if (!Settings.canDrawOverlays(this)) {
				Log.e(TAG, "onActivityResult: SYSTEM_ALERT_WINDOW permission not granted");
			} else {
				startReactNative();
			}
		}
	}
	Log.d(TAG, "onActivityResult: " + data);
	mReactInstanceManager.onActivityResult( this, requestCode, resultCode, data );
}`
0reactions
vonovakcommented, Apr 17, 2020
Read more comments on GitHub >

github_iconTop Results From Across the Web

In react-native 0.60.5, unable to call class function using this ...
Bind your func() method in the constructor itself constructor(props) { super(props); this.state = { }; this.func = this.func.bind(this); }.
Read more >
startDeviceScan not returning any values in Android - GitHub
Previously it worked on an android device but after an upgrade of react-native from 0.60.4 to 0.60.5 it does not work anymore ....
Read more >
Upgrading to new versions - React Native
Upgrading to new versions of React Native will give you access to more APIs, views, developer tools and other goodies.
Read more >
@react-native-community/netinfo - npm
If this API is not available the library will safely fallback to the old onLine property and return basic connection information. Migrating from ......
Read more >
React Native - Branch Help
The promise will only return one result. It will not continue to return results when links are opened or wait for a link...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found