Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add basic support for React Server Components #2678

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
*
* @flow
*/
'use client';

import type { ViewProps } from '../View';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
* @flow
*/

'use client';

import * as React from 'react';
import StyleSheet from '../StyleSheet';
import View from '../View';
Expand Down
1 change: 1 addition & 0 deletions packages/react-native-web/src/exports/CheckBox/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
*
* @flow
*/
'use client';

import type { ColorValue } from '../../types';
import type { ViewProps } from '../View';
Expand Down
2 changes: 2 additions & 0 deletions packages/react-native-web/src/exports/FlatList/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,7 @@
* @flow
*/

'use client';

import FlatList from '../../vendor/react-native/FlatList';
export default FlatList;
1 change: 1 addition & 0 deletions packages/react-native-web/src/exports/Image/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
*
* @flow
*/
'use client';

import type { ImageProps } from './types';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
*
* @flow
*/
'use client';

import type { LayoutEvent, LayoutValue } from '../../types';
import type { ViewProps } from '../View';
Expand Down
1 change: 1 addition & 0 deletions packages/react-native-web/src/exports/Modal/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
*
* @flow
*/
'use client';

import type { ViewProps } from '../View';

Expand Down
1 change: 1 addition & 0 deletions packages/react-native-web/src/exports/Picker/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
*
* @flow
*/
'use client';

import type { PlatformMethods } from '../../types';
import type { ViewProps } from '../View';
Expand Down
3 changes: 1 addition & 2 deletions packages/react-native-web/src/exports/Pressable/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@
*
* @flow strict-local
*/

'use strict';
'use client';

import type { HoverEventsConfig } from '../../modules/useHover';
import type { PressResponderConfig } from '../../modules/usePressEvents/PressResponder';
Expand Down
1 change: 1 addition & 0 deletions packages/react-native-web/src/exports/ScrollView/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
*
* @noflow
*/
'use client';

import type { ViewProps, ViewStyle } from '../View/types';

Expand Down
1 change: 1 addition & 0 deletions packages/react-native-web/src/exports/SectionList/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
*
* @flow
*/
'use client';

import SectionList from '../../vendor/react-native/SectionList';
export default SectionList;
1 change: 1 addition & 0 deletions packages/react-native-web/src/exports/Switch/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
*
* @flow
*/
'use client';

import type { ColorValue } from '../../types';
import type { ViewProps } from '../View';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
*
* @flow strict
*/
'use client';

import type { Context } from 'react';

Expand Down
1 change: 1 addition & 0 deletions packages/react-native-web/src/exports/Text/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
*
* @flow
*/
'use client';

import type { PlatformMethods } from '../../types';
import type { TextProps } from './types';
Expand Down
1 change: 1 addition & 0 deletions packages/react-native-web/src/exports/TextInput/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
*
* @flow
*/
'use client';

import type { PlatformMethods } from '../../types';
import type { TextInputProps } from './types';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@
* @flow strict-local
* @format
*/

'use strict';
'use client';

import type { ColorValue } from '../../types';
import type { Props as TouchableWithoutFeedbackProps } from '../TouchableWithoutFeedback';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@
* @flow strict-local
* @format
*/

'use strict';
'use client';

import type { Props as TouchableWithoutFeedbackProps } from '../TouchableWithoutFeedback';
import type { ViewProps } from '../View';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@
* @flow strict-local
* @format
*/

'use strict';
'use client';

import type { PressResponderConfig } from '../../modules/usePressEvents/PressResponder';
import type { ViewProps } from '../View';
Expand Down
1 change: 1 addition & 0 deletions packages/react-native-web/src/exports/View/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
*
* @flow
*/
'use client';

import type { PlatformMethods } from '../../types';
import type { ViewProps } from './types';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
*
* @flow
*/
'use client';

import VirtualizedList from '../../vendor/react-native/VirtualizedList';
export default VirtualizedList;
1 change: 1 addition & 0 deletions packages/react-native-web/src/exports/render/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
*
* @noflow
*/
'use client';

import {
hydrate as domLegacyHydrate,
Expand Down
2 changes: 2 additions & 0 deletions packages/react-native-web/src/exports/useColorScheme/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
* @flow
*/

'use client';

import * as React from 'react';
import type { ColorSchemeName } from '../Appearance';
import Appearance from '../Appearance';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* @flow strict-local
*/

'use strict';
'use client';

import type { DisplayMetrics } from '../Dimensions';

Expand Down
12 changes: 3 additions & 9 deletions packages/react-native-web/src/modules/UnimplementedView/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,17 @@
*
* @flow
*/

import type { Node } from 'React';

import View from '../../exports/View';
import type { ViewProps } from '../../exports/View/types';
import React from 'react';

/**
* Common implementation for a simple stubbed view.
*/
class UnimplementedView extends React.Component<*, *> {
render(): Node {
return (
<View style={[unimplementedViewStyles, this.props.style]}>
{this.props.children}
</View>
);
}
function UnimplementedView({ style, ...props }: ViewProps): Node {
return <View {...props} style={[unimplementedViewStyles, style]} />;
}

const unimplementedViewStyles =
Expand Down
1 change: 1 addition & 0 deletions packages/react-native-web/src/modules/useLocale/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
*
* @flow strict
*/
'use client';
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this move to exports/useLocaleContext?


import type { Node } from 'react';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
* @flow
*/

'use client';
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why does this module need use client?


/**
* Hook for integrating the Responder System into React
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
* @format
*/

'use client';
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this move to exports/FlatList?


import View, { type ViewProps } from '../../../exports/View';
import StyleSheet from '../../../exports/StyleSheet';
import deepDiffer from '../deepDiffer';
Expand Down
Loading