Skip to content

Support constant extension for android and iOS #2369

Description

@markzhai

#In react-native, we have getConstants to expose a map to js:

  @Override
  public Map<String, Object> getConstants() {
    final Map<String, Object> constants = new HashMap<>();
    constants.put(DURATION_SHORT_KEY, Toast.LENGTH_SHORT);
    constants.put(DURATION_LONG_KEY, Toast.LENGTH_LONG);
    return constants;
  }

So that js can access those constants directly without a promise. However in weex, registerModule can only do this with a callback. This is really useful if the common configs are on native side.

For more details, please refer: http://facebook.github.io/react-native/docs/native-modules-android.html

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions