Skip to content

Commit

Permalink
Add missing class annotations xplat/js [android]
Browse files Browse the repository at this point in the history
Reviewed By: SamChou19815

Differential Revision: D38375460

fbshipit-source-id: 265f36635c3bc672ee222b78a852034c1f865bcc
  • Loading branch information
pieterv authored and facebook-github-bot committed Aug 4, 2022
1 parent 2e64900 commit c687dd3
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ class DrawerLayoutAndroid extends React.Component<Props, State> {
return {Left: 'left', Right: 'right'};
}

// $FlowFixMe[missing-local-annot]
_nativeRef =
React.createRef<
React.ElementRef<typeof AndroidDrawerLayoutNativeComponent>,
Expand Down
13 changes: 8 additions & 5 deletions packages/rn-tester/js/examples/Text/TextExample.android.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import TextLegend from '../../components/TextLegend';
const {LayoutAnimation, StyleSheet, Text, View} = require('react-native');

class Entity extends React.Component<{|children: React.Node|}> {
render() {
render(): React.Node {
return (
<Text style={{fontWeight: 'bold', color: '#527fe4'}}>
{this.props.children}
Expand All @@ -30,7 +30,10 @@ class Entity extends React.Component<{|children: React.Node|}> {
}
}
class AttributeToggler extends React.Component<{...}, $FlowFixMeState> {
state = {fontWeight: 'bold', fontSize: 15};
state: {fontSize: number, fontWeight: 'bold' | 'normal'} = {
fontWeight: 'bold',
fontSize: 15,
};

toggleWeight = () => {
this.setState({
Expand All @@ -44,7 +47,7 @@ class AttributeToggler extends React.Component<{...}, $FlowFixMeState> {
});
};

render() {
render(): React.Node {
const curStyle = {
fontWeight: this.state.fontWeight,
fontSize: this.state.fontSize,
Expand Down Expand Up @@ -83,7 +86,7 @@ class AdjustingFontSize extends React.Component<
AdjustingFontSizeProps,
AdjustingFontSizeState,
> {
state = {
state: AdjustingFontSizeState = {
dynamicText: '',
shouldRender: true,
};
Expand Down Expand Up @@ -119,7 +122,7 @@ class AdjustingFontSize extends React.Component<
});
};

render() {
render(): React.Node {
if (!this.state.shouldRender) {
return <View />;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class ToggleDefaultPaddingExample extends React.Component<
super(props);
this.state = {hasPadding: false};
}
render() {
render(): React.Node {
return (
<View>
<TextInput style={this.state.hasPadding ? {padding: 0} : null} />
Expand Down Expand Up @@ -79,7 +79,7 @@ class AutogrowingTextInputExample extends React.Component<{...}> {
});
}

render() {
render(): React.Node {
/* $FlowFixMe(>=0.78.0 site=react_native_android_fb) This issue was found
* when making Flow check .android.js files. */
const {style, multiline, ...props} = this.props;
Expand Down

0 comments on commit c687dd3

Please sign in to comment.