react-nativescript
Version:
React renderer for NativeScript
104 lines (103 loc) • 8.65 kB
TypeScript
/**
* Code in here referenced from: https://github.com/gaearon/react/blob/1c7af862246e24574540f05c459f5fac0fad7086/src/renderers/dom/fiber/ReactDOMFiberEntry.js which carries the following copyright:
* Copyright 2013-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* They have since moved to a MIT-style licence, which is reproduced in /LICENSE.
*/
import { ActionBarAttributes, ActionItemAttributes, ActivityIndicatorAttributes, ButtonAttributes, ContentViewAttributes, DatePickerAttributes, FormattedStringAttributes, SpanAttributes, HtmlViewAttributes, ImageAttributes, LabelAttributes, AbsoluteLayoutAttributes, DockLayoutAttributes, FlexboxLayoutAttributes, GridLayoutAttributes, StackLayoutAttributes, WrapLayoutAttributes, ListPickerAttributes, ListViewAttributes, NavigationButtonAttributes, PlaceholderAttributes, ProgressAttributes, ScrollViewAttributes, SearchBarAttributes, SegmentedBarAttributes, SegmentedBarItemAttributes, SliderAttributes, SwitchAttributes, TabViewAttributes, TabViewItemAttributes, TextViewAttributes, TextFieldAttributes, TimePickerAttributes, WebViewAttributes, FrameAttributes, PageAttributes, ViewBaseAttributes, ViewAttributes } from "./lib/react-nativescript-jsx";
import { ActionBar, ActionItem, ActivityIndicator, Button, ContentView, DatePicker, HtmlView, Label, AbsoluteLayout, DockLayout, FlexboxLayout, GridLayout, StackLayout, WrapLayout, ListPicker, ListView, NavigationButton, Placeholder, Progress, ScrollView, SearchBar, SegmentedBar, Slider, Switch, TabView, TabViewItem, TextView, TextField, TimePicker, Frame, Page, FormattedString, SegmentedBarItem, Span, Image, WebView } from "@nativescript/core";
import { RNSStyle, OptionalStyleAllowingString, NativeScriptAttributes, NativeScriptProps } from "./shared/NativeScriptJSXTypings";
export { RNSStyle, OptionalStyleAllowingString, NativeScriptAttributes, NativeScriptProps };
import { __unstable__forwardNavOpts } from "./nativescript-vue-next/runtime/navigation";
export { __unstable__forwardNavOpts };
import * as React from "react";
import { ReactPortal } from "react";
import { Container } from "./shared/HostConfigTypes";
import { NSVRoot, NSVElement, NSVNode, NSVComment, NSVText, NSVNodeTypes, NSVViewFlags } from "./nativescript-vue-next/runtime/nodes";
import { ReactNodeList } from "./shared/ReactTypings";
export { NSVRoot, NSVElement, NSVNode, NSVComment, NSVText, NSVNodeTypes, NSVViewFlags };
export { ActionBarAttributes, ActionItemAttributes, ActivityIndicatorAttributes, ButtonAttributes, ContentViewAttributes, DatePickerAttributes, FormattedStringAttributes, SpanAttributes, HtmlViewAttributes, ImageAttributes, LabelAttributes, AbsoluteLayoutAttributes, DockLayoutAttributes, FlexboxLayoutAttributes, GridLayoutAttributes, StackLayoutAttributes, WrapLayoutAttributes, ListPickerAttributes, ListViewAttributes, NavigationButtonAttributes, PlaceholderAttributes, ProgressAttributes, ScrollViewAttributes, SearchBarAttributes, SegmentedBarAttributes, SegmentedBarItemAttributes, SliderAttributes, SwitchAttributes, TabViewAttributes, TabViewItemAttributes, TextViewAttributes, TextFieldAttributes, TimePickerAttributes, WebViewAttributes, FrameAttributes, PageAttributes, ViewBaseAttributes, ViewAttributes, };
export { registerElement } from "./nativescript-vue-next/runtime/registry";
export { ListView, CellViewContainer } from "./components/ListView";
export { StyleSheet } from "./client/StyleSheet";
export declare function createPortal(children: ReactNodeList, container: Container, key?: string | null): ReactPortal;
declare type RootKey = Container | string | null;
/**
* React NativeScript can render into any container that extends View,
* but it makes sense to use the Frame > Page model if your whole app
* (rather than a portion of it) will be described using React NativeScript.
*
* @param reactElement - Your <App/> component.
* @param domElement - Your root component; typically Page, but can be any View. Accepts null for a detached tree.
* @param callback - A callback to run after the component (typically <App/>) is rendered.
* @param containerTag - A unique key by which to keep track of the root (useful when the domElement is null).
* 'roots' with reference to: https://github.com/facebook/react/blob/ef4ac42f8893afd0240d2679db7438f1b599bbd4/packages/react-native-renderer/src/ReactFabric.js#L119
* @returns a ref to the container.
*/
export declare function render(reactElement: ReactNodeList, domElement: Container | null, callback?: () => void | null | undefined, containerTag?: string | null, strictMode?: boolean): import("./shared/HostConfigTypes").PublicInstance | React.Component<any, any, any>;
/**
* Calls removeChildFromContainer() to make the container remove its immediate child.
* If said container is null (i.e. a detached tree), note that null.removeChild() doesn't exist, so it's a no-op.
* Either way, it'll delete our reference to the root and thus should remove the React association from it.
* @param containerTag - the key uniquely identifying this root (either the container itself, or a string).
*/
export declare function unmountComponentAtNode(containerTag: RootKey): void;
export declare const unstable_batchedUpdates: <A, R>(fn: (a: A) => R, a: A) => R;
/**
* Convenience function to start your React NativeScript app.
* This should be placed as the final line of your app.ts file, as no
* code will run after it (at least on iOS).
*
* @param app - Your <App/> component.
*/
export declare function start(app: ReactNodeList): void;
declare global {
module JSX {
interface IntrinsicElements {
absoluteLayout: NativeScriptProps<AbsoluteLayoutAttributes, AbsoluteLayout>;
actionBar: NativeScriptProps<ActionBarAttributes, ActionBar>;
actionItem: NativeScriptProps<ActionItemAttributes, ActionItem>;
activityIndicator: NativeScriptProps<ActivityIndicatorAttributes, ActivityIndicator>;
button: NativeScriptProps<ButtonAttributes, Button>;
contentView: NativeScriptProps<ContentViewAttributes, ContentView>;
datePicker: NativeScriptProps<DatePickerAttributes, DatePicker>;
dockLayout: NativeScriptProps<DockLayoutAttributes, DockLayout>;
flexboxLayout: NativeScriptProps<FlexboxLayoutAttributes, FlexboxLayout>;
formattedString: NativeScriptProps<FormattedStringAttributes, FormattedString>;
frame: NativeScriptProps<FrameAttributes, Frame>;
gridLayout: NativeScriptProps<GridLayoutAttributes, GridLayout>;
htmlView: NativeScriptProps<HtmlViewAttributes, HtmlView>;
image: NativeScriptProps<ImageAttributes, Image>;
label: NativeScriptProps<LabelAttributes, Label>;
listPicker: NativeScriptProps<ListPickerAttributes, ListPicker>;
listView: NativeScriptProps<ListViewAttributes, ListView>;
navigationButton: NativeScriptProps<NavigationButtonAttributes, NavigationButton>;
page: NativeScriptProps<PageAttributes, Page>;
placeholder: NativeScriptProps<PlaceholderAttributes, Placeholder>;
progress: NativeScriptProps<ProgressAttributes, Progress>;
scrollView: NativeScriptProps<ScrollViewAttributes, ScrollView>;
searchBar: NativeScriptProps<SearchBarAttributes, SearchBar>;
segmentedBar: NativeScriptProps<SegmentedBarAttributes, SegmentedBar>;
segmentedBarItem: NativeScriptProps<SegmentedBarItemAttributes, SegmentedBarItem>;
slider: NativeScriptProps<SliderAttributes, Slider>;
span: NativeScriptProps<SpanAttributes, Span>;
stackLayout: NativeScriptProps<StackLayoutAttributes, StackLayout>;
switch: NativeScriptProps<SwitchAttributes, Switch>;
tabView: NativeScriptProps<TabViewAttributes, TabView>;
tabViewItem: NativeScriptProps<TabViewItemAttributes, TabViewItem>;
textField: NativeScriptProps<TextFieldAttributes, TextField>;
textView: NativeScriptProps<TextViewAttributes, TextView>;
timePicker: NativeScriptProps<TimePickerAttributes, TimePicker>;
webView: NativeScriptProps<WebViewAttributes, WebView>;
wrapLayout: NativeScriptProps<WrapLayoutAttributes, WrapLayout>;
}
interface ElementChildrenAttribute {
children: {};
}
}
}