typewind icon indicating copy to clipboard operation
typewind copied to clipboard

Expo integration

Open SamueleBarbiera opened this issue 2 years ago • 6 comments

Discussed in https://github.com/Mokshit06/typewind/discussions/27

Originally posted by SamueleBarbiera February 7, 2023 Can it be used lime nativewind or even implementend in the t3-turbo stack?

SamueleBarbiera avatar Feb 23 '23 16:02 SamueleBarbiera

I tried to run in it in a solito app but it gave me this error Screenshot 2023-02-24 alle 22 06 53

##with this error in the console

iOS Bundling complete 60ms
 LOG  {"tw": undefined}
 LOG  {"tw": undefined}
 ERROR  TypeError: undefined is not an object (evaluating '_typewind.tw.bg_blue_500')

This error is located at:
    in HomeScreen (created by SceneView)
    in StaticContainer
    in EnsureSingleNavigator (created by SceneView)
    in SceneView (created by SceneView)
    in RCTView (created by View)
    in View (created by DebugContainer)
    in DebugContainer (created by MaybeNestedStack)
    in MaybeNestedStack (created by SceneView)
    in RNSScreen (created by AnimatedComponent)
    in AnimatedComponent
    in AnimatedComponentWrapper (created by Screen)
    in MaybeFreeze (created by Screen)
    in Screen (created by SceneView)
    in SceneView (created by NativeStackViewInner)
    in RNSScreenStack (created by ScreenStack)
    in ScreenStack (created by NativeStackViewInner)
    in NativeStackViewInner (created by NativeStackView)
    in RCTView (created by View)
    in View (created by SafeAreaInsetsContext)
    in SafeAreaProviderCompat (created by NativeStackView)
    in NativeStackView (created by NativeStackNavigator)
    in Unknown (created by NativeStackNavigator)
    in NativeStackNavigator (created by NativeNavigation)
    in NativeNavigation (created by App)
    in EnsureSingleNavigator
    in BaseNavigationContainer
    in ThemeProvider
    in NavigationContainerInner (created by NavigationProvider)
    in NavigationProvider (created by Provider)
    in RNCSafeAreaProvider (created by SafeAreaProvider)
    in SafeAreaProvider (created by Provider)
    in Provider (created by App)
    in App (created by ExpoRoot)
    in ExpoRoot
    in RCTView (created by View)
    in View (created by AppContainer)
    in DevAppContainer (created by AppContainer)
    in RCTView (created by View)
    in View (created by AppContainer)
    in AppContainer
    in main(RootComponent)
 WARN  Possible Unhandled Promise Rejection (id: 0):
TypeError: undefined is not an object (evaluating '_typewind.tw.bg_blue_500')
HomeScreen@http://192.168.1.49:19000/index.bundle?platform=ios&dev=true&hot=false:131780:34
renderWithHooks@http://192.168.1.49:19000/index.bundle?platform=ios&dev=true&hot=false:10111:33
mountIndeterminateComponent@http://192.168.1.49:19000/index.bundle?platform=ios&dev=true&hot=false:13636:34
beginWork$1@http://192.168.1.49:19000/index.bundle?platform=ios&dev=true&hot=false:17988:29
performUnitOfWork@http://192.168.1.49:19000/index.bundle?platform=ios&dev=true&hot=false:17457:29
workLoopSync@http://192.168.1.49:19000/index.bundle?platform=ios&dev=true&hot=false:17396:28
renderRootSync@http://192.168.1.49:19000/index.bundle?platform=ios&dev=true&hot=false:17374:25
performSyncWorkOnRoot@http://192.168.1.49:19000/index.bundle?platform=ios&dev=true&hot=false:17119:40
performSyncWorkOnRoot@[native code]
flushSyncCallbacks@http://192.168.1.49:19000/index.bundle?platform=ios&dev=true&hot=false:7092:36
flushSyncCallbacksOnlyInLegacyMode@http://192.168.1.49:19000/index.bundle?platform=ios&dev=true&hot=false:7073:29
scheduleUpdateOnFiber@http://192.168.1.49:19000/index.bundle?platform=ios&dev=true&hot=false:16703:47
dispatchSetState@http://192.168.1.49:19000/index.bundle?platform=ios&dev=true&hot=false:11072:43
dispatchSetState@[native code]
resolve$@http://192.168.1.49:19000/index.bundle?platform=ios&dev=true&hot=false:128319:27
tryCatch@http://192.168.1.49:19000/index.bundle?platform=ios&dev=true&hot=false:25253:23
@http://192.168.1.49:19000/index.bundle?platform=ios&dev=true&hot=false:25233:34
tryCatch@http://192.168.1.49:19000/index.bundle?platform=ios&dev=true&hot=false:25253:23
invoke@http://192.168.1.49:19000/index.bundle?platform=ios&dev=true&hot=false:25291:30
@http://192.168.1.49:19000/index.bundle?platform=ios&dev=true&hot=false:25297:19
tryCallOne@http://192.168.1.49:19000/index.bundle?platform=ios&dev=true&hot=false:31081:16
@http://192.168.1.49:19000/index.bundle?platform=ios&dev=true&hot=false:31182:27
@http://192.168.1.49:19000/index.bundle?platform=ios&dev=true&hot=false:32273:26
_callTimer@http://192.168.1.49:19000/index.bundle?platform=ios&dev=true&hot=false:32173:17
_callReactNativeMicrotasksPass@http://192.168.1.49:19000/index.bundle?platform=ios&dev=true&hot=false:32208:17
callReactNativeMicrotasks@http://192.168.1.49:19000/index.bundle?platform=ios&dev=true&hot=false:32415:44
__callReactNativeMicrotasks@http://192.168.1.49:19000/index.bundle?platform=ios&dev=true&hot=false:24045:46
@http://192.168.1.49:19000/index.bundle?platform=ios&dev=true&hot=false:23824:45
__guard@http://192.168.1.49:19000/index.bundle?platform=ios&dev=true&hot=false:24028:15
flushedQueue@http://192.168.1.49:19000/index.bundle?platform=ios&dev=true&hot=false:23823:21
flushedQueue@[native code]
invokeCallbackAndReturnFlushedQueue@[native code]

