简体   繁体   中英

How to send intent data to Javascript from ReactActivity of React Native

I want to send intent value to Java Script from ReactActivity of React Native.

I write following example code. How to send "tag" to JavaScript

public class MainActivity extends ReactActivity {
 @Override
 protected void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
   Intent intent = getIntent();
   Tag tag = (Tag) intent.getParcelableExtra(NfcAdapter.EXTRA_TAG);

    // I want to send tag data to Javascript
    // How to do?
 }  
public class CustomActivity extends ReactActivity {

@Override
protected String getMainComponentName() {
    return "CustomJSScene";
}

@Override
protected ReactActivityDelegate createReactActivityDelegate() {
    return new ReactActivityDelegate(this, getMainComponentName()) {

        @javax.annotation.Nullable
        @Override
        protected Bundle getLaunchOptions() {
            Bundle initialProps = new Bundle()
            initialProps.putString("key", "value");
            return initialProps;
        }
    };
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM