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

How to use types interfaces mentioned inside react native inside react-native-web app ? #2689

Open
1 task done
archana-iron opened this issue Jun 19, 2024 · 0 comments
Open
1 task done
Labels
enhancement Requires extension or creation of new React Native API

Comments

@archana-iron
Copy link

Is there an existing request?

  • I have searched for this request

Describe the feature request

I am building a react js web custom component package where I have to show the preview of my mobile components. So I created a react native components package and later added a clone copy of the package for the react native web app also by using an alias. Now, the problem is I am not able to use the types used inside react native component inside the react native component package.
Example:

import React, { memo } from 'react';
import { View as NativeView, type ViewStyle } from 'react-native-web';

export interface ViewProps {
children?: React.ReactNode;
style?: {
style?: ViewStyle;
};
}

function View({ children = null, style = {}, ...rest }: ViewProps) {
return (
<NativeView style={style?.style} {...rest}>
{children}

);
}

View.displayName = 'View';

export default memo(View);

Getting error: Unsafe type declaration for 'any', inside <NativeView style={style?.style} {...rest}>, for style?.style. Please suggest how I can use react native types inside the react native web package.

Can we use react native types inside the react native web app or custom package where we have used react native web? If yes, please suggest how.

@archana-iron archana-iron added the enhancement Requires extension or creation of new React Native API label Jun 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Requires extension or creation of new React Native API
Projects
None yet
Development

No branches or pull requests

1 participant