mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
c3e20f18fe
This adds a new dimension similar to dom-relay. It's different from "native" which would be Flight for RN without Relay. This has some copy-pasta that's the same between the two Relay builds but the key difference will be Metro and we're not quite sure what other differences there will be yet.
24 lines
647 B
JavaScript
24 lines
647 B
JavaScript
/**
|
|
* 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.
|
|
*
|
|
* @flow
|
|
*/
|
|
|
|
import {convertStringToBuffer} from 'react-server/src/ReactServerStreamConfig';
|
|
|
|
export function formatChunkAsString(type: string, props: Object): string {
|
|
let str = '<' + type + '>';
|
|
if (typeof props.children === 'string') {
|
|
str += props.children;
|
|
}
|
|
str += '</' + type + '>';
|
|
return str;
|
|
}
|
|
|
|
export function formatChunk(type: string, props: Object): Uint8Array {
|
|
return convertStringToBuffer(formatChunkAsString(type, props));
|
|
}
|