##if I try to generate the types I get this error from the cli

TypeError: Cannot read properties of undefined (reading 'some')
    at /Users/samuelebarbiera/Desktop/solito-typewind/node_modules/typewind/dist/cli.js:182:35
    at Array.map (<anonymous>)
    at generateTypes (/Users/samuelebarbiera/Desktop/solito-typewind/node_modules/typewind/dist/cli.js:175:30)
    at Object.<anonymous> (/Users/samuelebarbiera/Desktop/solito-typewind/node_modules/typewind/dist/cli.js:274:1)
    at Module._compile (node:internal/modules/cjs/loader:1226:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1280:10)
    at Module.load (node:internal/modules/cjs/loader:1089:32)
    at Module._load (node:internal/modules/cjs/loader:930:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
    at node:internal/main/run_main_module:23:47```

SamueleBarbiera avatar Feb 24 '23 21:02 SamueleBarbiera

ok now at least i get the error from ts on the ide cause of the missing types

Property 'bg_blue_500' does not exist on type 'TypewindError<"Typewind's types haven't been generated. Run `npx typewind generate` or follow the docs at https://typewind.vercel.app/docs/installation">'.
Translation: You're trying to access bg_blue_500 on an object that doesn't contain it.

BUT! when I run the npx typewind generate command I get this error

TypeError: Cannot read properties of undefined (reading 'some')
    at /Users/samuelebarbiera/Desktop/solito-typewind/node_modules/typewind/dist/cli.js:182:35

if u want to reproduce this issue this is the repo: https://github.com/SamueleBarbiera/solito-typewind-turborepo

SamueleBarbiera avatar Feb 26 '23 18:02 SamueleBarbiera

I set up the swc plugin integration by the way! and it doesn't give me the error above https://github.com/Mokshit06/typewind/issues/31#issuecomment-1444491289 @Mokshit06 @kavinvalli

SamueleBarbiera avatar Feb 26 '23 18:02 SamueleBarbiera

Oh it works? Will check this out once. Thanks for the update!

kavinvalli avatar Feb 26 '23 18:02 kavinvalli

Oh it works? Will check this out once. Thanks for the update!

not yet @kavinvalli ... the only problem is the types generator that gives the error , and if we solve that it can even run on expo!!

TypeError: Cannot read properties of undefined (reading 'some')
    at /Users/samuelebarbiera/Desktop/solito-typewind/node_modules/typewind/dist/cli.js:182:35

SamueleBarbiera avatar Feb 27 '23 07:02 SamueleBarbiera

oh by the way i'll try to fork the repo and solve the error and put the lib in my turbo repo as a workspace dependency

SamueleBarbiera avatar Feb 27 '23 07:02 SamueleBarbiera