#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
#In react-native, we have
getConstantsto expose a map to js: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