Skip to content

Commit

Permalink
Align types for different ios/android implementation files (#38761)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: #38761

Changelog: [Internal]

Reviewed By: yungsters

Differential Revision: D48014272

fbshipit-source-id: d70c2b9442cedf87e72be336c7a25372daea8f28
  • Loading branch information
SamChou19815 authored and facebook-github-bot committed Aug 3, 2023
1 parent 0a1c2ef commit 90c0e3b
Show file tree
Hide file tree
Showing 7 changed files with 57 additions and 28 deletions.
2 changes: 1 addition & 1 deletion packages/react-native/Libraries/Image/Image.android.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ export type ImageComponentStatics = $ReadOnly<{|
getSizeWithHeaders: typeof getSizeWithHeaders,
prefetch: typeof prefetch,
prefetchWithMetadata: typeof prefetchWithMetadata,
abortPrefetch: typeof abortPrefetch,
abortPrefetch?: typeof abortPrefetch,
queryCache: typeof queryCache,
resolveAssetSource: typeof resolveAssetSource,
|}>;
Expand Down
1 change: 1 addition & 0 deletions packages/react-native/Libraries/Image/Image.ios.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ export type ImageComponentStatics = $ReadOnly<{|
getSizeWithHeaders: typeof getSizeWithHeaders,
prefetch: typeof prefetch,
prefetchWithMetadata: typeof prefetchWithMetadata,
abortPrefetch?: number => void,
queryCache: typeof queryCache,
resolveAssetSource: typeof resolveAssetSource,
|}>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
*/

import type {RequestBody} from './convertRequestBody';
import type {NativeResponseType} from './XMLHttpRequest';

// Do not require the native RCTNetworking module directly! Use this wrapper module instead.
// It will add the necessary requestId, so that you don't have to generate it yourself.
Expand Down Expand Up @@ -54,7 +55,7 @@ class RCTNetworking extends NativeEventEmitter<$FlowFixMe> {
url: string,
headers: Object,
data: RequestBody,
responseType: 'text' | 'base64',
responseType: NativeResponseType,
incrementalUpdates: boolean,
timeout: number,
callback: (requestId: number) => mixed,
Expand Down
16 changes: 11 additions & 5 deletions packages/rn-tester/js/examples/Text/TextExample.android.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

'use strict';

import type {RNTesterModule} from '../../types/RNTesterTypes';
import TextAdjustsDynamicLayoutExample from './TextAdjustsDynamicLayoutExample';

const RNTesterBlock = require('../../components/RNTesterBlock');
Expand Down Expand Up @@ -981,11 +982,7 @@ function TextBaseLineLayoutExample(props: {}): React.Node {
);
}

exports.title = 'Text';
exports.documentationURL = 'https://reactnative.dev/docs/text';
exports.category = 'Basic';
exports.description = 'Base component for rendering styled text.';
exports.examples = [
const examples = [
{
title: 'Basic text',
render: function (): React.Element<typeof TextExample> {
Expand Down Expand Up @@ -1031,3 +1028,12 @@ exports.examples = [
},
},
];

module.exports = ({
title: 'Text',
documentationURL: 'https://reactnative.dev/docs/text',
category: 'Basic',
description: 'Base component for rendering styled text.',
displayName: 'TextExample',
examples,
}: RNTesterModule);
18 changes: 12 additions & 6 deletions packages/rn-tester/js/examples/Text/TextExample.ios.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@

'use strict';

import type {RNTesterModule} from '../../types/RNTesterTypes';

const React = require('react');
const TextAncestor = require('react-native/Libraries/Text/TextAncestor');
const TextInlineView = require('../../components/TextInlineView');
Expand Down Expand Up @@ -546,12 +548,7 @@ class TextWithCapBaseBox extends React.Component<
}
}

exports.title = 'Text';
exports.documentationURL = 'https://reactnative.dev/docs/text';
exports.category = 'Basic';
exports.description = 'Base component for rendering styled text.';
exports.displayName = 'TextExample';
exports.examples = [
const examples = [
{
title: 'Wrap',
render: function (): React.Node {
Expand Down Expand Up @@ -1332,3 +1329,12 @@ exports.examples = [
},
},
];

module.exports = ({
title: 'Text',
documentationURL: 'https://reactnative.dev/docs/text',
category: 'Basic',
description: 'Base component for rendering styled text.',
displayName: 'TextExample',
examples,
}: RNTesterModule);
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@ const {Text, TextInput, View, StyleSheet, Switch} = require('react-native');

const TextInputSharedExamples = require('./TextInputSharedExamples.js');

import type {RNTesterModuleExample} from '../../types/RNTesterTypes';
import type {
RNTesterModule,
RNTesterModuleExample,
} from '../../types/RNTesterTypes';

class ToggleDefaultPaddingExample extends React.Component<
$FlowFixMeProps,
Expand Down Expand Up @@ -151,11 +154,7 @@ const styles = StyleSheet.create({
},
});

exports.title = 'TextInput';
exports.documentationURL = 'https://reactnative.dev/docs/textinput';
exports.category = 'Basic';
exports.description = 'Single and multi-line text inputs.';
exports.examples = ([
const examples: Array<RNTesterModuleExample> = [
...TextInputSharedExamples,
{
title: 'Colors and text inputs',
Expand Down Expand Up @@ -531,4 +530,13 @@ exports.examples = ([
return <ToggleDefaultPaddingExample />;
},
},
]: Array<RNTesterModuleExample>);
];

module.exports = ({
displayName: (undefined: ?string),
title: 'TextInput',
documentationURL: 'https://reactnative.dev/docs/textinput',
category: 'Basic',
description: 'Single and multi-line text inputs.',
examples,
}: RNTesterModule);
23 changes: 15 additions & 8 deletions packages/rn-tester/js/examples/TextInput/TextInputExample.ios.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,10 @@ import type {KeyboardType} from 'react-native/Libraries/Components/TextInput/Tex

const TextInputSharedExamples = require('./TextInputSharedExamples.js');

import type {RNTesterModuleExample} from '../../types/RNTesterTypes';
import type {
RNTesterModule,
RNTesterModuleExample,
} from '../../types/RNTesterTypes';

class WithLabel extends React.Component<$FlowFixMeProps> {
render(): React.Node {
Expand Down Expand Up @@ -322,12 +325,7 @@ const styles = StyleSheet.create({
},
});

exports.displayName = (undefined: ?string);
exports.title = 'TextInput';
exports.documentationURL = 'https://reactnative.dev/docs/textinput';
exports.category = 'Basic';
exports.description = 'Single and multi-line text inputs.';
exports.examples = ([
const examples: Array<RNTesterModuleExample> = [
...TextInputSharedExamples,
{
title: 'Live Re-Write (ひ -> 日)',
Expand Down Expand Up @@ -940,4 +938,13 @@ exports.examples = ([
);
},
},
]: Array<RNTesterModuleExample>);
];

module.exports = ({
displayName: (undefined: ?string),
title: 'TextInput',
documentationURL: 'https://reactnative.dev/docs/textinput',
category: 'Basic',
description: 'Single and multi-line text inputs.',
examples,
}: RNTesterModule);

0 comments on commit 90c0e3b

Please sign in to comment.