Map Buffer
MapBuffer is an optimized sparse array format for transferring props-like data between C++ and JNI. It is designed to:
be compact to optimize space when sparse (sparse is the common case).
be accessible through JNI with zero/minimal copying.
work recursively for nested maps/arrays.
support dynamic types that map to JSON.
have minimal APK size and build time impact.
See
Limitations:
Keys are usually sized as 2 bytes, with each buffer supporting up to 65536 entries as a result.
O(log(N)) random key access for native buffers due to selected structure. Faster access can be achieved by retrieving MapBuffer.Entry with entryAt on known offsets.
Inheritors
Types
Data types supported by MapBuffer. Keep in sync with definition in <react/renderer/mapbuffer/MapBuffer.h>
, as enum serialization relies on correct order.
Properties
Functions
Provides parsed access to a MapBuffer without additional lookups for provided offset.
Provides parsed Boolean value if the entry for given key exists with DataType.BOOL type
Provides offset of the key to use for entryAt, for cases when offset is not statically known but can be cached.
Provides parsed MapBuffer value if the entry for given key exists with DataType.MAP type
Provides parsed List
Provides parsed DataType annotation associated with the given key.