mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
use DynamicFromObject to avoid maps
Summary: Changes our property access pattern to iterate through props once and pass the Object value directly rather than looking the value up in the map with the key. Note some ViewManagers methods (especially yoga related ones on shadow nodes) expect a `Dyanamic`, so this diff also creates Dynamic's only when needed by the hand-written code, and introduces a new `DynamicWithObject` to create them that simply wraps the underlying object (as opposed to `DynamicWithMap` which wraps the map and does a lookup any time the `Dynamic` is accessed. Reviewed By: mdvacca Differential Revision: D14453300 fbshipit-source-id: df98567b6eff1e6b7c611f179eb11e413fb94e5d
This commit is contained in:
committed by
Facebook Github Bot
parent
af38a0cf87
commit
a46fba5dd3
@@ -1,13 +1,14 @@
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
* <p>This source code is licensed under the MIT license found in the LICENSE file in the root
|
||||
* directory of this source tree.
|
||||
*/
|
||||
|
||||
package com.facebook.react.bridge;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
@@ -19,16 +20,36 @@ import javax.annotation.Nullable;
|
||||
public interface ReadableMap {
|
||||
|
||||
boolean hasKey(@Nonnull String name);
|
||||
boolean isNull(@Nonnull String name);
|
||||
boolean getBoolean(@Nonnull String name);
|
||||
double getDouble(@Nonnull String name);
|
||||
int getInt(@Nonnull String name);
|
||||
@Nullable String getString(@Nonnull String name);
|
||||
@Nullable ReadableArray getArray(@Nonnull String name);
|
||||
@Nullable ReadableMap getMap(@Nonnull String name);
|
||||
@Nonnull Dynamic getDynamic(@Nonnull String name);
|
||||
@Nonnull ReadableType getType(@Nonnull String name);
|
||||
@Nonnull ReadableMapKeySetIterator keySetIterator();
|
||||
@Nonnull HashMap<String, Object> toHashMap();
|
||||
|
||||
boolean isNull(@Nonnull String name);
|
||||
|
||||
boolean getBoolean(@Nonnull String name);
|
||||
|
||||
double getDouble(@Nonnull String name);
|
||||
|
||||
int getInt(@Nonnull String name);
|
||||
|
||||
@Nullable
|
||||
String getString(@Nonnull String name);
|
||||
|
||||
@Nullable
|
||||
ReadableArray getArray(@Nonnull String name);
|
||||
|
||||
@Nullable
|
||||
ReadableMap getMap(@Nonnull String name);
|
||||
|
||||
@Nonnull
|
||||
Dynamic getDynamic(@Nonnull String name);
|
||||
|
||||
@Nonnull
|
||||
ReadableType getType(@Nonnull String name);
|
||||
|
||||
@Nonnull
|
||||
Iterator<Map.Entry<String, Object>> getEntryIterator();
|
||||
|
||||
@Nonnull
|
||||
ReadableMapKeySetIterator keySetIterator();
|
||||
|
||||
@Nonnull
|
||||
HashMap<String, Object> toHashMap();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user