create-expo-stack icon indicating copy to clipboard operation
create-expo-stack copied to clipboard

Button.tsx does not compile in tamagui

Open Mellbourn opened this issue 10 months ago • 1 comments

When configuring a new app with Tamagui, components/Button.tsx does not compile when running tsc --noEmit

Expected Behavior

No compilation errors.

Current Behavior

I get these compilation errors

components/Button.tsx:3:10 - error TS2614: Module '"../tamagui.config"' has no exported member 'Button'. Did you mean to use 'import Button from "../tamagui.config"' instead?

3 import { Button as TButton, ButtonText } from '../tamagui.config';
           ~~~~~~

components/Button.tsx:3:29 - error TS2614: Module '"../tamagui.config"' has no exported member 'ButtonText'. Did you mean to use 'import ButtonText from "../tamagui.config"' instead?

3 import { Button as TButton, ButtonText } from '../tamagui.config';
                              ~~~~~~~~~~

components/Button.tsx:5:34 - error TS2304: Cannot find name 'TouchableOpacity'.

5 export const Button = forwardRef<TouchableOpacity, ButtonProps>(({ onPress, title }, ref) => {
                                   ~~~~~~~~~~~~~~~~

components/Button.tsx:5:52 - error TS2304: Cannot find name 'ButtonProps'.

5 export const Button = forwardRef<TouchableOpacity, ButtonProps>(({ onPress, title }, ref) => {

Possible Solution

Implement Button and ButtonText in tamagui.config

Steps to Reproduce

Generate a new app using typescript and tamagui.

Repo which reproduces this bug: https://github.com/Mellbourn/expo-stack

Mellbourn avatar Apr 24 '24 13:04 Mellbourn

Workaround is to remove Button.tsx as it doesn't seem to be used

Mellbourn avatar Apr 24 '24 13:04 Mellbourn

fixed via #328

danstepanov avatar Jun 17 '24 21:06 danstepanov