Add missing class annotations xplat/js

Reviewed By: SamChou19815

Differential Revision: D38373443

fbshipit-source-id: 1222c4845ebd6b72bd6f54af1a27cf8542dd883a
This commit is contained in:
Pieter Vanderwerff
2022-08-03 12:43:58 -07:00
committed by Facebook GitHub Bot
parent 2fa04be062
commit ee3d3c248d
66 changed files with 378 additions and 294 deletions
+3 -1
View File
@@ -8,6 +8,8 @@
* @flow
*/
import type {Node} from 'react';
import {AppRegistry} from 'react-native';
import React from 'react';
@@ -31,7 +33,7 @@ RNTesterList.Components.concat(RNTesterList.APIs).forEach(
const ExampleModule = Example.module;
if (ExampleModule.displayName) {
class Snapshotter extends React.Component<{...}> {
render() {
render(): Node {
return (
<SnapshotViewIOS>
<RNTesterModuleContainer
@@ -20,7 +20,7 @@ const createExamplePage = function (
exampleModule: RNTesterModule,
): React.ComponentType<any> {
class ExamplePage extends React.Component<{...}> {
render() {
render(): React.Node {
return <RNTesterModuleContainer module={exampleModule} />;
}
}
@@ -223,7 +223,7 @@ class CheckboxExample extends React.Component<
checkboxState: boolean | 'mixed',
},
> {
state = {
state: {checkboxState: boolean | 'mixed'} = {
checkboxState: true,
};
@@ -242,7 +242,7 @@ class CheckboxExample extends React.Component<
});
};
render() {
render(): React.Node {
return (
<TouchableOpacity
onPress={this._onCheckboxPress}
@@ -262,7 +262,7 @@ class SwitchExample extends React.Component<
switchState: boolean,
},
> {
state = {
state: {switchState: boolean} = {
switchState: true,
};
@@ -274,7 +274,7 @@ class SwitchExample extends React.Component<
});
};
render() {
render(): React.Node {
return (
<TouchableOpacity
onPress={this._onSwitchToggle}
@@ -303,7 +303,7 @@ class SelectionExample extends React.Component<
current: React.ElementRef<typeof TouchableOpacity> | null,
};
state = {
state: {isEnabled: boolean, isSelected: boolean} = {
isSelected: true,
isEnabled: false,
};
@@ -375,7 +375,7 @@ class ExpandableElementExample extends React.Component<
expandState: boolean,
},
> {
state = {
state: {expandState: boolean} = {
expandState: false,
};
@@ -387,7 +387,7 @@ class ExpandableElementExample extends React.Component<
});
};
render() {
render(): React.Node {
return (
<TouchableOpacity
onPress={this._onElementPress}
@@ -408,7 +408,11 @@ class NestedCheckBox extends React.Component<
checkbox3: boolean | 'mixed',
},
> {
state = {
state: {
checkbox1: boolean | 'mixed',
checkbox2: boolean | 'mixed',
checkbox3: boolean | 'mixed',
} = {
checkbox1: false,
checkbox2: false,
checkbox3: false,
@@ -460,7 +464,7 @@ class NestedCheckBox extends React.Component<
});
};
render() {
render(): React.Node {
return (
<View>
<TouchableOpacity
@@ -881,13 +885,13 @@ class FakeSliderExample extends React.Component<{}, FakeSliderExampleState> {
}
class AnnounceForAccessibility extends React.Component<{}> {
_handleOnPress = () =>
_handleOnPress = (): TimeoutID =>
setTimeout(
() => AccessibilityInfo.announceForAccessibility('Announcement Test'),
1000,
);
_handleOnPressQueued = () =>
_handleOnPressQueued = (): TimeoutID =>
setTimeout(
() =>
AccessibilityInfo.announceForAccessibilityWithOptions(
@@ -1052,11 +1056,11 @@ class EnabledExample extends React.Component<
isEnabled: boolean,
},
> {
state = {
state: {isEnabled: boolean} = {
isEnabled: false,
};
_subscription: EventSubscription;
componentDidMount() {
componentDidMount(): null | Promise<mixed> {
this._subscription = AccessibilityInfo.addEventListener(
this.props.eventListener,
this._handleToggled,
@@ -17,7 +17,7 @@ const RNTesterBlock = require('../../components/RNTesterBlock');
type Props = $ReadOnly<{||}>;
class AccessibilityIOSExample extends React.Component<Props> {
render() {
render(): React.Node {
return (
<RNTesterBlock title="Accessibility iOS APIs">
<View
@@ -10,6 +10,8 @@
'use strict';
import type {NativeMethods} from 'react-native/Libraries/Renderer/shims/ReactNativeTypes';
const React = require('react');
const {
ActionSheetIOS,
@@ -29,11 +31,11 @@ const DISABLED_BUTTON_INDICES = [1, 2];
type Props = $ReadOnly<{||}>;
type State = {|clicked: string|};
class ActionSheetExample extends React.Component<Props, State> {
state = {
state: State = {
clicked: 'none',
};
render() {
render(): React.Node {
return (
<View>
<Text onPress={this.showActionSheet} style={style.button}>
@@ -62,11 +64,11 @@ class ActionSheetTintExample extends React.Component<
$FlowFixMeProps,
$FlowFixMeState,
> {
state = {
state: any | {clicked: string} = {
clicked: 'none',
};
render() {
render(): React.Node {
return (
<View>
<Text onPress={this.showActionSheet} style={style.button}>
@@ -96,11 +98,11 @@ class ActionSheetCancelButtonTintExample extends React.Component<
$FlowFixMeProps,
$FlowFixMeState,
> {
state = {
state: any | {clicked: string} = {
clicked: 'none',
};
render() {
render(): React.Node {
return (
<View>
<Text onPress={this.showActionSheet} style={style.button}>
@@ -131,13 +133,13 @@ class ActionSheetAnchorExample extends React.Component<
$FlowFixMeProps,
$FlowFixMeState,
> {
state = {
state: any | {clicked: string} = {
clicked: 'none',
};
anchorRef = React.createRef();
anchorRef: {current: null | $Exact<NativeMethods>} = React.createRef();
render() {
render(): React.Node {
return (
<View>
<View style={style.anchorRow}>
@@ -174,11 +176,11 @@ class ActionSheetAnchorExample extends React.Component<
}
class ActionSheetDisabledExample extends React.Component<Props, State> {
state = {
state: State = {
clicked: 'none',
};
render() {
render(): React.Node {
return (
<View>
<Text onPress={this.showActionSheet} style={style.button}>
@@ -205,7 +207,7 @@ class ActionSheetDisabledExample extends React.Component<Props, State> {
}
class ActionSheetDismissExample extends React.Component<{...}> {
render() {
render(): React.Node {
return (
<View>
<Text onPress={this.showAndDismissActionSheet} style={style.button}>
@@ -236,11 +238,11 @@ class ShareActionSheetExample extends React.Component<
$FlowFixMeProps,
$FlowFixMeState,
> {
state = {
state: any | {text: string} = {
text: '',
};
render() {
render(): React.Node {
return (
<View>
<Text onPress={this.showShareActionSheet} style={style.button}>
@@ -277,11 +279,11 @@ class ShareScreenshotExample extends React.Component<
$FlowFixMeProps,
$FlowFixMeState,
> {
state = {
state: any | {text: string} = {
text: '',
};
render() {
render(): React.Node {
return (
<View>
<Text onPress={this.showShareActionSheet} style={style.button}>
@@ -322,13 +324,13 @@ class ShareScreenshotAnchorExample extends React.Component<
$FlowFixMeProps,
$FlowFixMeState,
> {
state = {
state: any | {text: string} = {
text: '',
};
anchorRef = React.createRef();
anchorRef: {current: null | $Exact<NativeMethods>} = React.createRef();
render() {
render(): React.Node {
return (
<View>
<View style={style.anchorRow}>
@@ -53,7 +53,7 @@ class PromptOptions extends React.Component<Props, State> {
};
}
render() {
render(): React.Node {
return (
<View>
<Text style={styles.promptValue}>
@@ -21,7 +21,12 @@ class AppStateSubscription extends React.Component<
$FlowFixMeProps,
$FlowFixMeState,
> {
state = {
state: {
appState: ?string,
eventsDetected: Array<string>,
memoryWarnings: number,
previousAppStates: Array<?(any | string)>,
} = {
appState: AppState.currentState,
previousAppStates: [],
memoryWarnings: 0,
@@ -76,7 +81,7 @@ class AppStateSubscription extends React.Component<
});
};
render() {
render(): React.Node {
if (this.props.showMemoryWarnings) {
return (
<View>
@@ -20,7 +20,7 @@ class ColorSchemeSubscription extends React.Component<
> {
_subscription: ?EventSubscription;
state = {
state: {colorScheme: ?string, ...} = {
colorScheme: Appearance.getColorScheme(),
};
@@ -37,7 +37,7 @@ class ColorSchemeSubscription extends React.Component<
this._subscription?.remove();
}
render() {
render(): React.Node {
return (
<RNTesterThemeContext.Consumer>
{theme => {
@@ -16,7 +16,7 @@ class DimensionsSubscription extends React.Component<
{dim: string, ...},
{dims: Object, ...},
> {
state = {
state: {dims: any, ...} = {
dims: Dimensions.get(this.props.dim),
};
@@ -37,7 +37,7 @@ class DimensionsSubscription extends React.Component<
this._dimensionsSubscription?.remove();
}
render() {
render(): React.Node {
return <Text>{JSON.stringify(this.state.dims, null, 2)}</Text>;
}
}
@@ -43,7 +43,7 @@ type BlobImageProps = $ReadOnly<{|
|}>;
class BlobImage extends React.Component<BlobImageProps, BlobImageState> {
state = {
state: BlobImageState = {
objectURL: null,
};
@@ -56,7 +56,7 @@ class BlobImage extends React.Component<BlobImageProps, BlobImageState> {
})();
}
render() {
render(): React.Node {
return this.state.objectURL !== null ? (
<Image source={{uri: this.state.objectURL}} style={styles.base} />
) : (
@@ -75,7 +75,7 @@ class BlobImageExample extends React.Component<
BlobImageExampleProps,
BlobImageExampleState,
> {
render() {
render(): React.Node {
return (
<View style={styles.horizontal}>
{this.props.urls.map(url => (
@@ -102,7 +102,7 @@ class NetworkImageCallbackExample extends React.Component<
NetworkImageCallbackExampleProps,
NetworkImageCallbackExampleState,
> {
state = {
state: NetworkImageCallbackExampleState = {
events: [],
startLoadPrefetched: false,
mountTime: Date.now(),
@@ -123,7 +123,7 @@ class NetworkImageCallbackExample extends React.Component<
this.setState({imageHash: Date.now()});
};
render() {
render(): React.Node {
const {mountTime} = this.state;
return (
<View>
@@ -233,13 +233,13 @@ class NetworkImageExample extends React.Component<
NetworkImageExampleProps,
NetworkImageExampleState,
> {
state = {
state: NetworkImageExampleState = {
error: null,
loading: false,
progress: [],
};
render() {
render(): React.Node {
return this.state.error != null ? (
<Text>{this.state.error}</Text>
) : (
@@ -283,7 +283,7 @@ class ImageSizeExample extends React.Component<
ImageSizeExampleProps,
ImageSizeExampleState,
> {
state = {
state: ImageSizeExampleState = {
width: 0,
height: 0,
};
@@ -294,7 +294,7 @@ class ImageSizeExample extends React.Component<
});
}
render() {
render(): React.Node {
return (
<View style={{flexDirection: 'row'}}>
<Image
@@ -326,7 +326,7 @@ class MultipleSourcesExample extends React.Component<
MultipleSourcesExampleProps,
MultipleSourcesExampleState,
> {
state = {
state: MultipleSourcesExampleState = {
width: 30,
height: 30,
};
@@ -351,7 +351,7 @@ class MultipleSourcesExample extends React.Component<
});
};
render() {
render(): React.Node {
return (
<View>
<View style={{flexDirection: 'row', justifyContent: 'space-between'}}>
@@ -397,7 +397,7 @@ class LoadingIndicatorSourceExample extends React.Component<
LoadingIndicatorSourceExampleProps,
LoadingIndicatorSourceExampleState,
> {
state = {
state: LoadingIndicatorSourceExampleState = {
imageHash: Date.now(),
};
@@ -407,11 +407,11 @@ class LoadingIndicatorSourceExample extends React.Component<
});
};
loaderGif = {
loaderGif: {uri: string} = {
uri: 'https://media1.giphy.com/media/3oEjI6SIIHBdRxXI40/200.gif',
};
render() {
render(): React.Node {
const loadingImage = {
uri: `https://www.facebook.com/ads/pics/successstories.png?hash=${this.state.imageHash}`,
};
@@ -447,7 +447,7 @@ class OnLayoutExample extends React.Component<
OnLayoutExampleProps,
OnLayoutExampleState,
> {
state = {
state: OnLayoutExampleState = {
width: 30,
height: 30,
layoutHandlerMessage: 'No Message',
@@ -482,7 +482,7 @@ class OnLayoutExample extends React.Component<
});
};
render() {
render(): React.Node {
return (
<View>
<Text>Adjust the image size to trigger the OnLayout handler.</Text>
@@ -536,7 +536,7 @@ class OnPartialLoadExample extends React.Component<
OnPartialLoadExampleProps,
OnPartialLoadExampleState,
> {
state = {
state: OnPartialLoadExampleState = {
hasLoaded: false,
};
@@ -546,7 +546,7 @@ class OnPartialLoadExample extends React.Component<
});
};
render() {
render(): React.Node {
return (
<View>
<Text>
@@ -24,7 +24,7 @@ const {
type MessageProps = $ReadOnly<{||}>;
class Message extends React.PureComponent<MessageProps> {
render() {
render(): React.Node {
return (
<View style={styles.textBubbleBackground}>
<Text style={styles.text}>Text Message</Text>
@@ -36,9 +36,9 @@ class Message extends React.PureComponent<MessageProps> {
type TextInputProps = $ReadOnly<{||}>;
type TextInputState = {|text: string|};
class TextInputBar extends React.PureComponent<TextInputProps, TextInputState> {
state = {text: ''};
state: TextInputState = {text: ''};
render() {
render(): React.Node {
return (
<View style={styles.textInputContainer}>
<TextInput
@@ -63,7 +63,7 @@ class TextInputBar extends React.PureComponent<TextInputProps, TextInputState> {
const BAR_HEIGHT = 44;
type InputAccessoryProps = $ReadOnly<{||}>;
class InputAccessoryViewExample extends React.Component<InputAccessoryProps> {
render() {
render(): React.Node {
return (
<>
<ScrollView style={styles.fill} keyboardDismissMode="interactive">
@@ -49,7 +49,7 @@ function shuffleArray(array: Array<ExampleViewSpec>) {
}
class AddRemoveExample extends React.Component<{...}, AddRemoveExampleState> {
state = {
state: AddRemoveExampleState = {
views: [],
nextKey: 1,
};
@@ -96,7 +96,7 @@ class AddRemoveExample extends React.Component<{...}, AddRemoveExampleState> {
this.setState(state => ({views: shuffleArray(state.views)}));
};
render() {
render(): React.Node {
const views = this.state.views.map(({key}) => (
<View
key={key}
@@ -151,7 +151,7 @@ class ReparentingExample extends React.Component<
{...},
ReparentingExampleState,
> {
state = {
state: ReparentingExampleState = {
hasBorder: false,
};
@@ -172,7 +172,7 @@ class ReparentingExample extends React.Component<
this.setState(state => ({hasBorder: !state.hasBorder}));
};
render() {
render(): React.Node {
const parentStyle = this.state.hasBorder
? {borderWidth: 5, borderColor: 'red'}
: {};
@@ -214,7 +214,7 @@ type CrossFadeExampleState = {|
|};
class CrossFadeExample extends React.Component<{...}, CrossFadeExampleState> {
state = {
state: CrossFadeExampleState = {
toggled: false,
};
@@ -225,7 +225,7 @@ class CrossFadeExample extends React.Component<{...}, CrossFadeExampleState> {
this.setState(state => ({toggled: !state.toggled}));
};
render() {
render(): React.Node {
return (
<View style={styles.container}>
<TouchableOpacity onPress={this._onPressToggle}>
@@ -250,7 +250,7 @@ class LayoutUpdateExample extends React.Component<
{...},
LayoutUpdateExampleState,
> {
state = {
state: LayoutUpdateExampleState = {
width: 200,
height: 100,
};
@@ -285,7 +285,7 @@ class LayoutUpdateExample extends React.Component<
this.timeout = setTimeout(() => this.setState({width: 100}), 500);
};
render() {
render(): React.Node {
const {width, height} = this.state;
return (
@@ -81,7 +81,7 @@ class LayoutEventExample extends React.Component<Props, State> {
this.setState({imageLayout: e.nativeEvent.layout});
};
render() {
render(): React.Node {
const viewStyle = [styles.view, this.state.viewStyle];
const textLayout = this.state.textLayout || {width: '?', height: '?'};
const imageLayout = this.state.imageLayout || {x: '?', y: '?'};
@@ -17,7 +17,7 @@ const React = require('react');
const {StyleSheet, Text, View} = require('react-native');
class Circle extends React.Component<$FlowFixMeProps> {
render() {
render(): React.Node {
const size = this.props.size || 20;
const backgroundColor = this.props.bgColor || '#527fe4';
return (
@@ -35,7 +35,7 @@ class Circle extends React.Component<$FlowFixMeProps> {
}
class CircleBlock extends React.Component<$FlowFixMeProps> {
render() {
render(): React.Node {
const circleStyle = {
flexDirection: 'row',
backgroundColor: '#f6f7f8',
@@ -26,7 +26,7 @@ const {
const AnimatedSlider = Animated.createAnimatedComponent(Slider);
class Tester extends React.Component<$FlowFixMeProps, $FlowFixMeState> {
state = {
state: any | {js: AnimatedValue, native: AnimatedValue} = {
native: new Animated.Value(0),
js: new Animated.Value(0),
};
@@ -54,7 +54,7 @@ class Tester extends React.Component<$FlowFixMeProps, $FlowFixMeState> {
}).start();
};
render() {
render(): React.Node {
return (
<TouchableWithoutFeedback onPress={this.onPress}>
<View>
@@ -75,7 +75,7 @@ class Tester extends React.Component<$FlowFixMeProps, $FlowFixMeState> {
}
class ValueListenerExample extends React.Component<{...}, $FlowFixMeState> {
state = {
state: any | {anim: AnimatedValue, progress: number} = {
anim: new Animated.Value(0),
progress: 0,
};
@@ -102,7 +102,7 @@ class ValueListenerExample extends React.Component<{...}, $FlowFixMeState> {
}).start();
};
render() {
render(): React.Node {
return (
<TouchableWithoutFeedback onPress={this._onPress}>
<View>
@@ -124,7 +124,7 @@ class ValueListenerExample extends React.Component<{...}, $FlowFixMeState> {
}
class LoopExample extends React.Component<{...}, $FlowFixMeState> {
state = {
state: any | {value: AnimatedValue} = {
value: new Animated.Value(0),
};
@@ -138,7 +138,7 @@ class LoopExample extends React.Component<{...}, $FlowFixMeState> {
).start();
}
render() {
render(): React.Node {
return (
<View style={styles.row}>
<Animated.View
@@ -167,7 +167,7 @@ class InternalSettings extends React.Component<
},
> {
_stallInterval: ?number;
render() {
render(): React.Node {
return (
<View>
<RNTesterSettingSwitchRow
@@ -227,11 +227,11 @@ class InternalSettings extends React.Component<
}
class EventExample extends React.Component<{...}, $FlowFixMeState> {
state = {
state: any | {anim: AnimatedValue} = {
anim: new Animated.Value(0),
};
render() {
render(): React.Node {
return (
<View>
<Animated.View
@@ -282,7 +282,14 @@ class TrackingExample extends React.Component<
$FlowFixMeProps,
$FlowFixMeState,
> {
state = {
state:
| any
| {
js: AnimatedValue,
native: AnimatedValue,
toJS: AnimatedValue,
toNative: AnimatedValue,
} = {
native: new Animated.Value(0),
toNative: new Animated.Value(0),
js: new Animated.Value(0),
@@ -315,7 +322,10 @@ class TrackingExample extends React.Component<
this.state.toJS.setValue(nextValue);
};
renderBlock = (anim: any | AnimatedValue, dest: any | AnimatedValue) => [
renderBlock = (
anim: any | AnimatedValue,
dest: any | AnimatedValue,
): Array<React.Node> => [
<Animated.View
key="line"
style={[styles.line, {transform: [{translateX: dest}]}]}
@@ -326,7 +336,7 @@ class TrackingExample extends React.Component<
/>,
];
render() {
render(): React.Node {
return (
<TouchableWithoutFeedback onPress={this.onPress}>
<View>
@@ -17,7 +17,13 @@ import {type EventSubscription} from 'react-native/Libraries/vendor/emitter/Even
class OrientationChangeExample extends React.Component<{...}, $FlowFixMeState> {
_orientationSubscription: EventSubscription;
state = {
state:
| any
| {
currentOrientation: string,
isLandscape: boolean,
orientationDegrees: number,
} = {
currentOrientation: '',
orientationDegrees: 0,
isLandscape: false,
@@ -42,7 +48,7 @@ class OrientationChangeExample extends React.Component<{...}, $FlowFixMeState> {
});
};
render() {
render(): React.Node {
return (
<View>
<Text>{JSON.stringify(this.state)}</Text>
@@ -27,7 +27,7 @@ type ExampleBoxState = $ReadOnly<{|
|}>;
class ExampleBox extends React.Component<ExampleBoxProps, ExampleBoxState> {
state = {
state: ExampleBoxState = {
log: [],
};
@@ -49,7 +49,7 @@ class ExampleBox extends React.Component<ExampleBoxProps, ExampleBoxState> {
this.state.log = this.state.log.concat(['---']);
};
render() {
render(): React.Node {
const {Component} = this.props;
return (
<View>
@@ -69,7 +69,7 @@ class ExampleBox extends React.Component<ExampleBoxProps, ExampleBoxState> {
}
class NoneExample extends React.Component<$FlowFixMeProps> {
render() {
render(): React.Node {
return (
<View
onTouchStart={() => this.props.onLog('A unspecified touched')}
@@ -100,7 +100,7 @@ class NoneExample extends React.Component<$FlowFixMeProps> {
* the experiment and confuse the output.
*/
class DemoText extends React.Component<$FlowFixMeProps> {
render() {
render(): React.Node {
return (
<View pointerEvents="none">
<Text style={this.props.style}>{this.props.children}</Text>
@@ -110,7 +110,7 @@ class DemoText extends React.Component<$FlowFixMeProps> {
}
class BoxNoneExample extends React.Component<$FlowFixMeProps> {
render() {
render(): React.Node {
return (
<View
onTouchStart={() => this.props.onLog('A unspecified touched')}
@@ -143,7 +143,7 @@ class BoxNoneExample extends React.Component<$FlowFixMeProps> {
}
class BoxOnlyExample extends React.Component<$FlowFixMeProps> {
render() {
render(): React.Node {
return (
<View
onTouchStart={() => this.props.onLog('A unspecified touched')}
@@ -183,7 +183,7 @@ type OverflowExampleProps = $ReadOnly<{|
|}>;
class OverflowExample extends React.Component<OverflowExampleProps> {
render() {
render(): React.Node {
const {overflow} = this.props;
return (
<View
@@ -217,13 +217,13 @@ class OverflowExample extends React.Component<OverflowExampleProps> {
}
class OverflowVisibleExample extends React.Component<ExampleBoxComponentProps> {
render() {
render(): React.Node {
return <OverflowExample {...this.props} overflow="visible" />;
}
}
class OverflowHiddenExample extends React.Component<ExampleBoxComponentProps> {
render() {
render(): React.Node {
return <OverflowExample {...this.props} overflow="hidden" />;
}
}
@@ -19,7 +19,7 @@ const {
} = require('react-native');
class AppPropertiesUpdateExample extends React.Component<{...}> {
render() {
render(): React.Node {
// Do not require this unless we are actually rendering.
const UpdatePropertiesExampleView = requireNativeComponent(
'UpdatePropertiesExampleView',
@@ -41,7 +41,7 @@ class AppPropertiesUpdateExample extends React.Component<{...}> {
}
class RootViewSizeFlexibilityExample extends React.Component<{...}> {
render() {
render(): React.Node {
// Do not require this unless we are actually rendering.
const FlexibleSizeExampleView = requireNativeComponent(
'FlexibleSizeExampleView',
@@ -206,7 +206,7 @@ class RTLToggleExample extends React.Component<any, RTLToggleState> {
};
}
render() {
render(): React.Node {
return (
<View>
<View style={styles.directionBox}>
@@ -267,7 +267,7 @@ class AnimationExample extends React.Component<any, AnimationState> {
};
}
render() {
render(): React.Node {
return (
<View>
<RTLToggler setRTL={this.props.setRTL} isRTL={this.props.isRTL} />
@@ -28,7 +28,7 @@ class SafeAreaViewExample extends React.Component<
modalVisible: boolean,
|},
> {
state = {
state: {modalVisible: boolean} = {
modalVisible: false,
};
@@ -36,7 +36,7 @@ class SafeAreaViewExample extends React.Component<
this.setState({modalVisible: visible});
};
render() {
render(): React.Node {
return (
<View>
<Modal
@@ -65,7 +65,7 @@ class SafeAreaViewExample extends React.Component<
}
class IsIPhoneXExample extends React.Component<{...}> {
render() {
render(): React.Node {
return (
<View>
<Text>
@@ -10,6 +10,8 @@
'use strict';
import type AnimatedValue from 'react-native/Libraries/Animated/nodes/AnimatedValue';
const React = require('react');
const ReactNative = require('react-native');
const {Component} = React;
@@ -17,7 +19,7 @@ const {StyleSheet, Text, View, Animated, Easing, TouchableOpacity, Dimensions} =
ReactNative;
class ScrollViewAnimatedExample extends Component<{...}> {
_scrollViewPos = new Animated.Value(0);
_scrollViewPos: AnimatedValue = new Animated.Value(0);
startAnimation: () => void = () => {
this._scrollViewPos.setValue(0);
@@ -29,10 +29,10 @@ import type {ViewStyleProp} from 'react-native/Libraries/StyleSheet/StyleSheet';
import ScrollViewPressableStickyHeaderExample from './ScrollViewPressableStickyHeaderExample';
class EnableDisableList extends React.Component<{}, {scrollEnabled: boolean}> {
state = {
state: {scrollEnabled: boolean} = {
scrollEnabled: true,
};
render() {
render(): React.Node {
return (
<View>
<ScrollView
@@ -66,12 +66,12 @@ class AppendingList extends React.Component<
{},
{items: Array<React.Element<typeof Item>>},
> {
state = {
state: {items: Array<React.Element<typeof Item>>} = {
items: [...Array(AppendingListItemCount)].map((_, ii) => (
<Item msg={`Item ${ii}`} />
)),
};
render() {
render(): React.Node {
return (
<View>
<ScrollView
@@ -1243,7 +1243,7 @@ class Item extends React.PureComponent<{|
msg?: string,
style?: ViewStyleProp,
|}> {
render() {
render(): $FlowFixMe {
return (
<View style={[styles.item, this.props.style]}>
<Text>{this.props.msg}</Text>
@@ -15,11 +15,11 @@ const {Alert, Image, StyleSheet, Text, View} = require('react-native');
const ScreenshotManager = require('../../../NativeModuleExample/NativeScreenshotManager');
class ScreenshotExample extends React.Component<{...}, $FlowFixMeState> {
state = {
state: any | {uri: void} = {
uri: undefined,
};
render() {
render(): React.Node {
return (
<View style={style.container}>
<Text onPress={this.takeScreenshot} style={style.button}>
@@ -32,7 +32,9 @@ function getValue<T>(values: Array<T>, index: number): T {
}
class StatusBarHiddenExample extends React.Component<{...}, $FlowFixMeState> {
state = {
state:
| $FlowFixMe
| {animated: boolean, hidden: boolean, showHideTransition: string} = {
animated: true,
hidden: false,
showHideTransition: getValue(showHideTransitions, 0),
@@ -58,11 +60,12 @@ class StatusBarHiddenExample extends React.Component<{...}, $FlowFixMeState> {
});
};
render() {
render(): React.Node {
return (
<View>
<StatusBar
hidden={this.state.hidden}
// $FlowFixMe[incompatible-type]
showHideTransition={this.state.showHideTransition}
animated={this.state.animated}
/>
@@ -110,16 +113,17 @@ class StatusBarStyleExample extends React.Component<{...}, $FlowFixMeState> {
this.setState({animated: !this.state.animated});
};
state = {
state: $FlowFixMe | {animated: boolean, barStyle: string} = {
animated: true,
barStyle: getValue(barStyles, this._barStyleIndex),
};
render() {
render(): React.Node {
return (
<View>
<StatusBar
animated={this.state.animated}
// $FlowFixMe[incompatible-type]
barStyle={this.state.barStyle}
/>
<TouchableHighlight
@@ -150,7 +154,7 @@ class StatusBarNetworkActivityExample extends React.Component<
{...},
$FlowFixMeState,
> {
state = {
state: $FlowFixMe | {networkActivityIndicatorVisible: boolean} = {
networkActivityIndicatorVisible: false,
};
@@ -161,7 +165,7 @@ class StatusBarNetworkActivityExample extends React.Component<
});
};
render() {
render(): React.Node {
return (
<View>
<StatusBar
@@ -188,7 +192,7 @@ class StatusBarBackgroundColorExample extends React.Component<
{...},
$FlowFixMeState,
> {
state = {
state: $FlowFixMe | {animated: boolean, backgroundColor: string} = {
animated: true,
backgroundColor: getValue(colors, 0),
};
@@ -204,7 +208,7 @@ class StatusBarBackgroundColorExample extends React.Component<
this.setState({animated: !this.state.animated});
};
render() {
render(): React.Node {
return (
<View>
<StatusBar
@@ -234,7 +238,7 @@ class StatusBarTranslucentExample extends React.Component<
{...},
$FlowFixMeState,
> {
state = {
state: $FlowFixMe | {translucent: boolean} = {
translucent: false,
};
@@ -244,7 +248,7 @@ class StatusBarTranslucentExample extends React.Component<
});
};
render() {
render(): React.Node {
return (
<View>
<StatusBar translucent={this.state.translucent} />
@@ -263,7 +267,7 @@ class StatusBarTranslucentExample extends React.Component<
}
class StatusBarStaticIOSExample extends React.Component<{...}> {
render() {
render(): React.Node {
return (
<View>
<TouchableHighlight
@@ -329,7 +333,7 @@ class StatusBarStaticIOSExample extends React.Component<{...}> {
}
class StatusBarStaticAndroidExample extends React.Component<{...}> {
render() {
render(): React.Node {
return (
<View>
<TouchableHighlight
@@ -429,7 +433,7 @@ class StatusBarStaticAndroidExample extends React.Component<{...}> {
}
class ModalExample extends React.Component<{...}, $FlowFixMeState> {
state = {
state: $FlowFixMe | {modalVisible: boolean} = {
modalVisible: false,
};
@@ -437,7 +441,7 @@ class ModalExample extends React.Component<{...}, $FlowFixMeState> {
this.setState({modalVisible: !this.state.modalVisible});
};
render() {
render(): React.Node {
return (
<View>
<TouchableHighlight
@@ -42,12 +42,12 @@ class BasicSwitchExample extends React.Component<
{||},
SimpleSwitchExampleState,
> {
state = {
state: SimpleSwitchExampleState = {
trueSwitchIsOn: true,
falseSwitchIsOn: false,
};
render() {
render(): React.Node {
return (
<View>
<ExampleRow>
@@ -85,12 +85,12 @@ class DisabledSwitchExample extends React.Component<
{||},
SimpleSwitchExampleState,
> {
state = {
state: SimpleSwitchExampleState = {
trueSwitchIsOn: true,
falseSwitchIsOn: false,
};
render() {
render(): React.Node {
return (
<View>
<ExampleRow>
@@ -126,12 +126,12 @@ class DisabledSwitchExample extends React.Component<
}
class ColorSwitchExample extends React.Component<{...}, $FlowFixMeState> {
state = {
state: any | {colorFalseSwitchIsOn: boolean, colorTrueSwitchIsOn: boolean} = {
colorTrueSwitchIsOn: true,
colorFalseSwitchIsOn: false,
};
render() {
render(): React.Node {
return (
<View>
<Switch
@@ -161,12 +161,13 @@ class ColorSwitchExample extends React.Component<{...}, $FlowFixMeState> {
}
class EventSwitchExample extends React.Component<{...}, $FlowFixMeState> {
state = {
eventSwitchIsOn: false,
eventSwitchRegressionIsOn: true,
};
state: any | {eventSwitchIsOn: boolean, eventSwitchRegressionIsOn: boolean} =
{
eventSwitchIsOn: false,
eventSwitchRegressionIsOn: true,
};
render() {
render(): React.Node {
return (
<View style={{flexDirection: 'row', justifyContent: 'space-around'}}>
<View>
@@ -213,11 +214,11 @@ class EventSwitchExample extends React.Component<{...}, $FlowFixMeState> {
}
class IOSBackgroundColEx extends React.Component<{...}, $FlowFixMeState> {
state = {
state: any | {iosBackgroundColor: string} = {
iosBackgroundColor: '#ffa500',
};
render() {
render(): React.Node {
return (
<View>
<Switch
@@ -235,7 +236,7 @@ class IOSBackgroundColEx extends React.Component<{...}, $FlowFixMeState> {
}
class OnChangeExample extends React.Component<{...}, $FlowFixMeState> {
render() {
render(): React.Node {
return (
<View>
<Switch
@@ -253,7 +254,7 @@ class ContainerBackgroundColorStyleExample extends React.Component<
{...},
$FlowFixMeState,
> {
render() {
render(): React.Node {
return (
<View>
<Switch
@@ -53,7 +53,7 @@ class TextAlignRTLExample extends React.Component<
};
}
render() {
render(): React.Node {
const {isRTL} = this.state;
const toggleRTL = () => this.setState({isRTL: !isRTL});
return (
@@ -90,7 +90,7 @@ class TextAlignRTLExample extends React.Component<
}
class Entity extends React.Component<$FlowFixMeProps> {
render() {
render(): React.Node {
return (
<Text style={{fontWeight: '500', color: '#527fe4'}}>
{this.props.children}
@@ -100,7 +100,10 @@ class Entity extends React.Component<$FlowFixMeProps> {
}
class AttributeToggler extends React.Component<{...}, $FlowFixMeState> {
state = {fontWeight: 'bold', fontSize: 15};
state: any | {fontSize: number, fontWeight: string} = {
fontWeight: 'bold',
fontSize: 15,
};
toggleWeight = () => {
this.setState({
@@ -114,19 +117,20 @@ class AttributeToggler extends React.Component<{...}, $FlowFixMeState> {
});
};
render() {
render(): React.Node {
const curStyle = {
fontWeight: this.state.fontWeight,
fontSize: this.state.fontSize,
};
return (
<View>
{/* $FlowFixMe[incompatible-type] */}
<Text style={curStyle}>
Tap the controls below to change attributes.
</Text>
<Text>
<Text>
See how it will even work on{' '}
See how it will even work on {/* $FlowFixMe[incompatible-type] */}
<Text style={curStyle}>this nested text</Text>
</Text>
</Text>
@@ -156,7 +160,7 @@ class AdjustingFontSize extends React.Component<
AdjustingFontSizeProps,
AdjustingFontSizeState,
> {
state = {
state: AdjustingFontSizeState = {
dynamicText: '',
shouldRender: true,
};
@@ -192,7 +196,7 @@ class AdjustingFontSize extends React.Component<
});
};
render() {
render(): React.Node {
if (!this.state.shouldRender) {
return <View />;
}
@@ -270,7 +274,7 @@ class AdjustingFontSize extends React.Component<
}
class TextBaseLineLayoutExample extends React.Component<{}, mixed> {
render() {
render(): React.Node {
const texts = [];
for (let i = 9; i >= 0; i--) {
texts.push(
@@ -378,7 +382,21 @@ class TextRenderInfoExample extends React.Component<
}>,
},
> {
state = {
state: {
fontSize: number,
numberOfTextBlocks: number,
textMetrics: $ReadOnly<{
ascender: number,
capHeight: number,
descender: number,
height: number,
text?: string,
width: number,
x: number,
xHeight: number,
y: number,
}>,
} = {
textMetrics: {
x: 0,
y: 0,
@@ -393,7 +411,7 @@ class TextRenderInfoExample extends React.Component<
fontSize: 14,
};
render() {
render(): React.Node {
const topOfBox =
this.state.textMetrics.y +
this.state.textMetrics.height -
@@ -477,7 +495,19 @@ class TextWithCapBaseBox extends React.Component<
}>,
},
> {
state = {
state: {
textMetrics: $ReadOnly<{
ascender: number,
capHeight: number,
descender: number,
height: number,
text?: string,
width: number,
x: number,
xHeight: number,
y: number,
}>,
} = {
textMetrics: {
x: 0,
y: 0,
@@ -489,7 +519,7 @@ class TextWithCapBaseBox extends React.Component<
xHeight: 0,
},
};
render() {
render(): React.Node {
return (
<Text
onTextLayout={event => {
@@ -30,7 +30,7 @@ const TextInputSharedExamples = require('./TextInputSharedExamples.js');
import type {RNTesterModuleExample} from '../../types/RNTesterTypes';
class WithLabel extends React.Component<$FlowFixMeProps> {
render() {
render(): React.Node {
return (
<View style={styles.labelContainer}>
<View style={styles.label}>
@@ -51,7 +51,7 @@ class TextInputAccessoryViewChangeTextExample extends React.Component<
this.state = {text: 'Placeholder Text'};
}
render() {
render(): React.Node {
const inputAccessoryViewID = 'inputAccessoryView1';
return (
<View>
@@ -91,7 +91,7 @@ class TextInputAccessoryViewChangeKeyboardExample extends React.Component<
});
};
render() {
render(): React.Node {
const inputAccessoryViewID = 'inputAccessoryView2';
return (
<View>
@@ -127,7 +127,7 @@ class TextInputAccessoryViewDefaultDoneButtonExample extends React.Component<
this.state = {text: ''};
}
render() {
render(): React.Node {
return (
<TextInput
style={styles.default}
@@ -145,7 +145,7 @@ class RewriteExampleKana extends React.Component<$FlowFixMeProps, any> {
super(props);
this.state = {text: ''};
}
render() {
render(): React.Node {
return (
<View style={styles.rewriteContainer}>
<TextInput
@@ -170,7 +170,7 @@ class SecureEntryExample extends React.Component<$FlowFixMeProps, any> {
isSecureTextEntry: true,
};
}
render() {
render(): React.Node {
return (
<View>
<TextInput
@@ -230,7 +230,7 @@ class AutogrowingTextInputExample extends React.Component<
});
}
render() {
render(): React.Node {
const {style, multiline, ...props} = this.props;
return (
<View>
@@ -83,7 +83,7 @@ const styles = StyleSheet.create({
});
class WithLabel extends React.Component<$FlowFixMeProps> {
render() {
render(): React.Node {
return (
<View style={styles.labelContainer}>
<View style={styles.label}>
@@ -100,7 +100,7 @@ class RewriteExample extends React.Component<$FlowFixMeProps, any> {
super(props);
this.state = {text: ''};
}
render() {
render(): React.Node {
const limit = 20;
const remainder = limit - this.state.text.length;
const remainderColor = remainder > 5 ? 'blue' : 'red';
@@ -134,7 +134,7 @@ class RewriteExampleInvalidCharacters extends React.Component<
super(props);
this.state = {text: ''};
}
render() {
render(): React.Node {
return (
<View style={styles.rewriteContainer}>
<TextInput
@@ -162,7 +162,7 @@ class RewriteInvalidCharactersAndClearExample extends React.Component<
super(props);
this.state = {text: ''};
}
render() {
render(): React.Node {
return (
<View style={styles.rewriteContainer}>
<TextInput
@@ -199,7 +199,7 @@ class BlurOnSubmitExample extends React.Component<{...}> {
ref4 = React.createRef();
ref5 = React.createRef();
render() {
render(): React.Node {
return (
<View>
<TextInput
@@ -261,7 +261,7 @@ class SubmitBehaviorExample extends React.Component<{...}> {
ref10 = React.createRef();
ref11 = React.createRef();
render() {
render(): React.Node {
return (
<View>
<TextInput
@@ -333,7 +333,14 @@ class SubmitBehaviorExample extends React.Component<{...}> {
}
class TextEventsExample extends React.Component<{...}, $FlowFixMeState> {
state = {
state:
| any
| {
curText: string,
prev2Text: string,
prev3Text: string,
prevText: string,
} = {
curText: '<No Event>',
prevText: '<No Event>',
prev2Text: '<No Event>',
@@ -351,7 +358,7 @@ class TextEventsExample extends React.Component<{...}, $FlowFixMeState> {
});
};
render() {
render(): React.Node {
return (
<View>
<TextInput
@@ -401,7 +408,7 @@ class TokenizedTextExample extends React.Component<
super(props);
this.state = {text: 'Hello #World'};
}
render() {
render(): React.Node {
//define delimiter
let delimiter = /\s+/;
@@ -487,7 +494,7 @@ class SelectionExample extends React.Component<
this.setState({selection});
}
getRandomPosition() {
getRandomPosition(): number {
const length = this.state.value.length;
return Math.round(Math.random() * length);
}
@@ -516,7 +523,7 @@ class SelectionExample extends React.Component<
this.placeAt(this.getRandomPosition());
}
render() {
render(): React.Node {
const length = this.state.value.length;
return (
@@ -27,7 +27,7 @@ class RequestIdleCallbackTester extends React.Component<
RequestIdleCallbackTesterProps,
RequestIdleCallbackTesterState,
> {
state = {
state: RequestIdleCallbackTesterState = {
message: '-',
};
@@ -41,7 +41,7 @@ class RequestIdleCallbackTester extends React.Component<
}
}
render() {
render(): React.Node {
return (
<View>
{/* $FlowFixMe[method-unbinding] added when improving typing for this
@@ -159,7 +159,7 @@ class TimerTester extends React.Component<TimerTesterProps> {
_immediateId: ?Object = null;
_timerFn: ?() => any = null;
render() {
render(): any {
const args =
'fn' + (this.props.dt !== undefined ? ', ' + this.props.dt : '');
return (
@@ -274,13 +274,13 @@ class IntervalExample extends React.Component<
showTimer: boolean,
|},
> {
state = {
state: {showTimer: boolean} = {
showTimer: true,
};
_timerTester: ?React.ElementRef<typeof TimerTester>;
render() {
render(): React.Node {
return (
<View>
{this.state.showTimer && this._renderTimer()}
@@ -291,7 +291,7 @@ class IntervalExample extends React.Component<
);
}
_renderTimer = () => {
_renderTimer = (): React.Node => {
return (
<View>
<TimerTester
@@ -29,7 +29,7 @@ const forceTouchAvailable =
(Platform.OS === 'ios' && Platform.constants.forceTouchAvailable) || false;
class TouchableHighlightBox extends React.Component<{...}, $FlowFixMeState> {
state = {
state: any | {timesPressed: number} = {
timesPressed: 0,
};
@@ -39,7 +39,7 @@ class TouchableHighlightBox extends React.Component<{...}, $FlowFixMeState> {
});
};
render() {
render(): React.Node {
let textLog = '';
if (this.state.timesPressed > 1) {
textLog = this.state.timesPressed + 'x TouchableHighlight onPress';
@@ -79,7 +79,7 @@ class TouchableWithoutFeedbackBox extends React.Component<
{...},
$FlowFixMeState,
> {
state = {
state: any | {timesPressed: number} = {
timesPressed: 0,
};
@@ -89,7 +89,7 @@ class TouchableWithoutFeedbackBox extends React.Component<
});
};
render() {
render(): React.Node {
let textLog = '';
if (this.state.timesPressed > 1) {
textLog = this.state.timesPressed + 'x TouchableWithoutFeedback onPress';
@@ -115,7 +115,7 @@ class TouchableWithoutFeedbackBox extends React.Component<
}
class TextOnPressBox extends React.Component<{...}, $FlowFixMeState> {
state = {
state: any | {timesPressed: number} = {
timesPressed: 0,
};
@@ -125,7 +125,7 @@ class TextOnPressBox extends React.Component<{...}, $FlowFixMeState> {
});
};
render() {
render(): React.Node {
let textLog = '';
if (this.state.timesPressed > 1) {
textLog = this.state.timesPressed + 'x text onPress';
@@ -150,11 +150,11 @@ class TextOnPressBox extends React.Component<{...}, $FlowFixMeState> {
}
class TouchableFeedbackEvents extends React.Component<{...}, $FlowFixMeState> {
state = {
state: any | {eventLog: Array<string>} = {
eventLog: [],
};
render() {
render(): React.Node {
return (
<View testID="touchable_feedback_events">
<View style={[styles.row, styles.centered]}>
@@ -190,11 +190,11 @@ class TouchableFeedbackEvents extends React.Component<{...}, $FlowFixMeState> {
}
class TouchableDelayEvents extends React.Component<{...}, $FlowFixMeState> {
state = {
state: any | {eventLog: Array<string>} = {
eventLog: [],
};
render() {
render(): React.Node {
return (
<View testID="touchable_delay_events">
<View style={[styles.row, styles.centered]}>
@@ -231,17 +231,17 @@ class TouchableDelayEvents extends React.Component<{...}, $FlowFixMeState> {
}
class ForceTouchExample extends React.Component<{...}, $FlowFixMeState> {
state = {
state: any | {force: number} = {
force: 0,
};
_renderConsoleText = () => {
_renderConsoleText = (): string => {
return forceTouchAvailable
? 'Force: ' + this.state.force.toFixed(3)
: '3D Touch is not available on this device';
};
render() {
render(): React.Node {
return (
<View testID="touchable_3dtouch_event">
<View style={styles.forceTouchBox} testID="touchable_3dtouch_output">
@@ -265,7 +265,7 @@ class ForceTouchExample extends React.Component<{...}, $FlowFixMeState> {
}
class TouchableHitSlop extends React.Component<{...}, $FlowFixMeState> {
state = {
state: any | {timesPressed: number} = {
timesPressed: 0,
};
@@ -275,7 +275,7 @@ class TouchableHitSlop extends React.Component<{...}, $FlowFixMeState> {
});
};
render() {
render(): React.Node {
let log = '';
if (this.state.timesPressed > 1) {
log = this.state.timesPressed + 'x onPress';
@@ -345,7 +345,7 @@ function TouchableNativeMethods() {
}
class TouchableDisabled extends React.Component<{...}> {
render() {
render(): React.Node {
return (
<View>
<TouchableOpacity disabled={true} style={[styles.row, styles.block]}>
@@ -14,7 +14,7 @@ const React = require('react');
const {Text, View, TouchableOpacity, Alert} = require('react-native');
class TransparentHitTestExample extends React.Component<{...}> {
render() {
render(): React.Node {
return (
<View style={{flex: 1}}>
<TouchableOpacity onPress={() => Alert.alert('Alert', 'Hi!')}>
@@ -129,7 +129,7 @@ class SampleTurboModuleExample extends React.Component<{||}, State> {
| 'promise'
| 'rejectPromise'
| 'voidFunc',
) {
): React.Node {
const result = this.state.testResults[name] || {};
return (
<View style={styles.result}>
@@ -139,7 +139,7 @@ class SampleTurboModuleExample extends React.Component<{||}, State> {
);
}
componentDidMount() {
componentDidMount(): void {
if (global.__turboModuleProxy == null) {
throw new Error(
'Cannot load this example because TurboModule is not configured.',
@@ -24,11 +24,11 @@ class ViewBorderStyleExample extends React.Component<
$ReadOnly<{||}>,
{|showBorder: boolean|},
> {
state = {
state: {showBorder: boolean} = {
showBorder: true,
};
render() {
render(): React.Node {
return (
<TouchableWithoutFeedback onPress={this._handlePress}>
<View>
@@ -87,11 +87,11 @@ class OffscreenAlphaCompositing extends React.Component<
active: boolean,
|},
> {
state = {
state: {active: boolean} = {
active: false,
};
render() {
render(): React.Node {
return (
<TouchableWithoutFeedback onPress={this._handlePress}>
<View>
@@ -169,11 +169,11 @@ class ZIndexExample extends React.Component<
flipped: boolean,
|},
> {
state = {
state: {flipped: boolean} = {
flipped: false,
};
render() {
render(): React.Node {
const indices = this.state.flipped ? [-1, 0, 1, 2] : [2, 1, 0, -1];
return (
<TouchableWithoutFeedback onPress={this._handlePress}>
@@ -239,11 +239,11 @@ class DisplayNoneStyle extends React.Component<
index: number,
|},
> {
state = {
state: {index: number} = {
index: 0,
};
render() {
render(): React.Node {
return (
<TouchableWithoutFeedback onPress={this._handlePress}>
<View>
@@ -39,7 +39,7 @@ class XHRExampleFetch extends React.Component<any, any> {
});
}
_renderHeaders() {
_renderHeaders(): null | Array<React.Node> {
if (!this.responseHeaders) {
return null;
}
@@ -40,11 +40,11 @@ function createContainer<Props: Object, State>(
Props,
$FlowFixMeState,
> {
static displayName = `RNTesterStatePersister(${String(
static displayName: ?string = `RNTesterStatePersister(${String(
Component.displayName ?? Component.name,
)})`;
state = {value: spec.getInitialState(this.props)};
_cacheKey = `RNTester:${spec.version || 'v1'}:${spec.cacheKeySuffix(
state: any | {value: State} = {value: spec.getInitialState(this.props)};
_cacheKey: string = `RNTester:${spec.version || 'v1'}:${spec.cacheKeySuffix(
this.props,
)}`;
componentDidMount() {