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

Issue with enums #1

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
51 changes: 30 additions & 21 deletions src/template.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { View } from 'react-native';
import { Text } from 'react-native';
import { TouchableOpacity } from './TouchableOpacity';

export const styled = (Component: React.ComponentType) => (styles: any) => {
Expand All @@ -10,27 +10,36 @@ export const styled = (Component: React.ComponentType) => (styles: any) => {
export const Module = () => {
return (
<TouchableOpacity>
<Comp1 />
<Comp2 />
<Comp3 />
<Comp4 />
<Comp5 />
<Comp1 text={TextType.Simple} />
<Comp2 text={TextType.Simple} />
<Comp3 text={TextType.Simple} />
<Comp4 text={TextType.Simple} />
<Comp5 text={TextType.Simple} />
</TouchableOpacity>
);
};

var _a;

// incorrect
const Comp1 = styled(View)(_a || (_a = null));
const Comp2 = styled(View)(_a || (_a = null));
const Comp3 = styled(View)(_a || (_a = null));
const Comp4 = styled(View)(_a || (_a = null));
const Comp5 = styled(View)(_a || (_a = null));

// correct
// const Comp1 = styled(View)(_a || null);
// const Comp2 = styled(View)(_a || null);
// const Comp3 = styled(View)(_a || null);
// const Comp4 = styled(View)(_a || null);
// const Comp5 = styled(View)(_a || null);
enum TextType {
Simple = 1,
}


const Comp1 = ({text }: { text: TextType }) => {
return <Text>{text}</Text>;
};

const Comp2 = ({text}: { text: TextType }) => {
return <Text>{text}</Text>;
};

const Comp3 = ({text}: { text: TextType }) => {
return <Text>{text}</Text>;
};

const Comp4 = ({text}: { text: TextType }) => {
return <Text>{text}</Text>;
};

const Comp5 = ({text}: { text: TextType }) => {
return <Text>{text}</Text>;
};